user; $this->success('获取成功',$user); } /** * 编辑个人信息 * * @Apidoc\Method("POST") * @Apidoc\Param("type", type="int", require=true, desc="修改的类型(1:昵称,2:签名,3:手机号)") * @Apidoc\Param("nickname", type="string", desc="昵称") * @Apidoc\Param("signature", type="string", desc="签名") * @Apidoc\Param("phone", type="string", desc="手机号") */ public function edit() { $uid = $this->user_id; $type = input('type'); $nickname = input('nickname'); $signature = input('signature'); $phone = input('phone'); if(!in_array($type,[1,2,3])){ $this->error('参数错误'); } if($type == 1){ if(empty($nickname)){ $this->error('参数错误'); } $update_data['nickname'] = $nickname; }elseif ($type == 2){ if(empty($signature)){ $this->error('参数错误'); } $update_data['signature'] = $signature; }elseif ($type == 2){ if(empty($phone)){ $this->error('参数错误'); } if(!preg_match("/^1[23456789]\d{9}$/", $phone)){ $this->error('手机号格式不正确'); } $update_data['phone'] = $phone; } Db::name('store_member')->where('id',$uid)->update($update_data); $this->success('编辑成功'); } }