From 312790a63563dc93c24160e687a656f23aa0b549 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 15 Nov 2020 01:09:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A9=E8=B4=AD=E8=8E=B7=E5=BE=97=E7=9A=84?= =?UTF-8?q?=E9=82=A3=E4=BA=9B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/UserLevel.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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;