['except'=>'']// 访问这些except下的方法不需要执行前置操作 ]; /** * index * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @author 倪苍华 * Date 2019/9/10 10:37 */ public function index() { $userId = get_my_id(); $User = UT::realGetMyChildren($userId, [$userId]); return $User; } public function stats() { $userId = get_my_id(); $goodsType = 3; $sm = Model('common/SysSummary'); $sysData= $sm->getInfo('toPaySlow'); $helpSaleInfo = Db::name('orders')->where(compact('userId','goodsType'))->where('payable', '>',0)->sum('payable'); $helpSaleNum = 0; if (!empty($helpSaleInfo)) { $helpSaleNum = $helpSaleInfo['helpSaleNum']; } $zgTimes = Db::name('orders')->where(compact('userId','goodsType'))->count(); if ($zgTimes <= 0) $zgTimes = 1; if ($helpSaleNum <= 0) $helpSaleNum = 1; return [ 'zgTimes'=>$zgTimes, 'myZgA'=>$helpSaleNum, 'zgAmounts'=>$sysData['toPaySlow'], ]; } public function stats2() { $userId = get_my_id(); $goodsType = 3; return [ 'zgAmounts'=>Db::name('orders')->where(compact('userId','goodsType'))->sum('helpGetCount'), ]; } /** * TreeList * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @author 倪苍华 * Date 2019/9/10 11:18 */ public function TreeList() { $userId = get_my_id(); $treeArr = []; $goodsType = 3; $max = Db::name('orders')->where(compact('userId','goodsType'))->max('helpUserLevel'); $newLevel = 0; do { $newLevel++; $userId = UT::getUpperId($userId);// 找到我的层级 if ($userId == null) $userId = 1;// 上级uid if (UT::checkUserCanDisplay($userId)) {// 如果有,则使用上级信息 if($newLevel>10){ $treeArr[$newLevel]['level'] = "第".$newLevel."层"; }else{ $treeArr[$newLevel]['level'] = UT::$level[$newLevel]; } $treeArr[$newLevel]['level_id'] = $newLevel; $treeArr[$newLevel]['userId'] = $userId; $treeArr[$newLevel]['userName'] = ''; }else{$newLevel--;} } while (($newLevel <= $max) && ($newLevel <= (int)dataConf("helpSaleMaxLevel"))); // pd($treeArr); return $treeArr; } }