...
|
...
|
@@ -24,20 +24,45 @@ class TestController extends HomeBaseController |
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
|
public function test(){
|
|
|
$indent_data = Db::query("select id,uid,money,indent_id,count(indent_id) count from `cmf_money_income` group by indent_id having count(indent_id) >= 4 order by indent_id desc");
|
|
|
$a = [];
|
|
|
foreach ($indent_data as $v) {
|
|
|
if($v['count'] == 4) {
|
|
|
$data = Db::name('money_income')->where('money','>',0)->where('indent_id',$v['indent_id'])->find();
|
|
|
if($data) {
|
|
|
$data['nickname'] = Db::name('user')->where('id',$data['uid'])->value('user_nickname');
|
|
|
unset($data['id']);
|
|
|
$a[] = $data;
|
|
|
}
|
|
|
}
|
|
|
$uids = Db::name('indent_over')->group('uid')->column('uid');
|
|
|
$indent = Db::name('indent')->whereIn('salesman_uid',$uids)->select();
|
|
|
$insert = [];
|
|
|
foreach ($indent as $v) {
|
|
|
unset($v['id']);
|
|
|
$insert[] = $v;
|
|
|
}
|
|
|
Db::name('indent_over')->insertAll($a);
|
|
|
print_r($a);exit;
|
|
|
Db::name('indent_pro')->insertAll($insert);
|
|
|
// $all = Db::name('indent_over')->select();
|
|
|
// foreach ($all as $v) {
|
|
|
// $indent = Db::name('indent')->where('id',$v['indent_id'])->where('book_num',2)->count();
|
|
|
// if($indent) Db::name('indent_over')->where('id',$v['id'])->delete();
|
|
|
// $income = Db::name('money_income')->where('uid',$v['uid'])->where('indent_id',$v['indent_id'])->select();
|
|
|
// if(count($income) == 2) {
|
|
|
// $a = [];
|
|
|
// foreach ($income as $vv) {
|
|
|
// $a[] = $v['money'];
|
|
|
// }
|
|
|
// if($a[0] != $a[1]) {
|
|
|
// Db::name('indent_over')->where('id',$v['id'])->delete();
|
|
|
// }
|
|
|
// } else {
|
|
|
// Db::name('indent_over')->where('id',$v['id'])->delete();
|
|
|
// }
|
|
|
// }
|
|
|
// $indent_data = Db::query("select id,uid,money,indent_id,count(indent_id) count from `cmf_money_income` group by indent_id having count(indent_id) >= 4 order by indent_id desc");
|
|
|
// $a = [];
|
|
|
// foreach ($indent_data as $v) {
|
|
|
// if($v['count'] == 4) {
|
|
|
// $data = Db::name('money_income')->where('money','>',0)->where('indent_id',$v['indent_id'])->find();
|
|
|
// if($data) {
|
|
|
// $data['nickname'] = Db::name('user')->where('id',$data['uid'])->value('user_nickname');
|
|
|
// unset($data['id']);
|
|
|
// $a[] = $data;
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// Db::name('indent_over')->insertAll($a);
|
|
|
// print_r($a);exit;
|
|
|
// $data = Db::name('my_user')->where(['status'=>3,'inviter_phone'=>['neq','']])->select()->toArray();
|
|
|
// foreach($data as $key => $vo){
|
|
|
// $result = Db::name('my_user')->where(['phone'=>$vo['inviter_phone']])->value('id');
|
...
|
...
|
|