|
@@ -2,13 +2,17 @@
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
-use app\admin\model\user\UserExt;
|
|
|
+use liuniu\IdentityCard;
|
|
|
+use app\admin\model\user\{UserExt};
|
|
|
+use app\admin\model\{User as UserModel};
|
|
|
use app\admin\model\UserRelation;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\library\Ems;
|
|
|
use app\common\library\Sms;
|
|
|
use fast\Random;
|
|
|
+use liuniu\UtilService;
|
|
|
use think\Config;
|
|
|
+use think\Request;
|
|
|
use think\Validate;
|
|
|
|
|
|
/**
|
|
@@ -354,4 +358,57 @@ class User extends Api
|
|
|
$info['ext'] = null;
|
|
|
$this->success('获取成功',$info);
|
|
|
}
|
|
|
+ public function setuser(Request $request)
|
|
|
+ {
|
|
|
+ $where = UtilService::postMore(
|
|
|
+ [
|
|
|
+ ['full_name',''],
|
|
|
+ ['vocation',''],
|
|
|
+ ['position',''],
|
|
|
+ ['education',''],
|
|
|
+ ['tel',''],
|
|
|
+ ['address',''],
|
|
|
+ ['company_name',''],
|
|
|
+ ['nature',''],
|
|
|
+ ['legal_person',''],
|
|
|
+ ['zip_code',''],
|
|
|
+ ['compnay_address',''],
|
|
|
+ ['company_email',''],
|
|
|
+ ['certificateimage',''],
|
|
|
+ ['id_card',''],
|
|
|
+ ['nation',''],
|
|
|
+ ['birthday',''],
|
|
|
+ ['user_type',0],
|
|
|
+ ['mobile',''],
|
|
|
+ ],$request
|
|
|
+ );
|
|
|
+ $user = [];$user_ext = [];
|
|
|
+ $info = UserModel::find($this->auth->getUserinfo()['id']);
|
|
|
+ if($info['user_type']!=0 && $info['user_type']!=$where['user_type']) $this->error('用户类型不可修改');
|
|
|
+ if(!preg_match("/^1\d{10}$/", $where['mobile'])) $this->error('手机号不对');
|
|
|
+ if(IdentityCard::isValid($where['id_card']))$this->error('身份证号不正确!');
|
|
|
+ foreach ($where as $key=>$v)
|
|
|
+ {
|
|
|
+ if($v!='')
|
|
|
+ {
|
|
|
+ if(in_array($key,['id_card','birthday','user_type','mobile']))
|
|
|
+ {
|
|
|
+ $user[$key] = $v;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $user_ext['key'] =$v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(sizeof($user)>0)
|
|
|
+ {
|
|
|
+ UserModel::where('id',$this->auth->getUserinfo()['id'])->update($user);
|
|
|
+ }
|
|
|
+ if(sizeof($user_ext)>0)
|
|
|
+ {
|
|
|
+ UserExt::where('id',$this->auth->getUserinfo()['id'])->update($user_ext);
|
|
|
+ }
|
|
|
+ $this->success('修改成功');
|
|
|
+ }
|
|
|
}
|