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
8 => '绑定手机号失败',
9 => '该手机号已绑定其他用户不能重复绑定',
10 => 'mysql 异常',
11 => '头像昵称更新失败',
];
}
\ No newline at end of file
......@@ -26,6 +26,14 @@ class UserWechatBind extends MysqlBase
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 = [])
{
if (empty($columns)) {
......@@ -34,7 +42,7 @@ class UserWechatBind extends MysqlBase
return self::select($columns, $where);
}
public static function getRecordMaster($where, $columns = [])
public static function getRecordsMaster ($where, $columns = [])
{
if (empty($columns)) {
$columns = '*';
......
......@@ -58,7 +58,7 @@ class UserService
//}
$user = UserWechatBind::getRecord(['openid' => $openid]);
$user = UserWechatBind::getRecordMaster(['openid' => $openid]);
//如果系统不存在,用户信息,则注册新用户
if (empty($user) && !empty($response)) {
$insert = [
......@@ -211,10 +211,15 @@ class UserService
"city" => !empty($params['city']) ? $params['city'] : '',
"language" => !empty($params['language']) ? $params['language'] : '',
];
$bindStatus = UserWechatBind::save($update,['openid' => $params['openid']]);
$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']]);
}
if (!$bindStatus) {
throw new UserException(['cus' => 8]);
throw new UserException(['cus' => 11]);
}
return $update;
}
......
......@@ -31,6 +31,6 @@ exception.sys.msg = "系统未定义异常,研发正在赶来的路上..."
[prod : common : exception]
[pre : common : exception]
[perf : common : exception]
[test : common : exception]
[dev : common : exception]
\ No newline at end of file
......@@ -11,6 +11,6 @@ idgen.partner = "bp"
idgen.key = "5cfdb867e96374c7883b31d6928cc4cb"
[prod : common]
[pre : common ]
[perf : common ]
[test: 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