|
@@ -114,21 +114,32 @@ class User extends Apic
|
|
|
*/
|
|
|
public function profile()
|
|
|
{
|
|
|
- //验证
|
|
|
- if($this->auth->type != 1){
|
|
|
- $this->error('只有门店老板才能设置');
|
|
|
- }
|
|
|
$field = [
|
|
|
'mobile',
|
|
|
- 'image',
|
|
|
- 'is_open',
|
|
|
- 'open_hours',
|
|
|
+ 'email',
|
|
|
+ 'avatar',
|
|
|
+ 'firstname',
|
|
|
+ 'lastname',
|
|
|
+ 'lang',
|
|
|
];
|
|
|
|
|
|
$data = request_post_hub($field);
|
|
|
- $data['updatetime'] = time();
|
|
|
|
|
|
- $update_rs = Db::name('company')->where('id',$this->auth->company_id)->update($data);
|
|
|
+ if(isset($data['email'])){
|
|
|
+ $check_email = Db::name('coach')->where('email',$data['email'])->where('id','neq',$this->auth->id)->find();
|
|
|
+ if($check_email){
|
|
|
+ $this->error('邮箱已被其他人使用');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isset($data['mobile'])){
|
|
|
+ $check_mobile = Db::name('coach')->where('mobile',$data['mobile'])->where('id','neq',$this->auth->id)->find();
|
|
|
+ if($check_mobile){
|
|
|
+ $this->error('手机号已被其他人使用');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $update_rs = Db::name('coach')->where('id',$this->auth->id)->update($data);
|
|
|
|
|
|
$this->success('资料更新完成');
|
|
|
}
|