redis终端简单命令

keys * 获取所有键
lRange hongbao:44 0 -1获取该键的所有值
del hongbao:44 删除该键的所有值

hgetAll user:44 获取该键的所有队列
hget hongbao:44 8 获取该队列用户为8的值
hset hongbao:44 7 'asdf'设置该队列用户为7的值
hdel user:44 8 删除该队列用户为8的值


flushall 清空redis所有缓存数据

 

 

<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

namespace Home\Controller;
use Think\Controller;
use Home\Util\ApiResponse;

/**
* Description of RedisController
*
* @author Administrator
*/
class SweepController extends BaseController{
/**
* 检测redis是否正常运行
*/
public function __construct(){
parent::__construct();
if (!extension_loaded('redis')) {
E(L('_NOT_SUPPORT_') . ':redis');
}
if (empty($options)) {
$options = array(
'host' => C('REDIS_HOST') ? C('REDIS_HOST') : '127.0.0.1',
'port' => C('REDIS_PORT') ? C('REDIS_PORT') : 6379,
'timeout' => C('DATA_CACHE_TIMEOUT') ? C('DATA_CACHE_TIMEOUT') : false,
'persistent' => false,
);
}
$this->options = $options;
$this->options['expire'] = isset($options['expire']) ? $options['expire'] : C('DATA_CACHE_TIME');
$this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : C('DATA_CACHE_PREFIX');
$this->options['length'] = isset($options['length']) ? $options['length'] : 0;
$this->options['dbindex'] = isset($options['dbindex']) ? $options['dbindex'] : 0;
$func = $options['persistent'] ? 'pconnect' : 'connect';
$this->handler = new \Redis;
$options['timeout'] === false ?
$this->handler->$func($options['host'], $options['port']) :
$this->handler->$func($options['host'], $options['port'], $options['timeout']);
$this->handler->select($this->options['dbindex']);
}

/**
* redis连接
* @access private
* @return resource
* @author bieanju
*/
public function connectRedis() {
header('Content-Type:application/json; charset=utf-8');
$config = [
'host' => '127.0.0.1',
'port' => 6379,
];
$redis = new \Redis();
$redis->connect($config['host'], $config['port']);
$redis->select(0);
return $redis;
}
/**
* 红包列表
*/
public function mine_sweeps(){
$p = I('get.p',1);
$user_id = $_SESSION['user']['uid'];
$count = M('hongbao')->alias('H')
->join('join hb_user as U on H.uid=U.id')
->order('H.addtime desc')
->field('H.*, U.headimg')
->count();
$Page = new \Think\HPage($count,4);// 实例化分页类 传入总记录数和每页显示的记录数
$show = $Page->show();// 分页显示输出
$list['hongbao'] = M('hongbao')->alias('H')
->join('join hb_user as U on H.uid=U.id')
->order('H.addtime desc')
->field('H.*, U.headimg, U.name')
->limit($Page->firstRow.','.$Page->listRows)
->select();
foreach($list['hongbao'] as &$v){
$is_grab = M('record')->where(['uid' => ['eq', $user_id], 'h_id' => ['eq', $v['id']]])->getField('id');
$v['headimg'] = $v['headimg']?$v['headimg']:C('HEAD_IMG');
$v['sy_num'] = $v['num']-$v['lq_num'];
$v['is_red'] = !empty($is_grab)?2:1;
$v['is_user'] = $v['uid']==$user_id?1:2;
}
$list['user'] = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->field('headimg, name, total_money')->find();
$list['user']['headimg'] = $list['user']['headimg']?$list['user']['headimg']:C('HEAD_IMG');
$this->assign('list', $list);
$this->assign('page', $show);
$this->assign('p', $p);
$this->display();
}

/**
* 红包列表页显示
*/
public function mine_sweep(){
$p = I('get.p',1);
$this->assign('p', $p);
$this->display();
}

/**
* 红包列表api
*/
public function mine_sweep_api(){
try{
$p = I('get.p',1);
$user_id = $_SESSION['user']['uid'];
$sign_time = M('user')->where(['id' =>$user_id, 'status' => 1])->getField('sign_time');

$count = M('hongbao')->alias('H')
->join('join hb_user as U on H.uid=U.id')
->order('H.addtime desc')
->where(['H.addtime' => ['between' ,array($sign_time,time())]])
->field('H.*, U.headimg')
->count();
$Page = new \Think\HPage($count,4);// 实例化分页类 传入总记录数和每页显示的记录数
$show = $Page->show();// 分页显示输出
$list['hongbao'] = M('hongbao')->alias('H')
->join('join hb_user as U on H.uid=U.id')
->order('H.addtime desc')
->field('H.*, U.headimg, U.name')
->where(['H.addtime' => ['between' ,array($sign_time,time())]])
->limit($Page->firstRow.','.$Page->listRows)
->select();
foreach($list['hongbao'] as &$v){
$is_grab = M('record')->where(['uid' => ['eq', $user_id], 'h_id' => ['eq', $v['id']]])->getField('id');
$v['headimg'] = $v['headimg']?$v['headimg']:C('HEAD_IMG');
$v['sy_num'] = $v['num']-$v['lq_num'];
$v['is_red'] = !empty($is_grab)?2:1;
$v['is_user'] = $v['uid']==$user_id?1:2;
}
$list['user'] = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->field('id,headimg, name, total_money')->find();
$list['user']['headimg'] = $list['user']['headimg']?$list['user']['headimg']:C('HEAD_IMG');
$show=str_replace("mine_sweep_api","mine_sweep",$show);
$list['page'] = $show;
$list['p'] = $p;
$this->doResponse(ApiResponse::SUCCESS, 'SUCCESS', $list);
} catch (Exception $e) {
$this->doResponse($e->getCode() ?: ApiResponse::SERVICE_ERROR, $e->getMessage());
}
}
/**
* 抢包详情列表
*/
public function detail(){
header('Content-Type:application/json; charset=utf-8');
$hongbao_id = I('id');
$user_id = $_SESSION['user']['uid'];
$list['info'] = M('record')->alias('R')
->join('join hb_user as U on U.id=R.uid')
->where(['R.h_id' => ['eq', $hongbao_id]])
->field('U.headimg ,U.name ,U.id as user_id,R.*')
->select();
$list['user'] = M('hongbao')->alias('H')
->join('join hb_user as U on H.uid=U.id')
->where(['H.id' => ['eq', $hongbao_id]])
->field('U.name, U.headimg, H.money,H.num')
->find();
$list['user'] = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->field('name,headimg')->find();
$hongbao = M('hongbao')->where(['id' => ['eq', $hongbao_id]])->field('money,num')->find();
$list['user']['headimg'] = $list['user']['headimg']?$list['user']['headimg']:C('HEAD_IMG');
$list['user']['total_moneys'] = $hongbao['money'];
$list['user']['num'] = $hongbao['num'];
foreach($list['info'] as &$vo){
$vo['headimg'] = $vo['headimg']?$vo['headimg']:C('HEAD_IMG');
$vo['name'] = $vo['name']?$vo['name']:'无';
if($vo['user_id'] == $user_id){
$list['user']['money'] = $vo['money'];
}
}
// print_r($list);exit;
$this->assign('list', $list);
$this->display();
}
/**
* 发包显示
*/
public function send(){
$user_id = $_SESSION['user']['uid'];
$pack = M('pack')->order('num asc')->select();
$choice_money = M('choice_money')->where(['type' => ['eq', 3]])->order('money asc')->select();
$user = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->field('name,total_money,headimg')->find();
$user['headimg'] = $user['headimg']?$user['headimg']:C('HEAD_IMG');
$this->assign('pack', $pack);
$this->assign('user', $user);
$this->assign('choice_money', $choice_money);
$this->display();
}
/*
* 用户发红包
*/
public function before_detail(){
// $_SESSION['user']['id'] = 1;//发包人id
$min = 0.01;
$pack_id = I('post.bao_id');
$zid = I('post.zid');//自定义金额
$money = I('post.money');//选择金额
$lucky = I('post.lucky');//雷号 10-0
$pack = M('pack')->where(['id' => $pack_id])->find();
$num = $pack['num'];//包数
$multiple = $pack['multiple'];//倍数
$money = !empty($zid)?$zid:$money;
if (empty($pack_id)) {
$return['status'] = 0;
$return['msg'] = "请选择包数!";
$this->ajaxReturn($return);
}
if (empty($lucky)) {
$return['status'] = 0;
$return['msg'] = "请选择雷号!";
$this->ajaxReturn($return);
}
if(!preg_match('/^[0-9]+\.{0,1}[0-9]{0,2}$/',$money) || empty($money)){
$return['status'] = 0;
$return['msg'] = "请输入正确的充值金额!";
$this->ajaxReturn($return);
}
if (!preg_match("/^[0-9]{1,}$/", $num)) {
$return['status'] = 0;
$return['msg'] = "红包数量请输入整数!";
$this->ajaxReturn($return);
}
if ($num * $min > $money) {
$return['status'] = 0;
$return['msg'] = "真抠";
$this->ajaxReturn($return);
}
$user_money = M('user')->where(['id' => ['eq', $_SESSION['user']['uid']], 'status' => ['eq', 1]])->getField('total_money');
if ($user_money < $money) {
$return['status'] = 0;
$return['msg'] = "您的余额不足,请充值!";
$this->ajaxReturn($return);
}
$lucky = $lucky==10?0:$lucky;

/*添加发包记录*/
$data = [
'uid' => $_SESSION['user']['uid'],
'money' => $money,
'num' => $num,
'lucky' => $lucky,//雷号
'multiple' => $multiple,//倍数
'addtime' => time(),
'over_time' => time()+180,
];
$hongbao_redpacket = M('hongbao');
M('hongbao')->startTrans();
$hongbao_id = $hongbao_redpacket->add($data);
/*添加发包余额变动记录*/
$data_profit = [
'uid' => $_SESSION['user']['uid'],
'money' => $user_money-$money,
'change' => $money,
'type' => 4,
'addtime' => time(),
];
$add_profit = M('profit')->add($data_profit);
$save_money = M('user')->where(['id' => ['eq', $_SESSION['user']['uid']], 'status' => ['eq', 1]])->setDec('total_money', $money);
if (empty($hongbao_id) || !$save_money || empty($add_profit)) {
$hongbao_redpacket->roolback();
$return['status']=0;
$return['msg']="发包失败";
$this->ajaxReturn($return);
}
$this->hongbao_key = 'hongbao:' . $hongbao_id;
$redis = $this->connectRedis();
$gnRedis = $redis->llen("{$this->hongbao_key}");
/* 判断第一个红包不为雷 */
for ($x = 0; $x <= 100; $x++) {
$redpacket_money = $this->rand_section($min, $money, $num, $money);
if (mb_substr($redpacket_money[0], -1, 1) != $lucky) {
break;
}
}
/*redis添加红包金额*/
if (!$gnRedis) {
for ($i = 0; $i < $num; $i ++) {
$redis->lpush("{$this->hongbao_key}", $redpacket_money[$i]);
}
}

$resetRedis = $redis->llen("{$this->hongbao_key}");
if (!$resetRedis) {
$hongbao_redpacket->roolback();
$return['status'] = 0;
$return['msg'] = "发包失败";
$this->ajaxReturn($return);
}
$hongbao_redpacket->commit();
$return['status']=200;
$return['msg']="发包成功";
$this->ajaxReturn($return);
}

/*
* 红包id、用户id
*/
public function grab_number_queue(){
$hongbao_id = I('id');//红包id
$user_id = $_SESSION['user']['uid'];
$this->user_key = 'user:'.$hongbao_id;
$this->hongbao_key = 'hongbao:'.$hongbao_id;
/* redis 队列 */
$redis = $this->connectRedis();
/* 进入队列 */
$hongbao_num = $redis->llen("{$this->hongbao_key}");
$user_num = $redis->hGet("{$this->user_key}",$user_id);
// 判断用户是否已在队列
if ($user_num) {
$return['status'] = 200;
$return['msg'] = "您已抢过红包";
$this->ajaxReturn($return);
}
$find_redpacket = M('hongbao')->where(['id' => $hongbao_id])->field('uid, money, status, lucky, multiple,over_time,lq_money,lq_num')->find();
$user_money = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->getField('total_money');
$peifu = $find_redpacket['money']*$find_redpacket['multiple'];
if (!$hongbao_num || $find_redpacket['status'] == 2) {
$return['status'] = 0;
$return['msg'] = "手慢了,红包已派完";
$this->ajaxReturn($return);
}
/*判断过期红包*/
if($find_redpacket['over_time']<time()){
$return['status'] = 0;
$return['msg'] = "红包已过期!";
$this->ajaxReturn($return);
}
/* 判断用户余额是否大于赔付金额 */
if ($user_money < $peifu) {
$return['status'] = 0;
$return['msg'] = "您的余额低于赔付金额,请充值!";
$this->ajaxReturn($return);
}
$goods_number_key = $redis->lpop("{$this->hongbao_key}");
if ($goods_number_key) {
// 插入抢购用户信息
$userinfo = array(
"user_id" => $user_id,
"create_time" => time()
);
$Modelr = M('record');
$Modelr->startTrans();
$redis->hSet("{$this->user_key}", $user_id, serialize($userinfo));
/*判断用户是否中雷*/
if (mb_substr($goods_number_key, -1, 1) == $find_redpacket['lucky']) {
$is_type = 2;
$save_user_money = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->setDec('total_money', $peifu);
$hongbao_money = M('user')->where(['id' => ['eq', $find_redpacket['uid']], 'status' => ['eq', 1]])->getField('total_money');//查询放在下面防止抢包与发包人同一个
$save_hongbao_money = M('user')->where(['id' => ['eq', $find_redpacket['uid']], 'status' => ['eq', 1]])->setInc('total_money', $peifu);
$ray = [[
'uid' => $user_id,
'money' => $user_money-$peifu,
'change' => $peifu,
'type' => 6,//用户踩雷减余额
'addtime' => time(),
],[
'uid' => $find_redpacket['uid'],
'money' => $hongbao_money+$peifu,
'change' => $peifu,
'type' => 8,//用户踩雷发包者加余额
'addtime' => time(),
]];
$addAll_money = M('profit')->addAll($ray);
if (empty($save_user_money) || empty($save_hongbao_money) || empty($addAll_money)) {
$Modelr->rollback();
$return['status'] = 0;
$return['msg'] = "抢包失败!";
$this->ajaxReturn($return);
}
$user_money = $user_money-$peifu;
} else {
$is_type = 1;
}
/*用户抢包添加金额*/
$add_money = M('user')->where(['id' => ['eq', $user_id], 'status' => ['eq', 1]])->setInc('total_money', $goods_number_key);
$lq_hongbao = M('hongbao')->where(['id' => ['eq', $hongbao_id]])->save(['lq_money' => $find_redpacket['lq_money']+$goods_number_key,'lq_num' => $find_redpacket['lq_num']+1]);
// 插入用户抢包记录
$redpack_log = [
'uid' => $user_id,
'money' => $goods_number_key,
'h_id' => $hongbao_id,
'lucky'=> $find_redpacket['lucky'],
'type' => $is_type,
'addtime' => time(),
];
$redpacket_user = M('record')->add($redpack_log);
/*添加用户抢包余额变动记录*/
$data_profit = [
'uid' => $user_id,
'money' => $user_money+$goods_number_key,
'change' => $goods_number_key,
'type' => 5,
'addtime' => time(),
];
$add_profit = M('profit')->add($data_profit);
if (empty($add_money) || empty($redpacket_user) || empty($add_profit) || empty($lq_hongbao)) {
$Modelr->rollback();
$return['status'] = 0;
$return['msg'] = "抢包失败!";
$this->ajaxReturn($return);
}
$hongbao_num = $redis->llen("{$this->hongbao_key}");
if (!$hongbao_num) {
$save_redpacket = M('hongbao')->where(['id' => $hongbao_id])->save(['status' => 2]);
if (empty($save_redpacket)) {
$Modelr->rollback();
$return['status'] = 0;
$return['msg'] = "抢包失败!";
$this->ajaxReturn($return);
}
$redisDel=$redis->del("{$this->user_key}");
}
$Modelr->commit();
$return['status'] = 200;
$return['msg'] = '红包金额' . $goods_number_key;
$this->ajaxReturn($return);
} else {
$return['status'] = 0;
$return['msg'] = "系统繁忙";
$this->ajaxReturn($return);
}
}

/** 获取区间内随机红包(符合正态分布)
* @param $min 红包最小值
* @param $max 红包最大值
* @param $num 红包个数
* @param $total 红包金额
* @return array
*/
public function rand_section ($min,$max,$num,$total){

$data = array();
if ($min * $num > $total) {
return array();
}
if($max*$num < $total){
return array();
}
while ($num >= 1) {
$num--;
$kmix = max($min, $total - $num * $max);
$kmax = min($max, $total - $num * $min);
$kAvg = $total / ($num + 1);
//获取最大值和最小值的距离之间的最小值
$kDis = min($kAvg - $kmix, $kmax - $kAvg);
//获取0到1之间的随机数与距离最小值相乘得出浮动区间,这使得浮动区间不会超出范围
$r = ((float)(rand(1, 10000) / 10000) - 0.5) * $kDis * 2;
$k = sprintf("%.2f", $kAvg + $r);
$total -= $k;
$data[] = $k;
}
return $data;
}



/*
* redis调试
*/
public function order_num(){
$redis=$this->connectRedis();
// $redis->flushall();//清空redis所有缓存数据
$a = $redis->keys('*');
print_r($a);
}

}

转载于:https://www.cnblogs.com/zhang-bin/p/10137506.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388856.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python中ix用法_Python中使用ix的数据帧子集

您可以使用X[var2].iloc[[0,1]]&#xff1a;In [280]: X[var2].iloc[[0,1]]Out[280]:0 NaN4 9Name: var2, dtype: float64由于X[var2]是X的视图&#xff0c;因此X[var2].iloc[[0,1]]对两者都是安全的访问和分配。但是如果你使用这种“链式索引”要小心模式(例如这里使用的index…

LintCode 16. 带重复元素的排列

写在前面&#xff1a;这题和全排列不含重复元素的那题几乎一样&#xff0c;我比较垃圾&#xff0c;就用HashSet去掉了重复的元素但是看了九章算法的答案也没看懂&#xff0c;他写的很有感觉。 用了hash&#xff0c;本来想着怎么写hashcode()和equal()方法的&#xff0c;哪知道都…

皮尔逊相关系数 相似系数_皮尔逊相关系数

皮尔逊相关系数 相似系数数据科学和机器学习统计 (STATISTICS FOR DATA SCIENCE AND MACHINE LEARNING) In the last post, we analyzed the relationship between categorical variables and categorical and continuous variables. In this case, we will analyze the relati…

【洛谷】P1641 [SCOI2010]生成字符串(思维+组合+逆元)

题目 传送门&#xff1a;QWQ 分析 不想画图。 https://www.luogu.org/problemnew/solution/P1641 好神仙的题啊。 代码 1 // luogu-judger-enable-o22 #include <bits/stdc.h>3 using namespace std;4 typedef long long ll;5 const int maxn15000000;6 const ll MOD2010…

Kubernetes持续交付-Jenkins X的Helm部署

Jenkins X 是一个集成化的 CI / CD 平台&#xff0c;可用于 部署在Kubernetes集群或云计算中心。支持在云计算环境下简单地开发和部署应用。本项目是在Kubernetes上的安装支持工具集。 本工具集中包含&#xff1a; Jenkins - 定制好的流水线和运行环境&#xff0c;完全整合CI/C…

中国石油大学(华东)暑期集训--二进制(BZOJ5294)【线段树】

问题 C: 二进制 时间限制: 1 Sec 内存限制: 128 MB提交: 8 解决: 2[提交] [状态] [讨论版] [命题人:]题目描述 pupil发现对于一个十进制数&#xff0c;无论怎么将其的数字重新排列&#xff0c;均不影响其是不是3的倍数。他想研究对于二进制&#xff0c;是否也有类似的性质。于…

2018年10个最佳项目管理工具及链接

要在任何业务中取得成功&#xff0c;对项目进行适当的管理非常重要。 项目管理是一系列活动&#xff0c;包括计划&#xff0c;执行&#xff0c;控制和完成项目。项目管理工具有助于简化此过程。这里是Best 10项目管理工具及其功能和下载链接的精选列表。1&#xff09;AsanaAsan…

Java 8 新特性之Stream API

1. 概述 1.1 简介 Java 8 中有两大最为重要的改革&#xff0c;第一个是 Lambda 表达式&#xff0c;另外一个则是 Stream API&#xff08;java.util.stream.*&#xff09;。 Stream 是 Java 8 中处理集合的关键抽象概念&#xff0c;它可以指定你希望对集合进行的操作&#xff0c…

[Python设计模式] 第17章 程序中的翻译官——适配器模式

github地址:https://github.com/cheesezh/python_design_patterns 适配器模式 适配器模式&#xff0c;将一个类的接口转换成客户希望的另外一个接口。Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作[DP]。 当系统的数据和行为都正确&#xff0c;但是接口…

Ubuntu中NS2安装详细教程

前言&#xff1a; NS2是指 Network Simulator version 2&#xff0c;NS&#xff08;Network Simulator&#xff09; 是一种针对网络技术的源代码公开的、免费的软件模拟平台&#xff0c;研究人员使用它可以很容易的进行网络技术的开发&#xff0c;而且发展到今天&#xff0c;它…

es6核心特性图

转载于:https://juejin.im/post/5c19e188e51d452db4753925

带你利用一句话完成转场动画

这篇文章主要给大家介绍了关于iOS如何利用一句话完成转场动画的相关资料&#xff0c;文中通过示例代码介绍的非常详细&#xff0c;对大家的学习或者工作具有一定的参考学习价值&#xff0c;需要的朋友们下面来一起学习学习吧前言本文介绍SS_AnimationTransition 的使用方法,利用…

14.vue路由脚手架

一.vue路由&#xff1a;https://router.vuejs.org/zh/ 1、定义 let router new VueRouter({mode:"history/hash",base:"基本路径" 加一些前缀 必须在history模式下有效linkActiveClass:"active", 范围选择linkExactActiveClass:"exact&qu…

工程师、产品经理、数据工程师是如何一起工作的?

做为一名工程师&#xff0c;免不了与产品经理打交道&#xff0c;如果公司大一些&#xff0c;数据量多一些&#xff0c;还会有数据工程师这个角色。今天会和你主要聊一聊在工作中&#xff0c;产品经理和数据工程师在哪些方面对我们工程师的帮助最大&#xff0c;以及我从他们身上…

linux-buff/cache过大导致内存不足-程序异常

2019独角兽企业重金招聘Python工程师标准>>> 问题描述 Linux内存使用量超过阈值&#xff0c;使得Java应用程序无可用内存&#xff0c;最终导致程序崩溃。即使在程序没有挂掉时把程序停掉&#xff0c;系统内存也不会被释放。 找原因的过程 这个问题已经困扰我好几个月…

Android 适配(一)

一、Android适配基础参数1.常见分辨率&#xff08;px&#xff09;oppx 2340x1080oppR15 2280x1080oppor11sp 2160*10801080*1920 (主流屏幕16&#xff1a;9)1080*216018:9 手机主流分辨率&#xff1a; 1080*2160高端 16:9 手机主流分辨率&#xff1a; 1080P (1080*1920) 或 2K …

Source Insight 创建工程(linux-2.6.22.6内核源码)

1. 软件设置 安装完Source Insight&#xff0c;需要对其进行设置添加对“.S”汇编文件的支持&#xff1a; 2. 新建linux-2.6.22.6工程 1&#xff09;选择工程存放的路径&#xff1a; 2&#xff09;下载linux-2.6.22.6内核源码&#xff0c;并解压。在Source Insight中 指定源码的…

课时20:内嵌函数和闭包

目录&#xff1a; 一、global关键字 二、内嵌函数 三、闭包 四、课时20课后习题及答案 ******************** 一、global关键字 ******************** 全局变量的作用域是整个模块&#xff08;整个代码段&#xff09;&#xff0c;也就是代码段内所有的函数内部都可以访问到全局…

从零开始学产品第六篇:更强大的测试,自动化测试和性能测试

本篇为【从零开始学产品】系列课第1章第5节欢迎到公众号菜单栏&#xff0c;获取产品经理课程更多资料 “测试就是拿点鼠标在电脑上瞎点&#xff0c;或者是用手机随便戳几下么&#xff1f;” “不&#xff0c;是有计划有意图的测试&#xff0c;比如说&#xff0c;边界测试&#…

Get 了滤镜、动画、AR 特效,速来炫出你的短视频开发特技!

在滤镜美颜、搞怪特效、炫酷场景等各种新奇玩法驱动下&#xff0c;短视频开始让人上瘾。 12 月 3 日&#xff0c;七牛云联合八大短视频特效平台共同推出了中国短视频开发者创意大赛&#xff08;China Short Video Contest&#xff09;&#xff0c;面向全国邀请广大开发者&#…