user; if (empty($user)) return errorTrans("empty.data"); $platform = $this->checkPlatform($user['openid']); $member = $this->model->where("openid",$user['openid'])->field("openid,headimg,nickname") ->append(["withdraw",'day','mon','bonus','task','sign','level','dy_level','platform']) ->withAttr(['withdraw' => function(){ return 0; // 可提现金额 },'day' => function(){ return 0; // 今日佣金 },'mon' => function(){ return 0; // 本月佣金 },'bonus' => function(){ return 0; // 已获得奖金 },'task' => function(){ return 0; // 已接任务 },'sign' => function(){ return 0; // 0未签约,1已签约 },'level' => function(){ return 0; // 平台等级 },'dy_level' => function(){ return 0; // 抖音等级 },'platform' => function() use($platform) { return $platform; } ]) ->findOrEmpty(); return success("ok",$member->toArray()); } catch (\Throwable $th) { return error($th->getMessage()); } } /** * 绑定平台信息 * @param string $openId * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ protected function checkPlatform(string $openId = ""): array { $category = (new BlueCategory)->where("status",1)->where("type",1)->field("sign,name,icon")->select(); if ($category->isEmpty()) return []; $platform = []; $platformModel = new BlueExpertPlatform(); foreach ($category as $key=>$val) { $bind = $platformModel->where("source",$val['sign'])->where("openid",$openId)->findOrEmpty(); if ($bind->isEmpty()) { $bindState = 0; } else { $bindState = $bind['status'] + 1; } $platform[$val['sign']]['status'] = $bindState; } return $platform; } }