update 用户邀请码
This commit is contained in:
parent
42891e08c8
commit
c4faaed24f
|
@ -72,7 +72,27 @@ class UserLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
return User::update([
|
return User::update([
|
||||||
'id' => $params['id'],
|
'id' => $params['id'],
|
||||||
$params['field'] => $params['value']
|
'nickname' => $params['nickname'],
|
||||||
|
'account' => $params['account'],
|
||||||
|
'mobile' => $params['account'],
|
||||||
|
'id_card' => $params['id_card'],
|
||||||
|
'channel' => 0,
|
||||||
|
'sex' => $params['sex'],
|
||||||
|
'province' => $params['province'],
|
||||||
|
'city' => $params['city'],
|
||||||
|
'area' => $params['area'],
|
||||||
|
'street' => $params['street'],
|
||||||
|
'village' => $params['village'],
|
||||||
|
'brigade' => $params['brigade'],
|
||||||
|
'address' => $params['address'],
|
||||||
|
'qualification' => json_encode($params['qualification']),
|
||||||
|
'company_id' => $params['company_id'],
|
||||||
|
'deposit' => $params['deposit'],
|
||||||
|
'deposit_date' => strtotime($params['deposit_date']),
|
||||||
|
'user_information_count' => $params['user_information_count'],
|
||||||
|
'register_num' => $params['register_num'],
|
||||||
|
'merchant_num' => $params['merchant_num'],
|
||||||
|
'trade_amount' => $params['trade_amount'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,21 +161,21 @@ class UserLogic extends BaseLogic
|
||||||
// }
|
// }
|
||||||
$group_id = $params['group_id'];
|
$group_id = $params['group_id'];
|
||||||
// 每个公司市场部长只有1个
|
// 每个公司市场部长只有1个
|
||||||
if($group_id == 16) {
|
// if($group_id == 16) {
|
||||||
$marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
// $marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
||||||
if (!$marketManger->isEmpty()) {
|
// if (!$marketManger->isEmpty()) {
|
||||||
self::setError('公司已创建市场部长账号');
|
// self::setError('公司已创建市场部长账号');
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 每个公司服务部长只有1个
|
// 每个公司服务部长只有1个
|
||||||
if($group_id == 14) {
|
// if($group_id == 14) {
|
||||||
$marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
// $marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
||||||
if (!$marketManger->isEmpty()) {
|
// if (!$marketManger->isEmpty()) {
|
||||||
self::setError('公司已创建服务部长账号');
|
// self::setError('公司已创建服务部长账号');
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
$userSn = User::createUserSn();
|
$userSn = User::createUserSn();
|
||||||
$passwordSalt = Config::get('project.unique_identification');
|
$passwordSalt = Config::get('project.unique_identification');
|
||||||
$password = create_password(123456, $passwordSalt);
|
$password = create_password(123456, $passwordSalt);
|
||||||
|
@ -190,6 +210,10 @@ class UserLogic extends BaseLogic
|
||||||
'deposit' => $params['deposit'],
|
'deposit' => $params['deposit'],
|
||||||
'deposit_date' => strtotime($params['deposit_date']),
|
'deposit_date' => strtotime($params['deposit_date']),
|
||||||
'user_information_count' => $params['user_information_count'],
|
'user_information_count' => $params['user_information_count'],
|
||||||
|
'register_num' => $params['register_num'],
|
||||||
|
'merchant_num' => $params['merchant_num'],
|
||||||
|
'trade_amount' => $params['trade_amount'],
|
||||||
|
'invite_code' => generate_rand_code(10),
|
||||||
]);
|
]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,3 +530,15 @@ function push_message($reg_id,$message){
|
||||||
return ['code'=>0,'msg'=>$e->getMessage(),'data'=>[]];
|
return ['code'=>0,'msg'=>$e->getMessage(),'data'=>[]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_rand_code($length = 8) {
|
||||||
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; // 包含所有字符(大小写)和数字
|
||||||
|
$code = '';
|
||||||
|
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$index = rand(0, strlen($characters)-1);
|
||||||
|
$code .= $characters[$index];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $code;
|
||||||
|
}
|
Loading…
Reference in New Issue