Commit b0735e6e authored by houyadong's avatar houyadong

成员交易逻辑修改-bug

parent dee9c13f
...@@ -235,7 +235,7 @@ class UserModel extends Model ...@@ -235,7 +235,7 @@ class UserModel extends Model
->where($entrust_where) ->where($entrust_where)
->where(['userid'=>['in',array_keys($top3_uids)]]) ->where(['userid'=>['in',array_keys($top3_uids)]])
->group('userid') ->group('userid')
->order('FIELD(userid,"'.implode('","',array_keys($top3_uids)).'")') ->order('FIELD(userid,"'.implode('","',array_keys($top3_uids)).'") asc,cj_time desc')
->select(); ->select();
if(empty($top3_data)){ if(empty($top3_data)){
$top3_data = $model->table($his_table_name) $top3_data = $model->table($his_table_name)
...@@ -243,9 +243,17 @@ class UserModel extends Model ...@@ -243,9 +243,17 @@ class UserModel extends Model
->where($entrust_where) ->where($entrust_where)
->where(['userid'=>['in',array_keys($top3_uids)],'cj_time'=>['gt',strtotime('today')]]) ->where(['userid'=>['in',array_keys($top3_uids)],'cj_time'=>['gt',strtotime('today')]])
->group('userid') ->group('userid')
->order('FIELD(userid,"'.implode('","',array_keys($top3_uids)).'")') ->order('FIELD(userid,"'.implode('","',array_keys($top3_uids)).'") asc,cj_time desc')
->select(); ->select();
} }
$tmp = [];
foreach ($top3_data as $k=>$v){
if($tmp[$v['userid']]){
unset($top3_data[$k]);
}else{
$tmp[$v['userid']] = 1;
}
}
$top3_ids = array_column($top3_data,'id'); $top3_ids = array_column($top3_data,'id');
if(!empty($top3_ids)){ if(!empty($top3_ids)){
$entrust_where['id'] = ['not in',$top3_ids]; $entrust_where['id'] = ['not in',$top3_ids];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment