|
@@ -94,9 +94,9 @@ class Plantask extends Controller
|
|
//最新方法
|
|
//最新方法
|
|
public function auto_user_level_up_new(){
|
|
public function auto_user_level_up_new(){
|
|
|
|
|
|
- $tasklist = Db::name('gift_user_party')->where('task_status',0)->order('id asc')->field('party_id')->select();
|
|
|
|
|
|
+ $party_ids = Db::name('gift_user_party')->where('task_status',0)->order('id asc')->group('party_id')->column('party_id');
|
|
|
|
|
|
- if(empty($tasklist)){
|
|
|
|
|
|
+ if(empty($party_ids)){
|
|
echo 'empty';
|
|
echo 'empty';
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -112,11 +112,6 @@ class Plantask extends Controller
|
|
$redis->select($redisconfig['redis_selectdb']);
|
|
$redis->select($redisconfig['redis_selectdb']);
|
|
}
|
|
}
|
|
|
|
|
|
- //去重的party_id
|
|
|
|
- $party_ids = array_column($tasklist,'party_id');
|
|
|
|
- $party_ids = array_flip($party_ids);
|
|
|
|
- $party_ids = array_flip($party_ids);
|
|
|
|
- //dump($party_ids);
|
|
|
|
|
|
|
|
//更新任务状态
|
|
//更新任务状态
|
|
$rs_up = Db::name('gift_user_party')->where('task_status',0)->where('party_id','IN',$party_ids)->update(['task_status'=>1]);
|
|
$rs_up = Db::name('gift_user_party')->where('task_status',0)->where('party_id','IN',$party_ids)->update(['task_status'=>1]);
|
|
@@ -131,57 +126,7 @@ class Plantask extends Controller
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- public function auto_user_level_up(){
|
|
|
|
- Db::startTrans();
|
|
|
|
|
|
|
|
- $tasklist = Db::name('gift_user_party')->where('task_status',0)->order('id asc')->field('party_id')->select();
|
|
|
|
-
|
|
|
|
- if(empty($tasklist)){
|
|
|
|
- Db::rollback();
|
|
|
|
- echo 'empty';
|
|
|
|
- exit;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- //redis
|
|
|
|
- $redis = new Redis();
|
|
|
|
- $redisconfig = config("redis");
|
|
|
|
- $redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
|
- if ($redisconfig['redis_pwd']) {
|
|
|
|
- $redis->auth($redisconfig['redis_pwd']);
|
|
|
|
- }
|
|
|
|
- if($redisconfig['redis_selectdb'] > 0){
|
|
|
|
- $redis->select($redisconfig['redis_selectdb']);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //开始
|
|
|
|
- $party_ids = array_column($tasklist,'party_id');
|
|
|
|
- $party_ids = array_flip($party_ids);
|
|
|
|
- $party_ids = array_flip($party_ids);
|
|
|
|
- //dump($party_ids);
|
|
|
|
- $partyInfo_arr = Db::name('party')->where('id','IN',$party_ids)->column('id,user_id,easemob_room_id');
|
|
|
|
- //dump($partyInfo_arr);exit;
|
|
|
|
- foreach($partyInfo_arr as $party_id => $partyInfo){
|
|
|
|
- //更新麦位魅力值
|
|
|
|
- $this->updateSeatCharm($partyInfo['easemob_room_id'],$partyInfo,$redis);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //结束
|
|
|
|
- $rs_up = Db::name('gift_user_party')->where('party_id','IN',$party_ids)->update(['task_status'=>1]);
|
|
|
|
-
|
|
|
|
- Db::commit();
|
|
|
|
- } catch (ValidateException $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- } catch (PDOException $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
- Db::rollback();
|
|
|
|
- $this->error($e->getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
|
|
/////////////////////////////////////////下面都是工具方法////////////////////////////////////////////////
|
|
/////////////////////////////////////////下面都是工具方法////////////////////////////////////////////////
|
|
|
|
|