diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 5b772187..71572f14 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -14,6 +14,7 @@ namespace app\api\controller; use app\api\model\Agreement as AgreementModel; use app\api\model\User as UserModel; +use app\api\model\Invite\InviteLog; use app\store\model\User as StoreUserModel; use app\api\model\user\BalanceLog; use app\api\model\user\GoodSource as GoodsSourceModel; @@ -326,7 +327,46 @@ class User extends Controller // 用户列表 $model = new StoreUserModel; $list = $model->getList($this->request->param()); + if (!$list) { + return $this->renderSuccess(compact('list')); + } + $list = $list->toArray(); + // echo "
"; + // print_r($list); + // exit(); + foreach ($list['data'] as $key => &$value) { + $log = InviteLog::where('invitee_user_id', $value['user_id'])->find(); + $user = UserModel::where('user_id', $log['user_id'] ?? 0)->field('user_id,nick_name,mobile')->find(); + $value['inviter'] = $user; + } + return $this->renderSuccess(compact('list')); } + public function updateUser(): Json + { + $params = $this->request->param(); + $user_id = $params['user_id'] ?? 0; + unset($params['user_id']); + UserModel::where('user_id', $user_id)->update($params); + return $this->renderSuccess('ok'); + } + + + + + + + + + + + + + + + + + + }