diff --git a/hyhproject/app/controller/UserLevel.php b/hyhproject/app/controller/UserLevel.php index e2436bf..8405cbe 100755 --- a/hyhproject/app/controller/UserLevel.php +++ b/hyhproject/app/controller/UserLevel.php @@ -35,6 +35,23 @@ class UserLevel extends Base return $User; } + public function stats() + { + $userId = get_my_id(); + $goodsType = 3; + return [ + 'zgTimes'=>Db::name('orders')->where(compact('userId','goodsType'))->count(), + 'zgAmounts'=>Db::name('orders')->where(compact('userId','goodsType'))->sum('helpGetCount'), + 'zgYhYhq'=>Db::name('log_moneys')->where([ + 'targetId'=>$userId, + 'remark'=>'预获产品券转换所得', + 'moneyType'=>'1', + ])->where('dataId', 'in', Db::name('orders') + ->where(compact('userId','goodsType'))->column('orderId') + )->where('dataId', '>', 0)->sum('money'), + ]; + } + /** * TreeList * @throws \think\db\exception\DataNotFoundException @@ -64,7 +81,6 @@ class UserLevel extends Base $treeArr[$newLevel]['userId'] = $userId; $treeArr[$newLevel]['userName'] = ''; }else{$newLevel--;} - if ($userId <= 1)break; } while (($newLevel <= $max) && ($newLevel <= (int)dataConf("helpSaleMaxLevel"))); // pd($treeArr); return $treeArr;