|
@@ -9,10 +9,7 @@ use think\Cache;
|
|
|
|
|
|
class Plantask extends Controller
|
|
|
{
|
|
|
- /**
|
|
|
- * 精秀支付订单支付状态查询
|
|
|
- * @return string|void
|
|
|
- */
|
|
|
+ //精秀支付订单支付状态查询。 一分钟一次
|
|
|
public function auto_pay_queue()
|
|
|
{
|
|
|
// 处理次数
|
|
@@ -95,7 +92,7 @@ class Plantask extends Controller
|
|
|
}
|
|
|
|
|
|
|
|
|
- //定时跑用户活跃,改成离线
|
|
|
+ //定时跑用户活跃,改成离线。 一分钟一次
|
|
|
public function auto_user_active(){
|
|
|
$actitime = time() - 7200;
|
|
|
|
|
@@ -103,122 +100,6 @@ class Plantask extends Controller
|
|
|
db()->query($sql);
|
|
|
}
|
|
|
|
|
|
- //计划任务
|
|
|
- //代替公会的人10秒内发出五句话
|
|
|
- public function firstuser_send()
|
|
|
- {
|
|
|
- exit;
|
|
|
- //找出24小时内注册的男人
|
|
|
- $map = [
|
|
|
- 'jointime' => ['gt',time()-86400],
|
|
|
- 'gender' => 1,
|
|
|
- 'gh_id' => 0,
|
|
|
- 'auto_first_word' => 0,
|
|
|
- ];
|
|
|
- $oneuser = Db::name('user')->where($map)->order('id asc')->value('id');
|
|
|
- dump($oneuser);
|
|
|
- if(!$oneuser){
|
|
|
- echo 'empty';
|
|
|
- exit;
|
|
|
- }
|
|
|
-
|
|
|
- //找出公会的人
|
|
|
- $map = [
|
|
|
- 'gh_id' => ['gt',0],
|
|
|
- 'gender' => 0,
|
|
|
- ];
|
|
|
- $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(5)->column('id');
|
|
|
- //dump($ghuser);
|
|
|
-
|
|
|
- //随机取出一句话
|
|
|
- $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(5)->column('title');
|
|
|
- //dump($oneword);
|
|
|
-
|
|
|
- //发送出去
|
|
|
- $tenim = new \app\common\library\Tenim;
|
|
|
- for($i = 0;$i < 5;$i++){
|
|
|
- $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
|
|
|
- $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
|
|
|
- $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
|
|
|
- sleep(2);
|
|
|
- }
|
|
|
- Db::name('user')->where('id',$oneuser)->update(['auto_first_word'=>1]);
|
|
|
-
|
|
|
- }
|
|
|
- //计划任务,二期之后,废弃
|
|
|
- //代替公会的人发出第一句话
|
|
|
- public function firstword_send()
|
|
|
- {
|
|
|
- exit;
|
|
|
- //找出24小时内注册的男人
|
|
|
- $map = [
|
|
|
- 'jointime' => ['gt',time()-86400],
|
|
|
- 'gender' => 1,
|
|
|
- 'gh_id' => 0,
|
|
|
- ];
|
|
|
- $oneuser = Db::name('user')->where($map)->orderRaw('rand()')->value('id');
|
|
|
- //dump($oneuser);
|
|
|
-
|
|
|
- //找出公会的人
|
|
|
- $map = [
|
|
|
- 'gh_id' => ['gt',0],
|
|
|
- 'gender' => 0,
|
|
|
- ];
|
|
|
- $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->value('id');
|
|
|
- //dump($ghuser);
|
|
|
-
|
|
|
- //随机取出一句话
|
|
|
- $oneword = Db::name('plantask_accost')->orderRaw('rand()')->value('title');
|
|
|
- //dump($oneword);
|
|
|
-
|
|
|
- //发送出去
|
|
|
- $cache = Cache::connect(['type'=>'Redis']);
|
|
|
- $times = $cache->get('plantask_first_word_'.$oneuser);
|
|
|
- //dump($times);
|
|
|
-
|
|
|
- if($times === false){
|
|
|
- $times = 0;
|
|
|
- }
|
|
|
- if($times < 5){
|
|
|
- $tenim = new \app\common\library\Tenim;
|
|
|
- $tenim->sendMessageToUser($ghuser,$oneuser,$oneword);
|
|
|
- $cache->set('plantask_first_word_'.$oneuser, $times + 1);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //计划任务
|
|
|
- //清空没用的redis
|
|
|
- public function firstword_clear(){
|
|
|
- $map = [
|
|
|
- 'jointime' => ['between',[time()-172800,time()-86400]],
|
|
|
- 'gender' => 1,
|
|
|
- 'gh_id' => 0,
|
|
|
- ];
|
|
|
- $map = [];
|
|
|
-
|
|
|
- $userlist = Db::name('user')->where($map)->order('id asc')->column('id');
|
|
|
-
|
|
|
- if(empty($userlist)){
|
|
|
- echo 'empty';
|
|
|
- exit;
|
|
|
- }
|
|
|
-
|
|
|
- //清除
|
|
|
- $cache = Cache::connect(['type'=>'Redis']);
|
|
|
- foreach($userlist as $key => $val){
|
|
|
- $cache->rm('plantask_first_word_'.$val);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //测试用
|
|
|
- //清空redis
|
|
|
- public function clear_redis(){
|
|
|
- $val = input('uid');
|
|
|
- $cache = Cache::connect(['type'=>'Redis']);
|
|
|
- $cache->rm('plantask_first_word_'.$val);
|
|
|
- }
|
|
|
-
|
|
|
//发放代理奖励
|
|
|
public function issuingreward() {
|
|
|
set_time_limit(0);
|
|
@@ -290,72 +171,10 @@ class Plantask extends Controller
|
|
|
die;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 超过24小时未上传头像的女用户隐身
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function userHide()
|
|
|
- {
|
|
|
- //找出24小时内注册未上传头像的女用户
|
|
|
- $userHideTime = config('site.user_hide_time');
|
|
|
-
|
|
|
- $start_time = time() - (3600 * 27);
|
|
|
- $end_time = time() - ($userHideTime * 60);
|
|
|
-
|
|
|
- $girlAvatar = config('avatar_girl');
|
|
|
- $where = [
|
|
|
- 'gender' => 0,
|
|
|
- 'avatar' => $girlAvatar,
|
|
|
- 'status' => 1,
|
|
|
- ];
|
|
|
-
|
|
|
- $user = Db::name('user')->field('id')->whereBetween('jointime',[$start_time,$end_time])->where($where)->order('id asc')->select();
|
|
|
- if(empty($user)){
|
|
|
- echo 'empty';
|
|
|
- exit;
|
|
|
- }
|
|
|
- $userIds = array_column($user,'id');
|
|
|
- $updateWhere['id'] = ['in',$userIds];
|
|
|
- $countRes = Db::name('user')->where($updateWhere)->update(['status'=>2]);//隐藏
|
|
|
- echo 'update '.$countRes;
|
|
|
- exit;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 五分钟禁用女用户账号
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function userClose()
|
|
|
- {
|
|
|
- $start_time = time() - (3600 * 27);
|
|
|
- $end_time = time() - (5 * 60);
|
|
|
|
|
|
- $where = [
|
|
|
- 'gender' => 0,
|
|
|
- 'is_closed' => 0,
|
|
|
- 'status' => 1,
|
|
|
- ];
|
|
|
-
|
|
|
- $user = Db::name('user')->field('id')->whereBetween('jointime',[$start_time,$end_time])->where($where)->order('id asc')->select();
|
|
|
- if(empty($user)){
|
|
|
- echo 'empty';
|
|
|
- exit;
|
|
|
- }
|
|
|
- $userIds = array_column($user,'id');
|
|
|
- $updateWhere['id'] = ['in',$userIds];
|
|
|
- $updateWhere2['user_id'] = ['in',$userIds];
|
|
|
- $countRes = Db::name('user')->where($updateWhere)->update(['status'=>0,'is_closed'=>1]);//金庸
|
|
|
- $countRes2 = Db::name('user_token')->where($updateWhere2)->delete();//金庸
|
|
|
- echo 'update '.$countRes;
|
|
|
- echo 'delete '.$countRes2;
|
|
|
- exit;
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 自动推荐
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function userRecommend()
|
|
|
+ //自动推荐。 一分钟一次
|
|
|
+ public function auto_userRecommend()
|
|
|
{
|
|
|
$payMoney = config('site.recommend_pay_money');//财富值
|
|
|
$getMoney = config('site.recommend_get_money');//魅力值
|
|
@@ -363,6 +182,7 @@ class Plantask extends Controller
|
|
|
echo 'empty';exit;
|
|
|
}
|
|
|
$where = 'u.is_recommend = 0 ';
|
|
|
+ $whereAppend = '';
|
|
|
if ($payMoney > 0) {
|
|
|
$whereAppend = $where.' and uw.pay_money >= '.$payMoney;
|
|
|
}
|