diff --git a/niucloud/app/api/controller/apiController/Personnel.php b/niucloud/app/api/controller/apiController/Personnel.php index 55f10784..fc0ed492 100644 --- a/niucloud/app/api/controller/apiController/Personnel.php +++ b/niucloud/app/api/controller/apiController/Personnel.php @@ -42,6 +42,30 @@ class Personnel extends BaseApiService return success($res); } + //员工修改 + public function edit(Request $request){ + $params = $request->all(); + $data = [ + 'head_img'=>$params['head_img'],//头像|绝对地址 + 'name'=>$params['name'],//姓名 + 'address'=>$params['address'],//住址 + 'gender'=>$params['gender'],//性别 + 'birthday'=>$params['birthday'],//生日 + 'email'=>$params['email'],//邮箱 + 'phone'=>$params['phone'],//手机号 + 'wx'=>$params['wx'],//微信号 + ]; + //获取员工信息 + $where = [ + 'id'=>$this->member_id, + ]; + $res = (new PersonnelService())->edit($where,$data); + if(!$res['code']){ + return fail('操作失败'); + } + return success([]); + } + /** * 登录 * @return Response diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 7affb5ff..b6013152 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -199,6 +199,8 @@ Route::group(function() { Route::post('uploadImage', 'upload.Upload/image'); //员工端详情 Route::get('personnel/info', 'apiController.Personnel/info'); + //员工端-修改 + Route::post('personnel/edit', 'apiController.Personnel/edit'); diff --git a/niucloud/app/service/api/apiService/PersonnelService.php b/niucloud/app/service/api/apiService/PersonnelService.php index 1baf1e1d..c8c7ab54 100644 --- a/niucloud/app/service/api/apiService/PersonnelService.php +++ b/niucloud/app/service/api/apiService/PersonnelService.php @@ -68,6 +68,40 @@ class PersonnelService extends BaseApiService } + //员工信息-修改 + public function edit(array $where,array $data){ + $data['update_time'] = date('Y-m-d H:i:s'); + + if(!$where){ + return [ + 'code'=>0, + 'msg'=>'查询条件不能为空' + ]; + } + + $model = $this->model; + if(!empty($where['id'])){ + $model = $model->where('id',$where['id']); + } + $res = $model->update($data);//员工信息 + + if($res){ + $res = [ + 'code'=>1, + 'msg'=>'操作成功' + ]; + }else{ + $res = [ + 'code'=>0, + 'msg'=>'操作失败' + ]; + } + return $res; + + } + + + /** * 获取会员的模型对象(todo 慎用!!! 现主要用于登录)