You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
979 B
32 lines
979 B
<?php
|
|
|
|
namespace app\admin\model\user;
|
|
|
|
use app\common\enum\user\UserTypeEnum;
|
|
|
|
class User extends \app\common\model\User
|
|
{
|
|
|
|
public function register($data, $storeId)
|
|
{
|
|
$user_id = 0;
|
|
if (!empty($data['mobile'])) {
|
|
$user_info = self::detail(['mobile' => $data['mobile']]);
|
|
if (!empty($user_info)) {
|
|
$user_id = $user_info['user_id'];
|
|
$this->where(['user_id' => $user_id])->save(['user_type' => UserTypeEnum::STORE]);
|
|
} else {
|
|
$add = [
|
|
'mobile' => $data['mobile'],
|
|
'nick_name' => hide_mobile($data['mobile']),
|
|
'platform' => 'MP-WEIXIN',
|
|
'last_login_time' => time(),
|
|
'store_id' => $storeId,
|
|
'user_type' => UserTypeEnum::STORE,
|
|
];
|
|
$user_id = $this->insertGetId($add);
|
|
}
|
|
}
|
|
return $user_id;
|
|
}
|
|
} |