['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; 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 * @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; } }