Commit 81cf91df authored by luhongguang's avatar luhongguang

Merge branch 'master' into fix_luhongguang_20210902

parents eaec0f3e e640593a
...@@ -22,5 +22,6 @@ class UserException extends BaseException ...@@ -22,5 +22,6 @@ class UserException extends BaseException
8 => '绑定手机号失败', 8 => '绑定手机号失败',
9 => '该手机号已绑定其他用户不能重复绑定', 9 => '该手机号已绑定其他用户不能重复绑定',
10 => 'mysql 异常', 10 => 'mysql 异常',
11 => '头像昵称更新失败',
]; ];
} }
\ No newline at end of file
...@@ -26,6 +26,14 @@ class UserWechatBind extends MysqlBase ...@@ -26,6 +26,14 @@ class UserWechatBind extends MysqlBase
return self::get($columns, $where); return self::get($columns, $where);
} }
public static function getRecordMaster($where, $columns = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::getMaster($columns, $where);
}
public static function getRecords($where, $columns = []) public static function getRecords($where, $columns = [])
{ {
if (empty($columns)) { if (empty($columns)) {
...@@ -34,7 +42,7 @@ class UserWechatBind extends MysqlBase ...@@ -34,7 +42,7 @@ class UserWechatBind extends MysqlBase
return self::select($columns, $where); return self::select($columns, $where);
} }
public static function getRecordMaster($where, $columns = []) public static function getRecordsMaster ($where, $columns = [])
{ {
if (empty($columns)) { if (empty($columns)) {
$columns = '*'; $columns = '*';
......
...@@ -58,7 +58,7 @@ class UserService ...@@ -58,7 +58,7 @@ class UserService
//} //}
$user = UserWechatBind::getRecord(['openid' => $openid]); $user = UserWechatBind::getRecordMaster(['openid' => $openid]);
//如果系统不存在,用户信息,则注册新用户 //如果系统不存在,用户信息,则注册新用户
if (empty($user) && !empty($response)) { if (empty($user) && !empty($response)) {
$insert = [ $insert = [
...@@ -211,10 +211,15 @@ class UserService ...@@ -211,10 +211,15 @@ class UserService
"city" => !empty($params['city']) ? $params['city'] : '', "city" => !empty($params['city']) ? $params['city'] : '',
"language" => !empty($params['language']) ? $params['language'] : '', "language" => !empty($params['language']) ? $params['language'] : '',
]; ];
$user = UserWechatBind::getRecordMaster(['openid' => $params['openid']]);
if (empty($user)){
$update['openid'] = $params['openid'];
$bindStatus = UserWechatBind::save($update);
}else{
$bindStatus = UserWechatBind::save($update,['openid' => $params['openid']]); $bindStatus = UserWechatBind::save($update,['openid' => $params['openid']]);
}
if (!$bindStatus) { if (!$bindStatus) {
throw new UserException(['cus' => 8]); throw new UserException(['cus' => 11]);
} }
return $update; return $update;
} }
......
...@@ -31,6 +31,6 @@ exception.sys.msg = "系统未定义异常,研发正在赶来的路上..." ...@@ -31,6 +31,6 @@ exception.sys.msg = "系统未定义异常,研发正在赶来的路上..."
[prod : common : exception] [prod : common : exception]
[pre : common : exception] [perf : common : exception]
[test : common : exception] [test : common : exception]
[dev : common : exception] [dev : common : exception]
\ No newline at end of file
...@@ -11,6 +11,6 @@ idgen.partner = "bp" ...@@ -11,6 +11,6 @@ idgen.partner = "bp"
idgen.key = "5cfdb867e96374c7883b31d6928cc4cb" idgen.key = "5cfdb867e96374c7883b31d6928cc4cb"
[prod : common] [prod : common]
[pre : common ] [perf : common ]
[test: common ] [test: common ]
[dev : common ] [dev : common ]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment