|
|
@@ -113,8 +113,8 @@ class DeclarationForm extends Model
|
|
|
public function rules()
|
|
|
{
|
|
|
return [
|
|
|
- [['type','decLv','decWay','packageId', 'insertUserName', 'realName', 'insertUserIdCard', 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo','bankProvince','bankCity','bankCounty','consignee','acceptMobile','province','city','county','decUserName', 'conUserName', 'recUserName', 'location'], 'trim'],
|
|
|
- [['type','decLv','decWay','insertUserName', 'insertUserIdCard','password','payPassword','decUserName'], 'required'],
|
|
|
+ [['password','payPassword','type','decLv','decWay','packageId', 'insertUserName', 'realName', 'insertUserIdCard', 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo','bankProvince','bankCity','bankCounty','consignee','acceptMobile','province','city','county','decUserName', 'conUserName', 'recUserName', 'location'], 'trim'],
|
|
|
+ [['type','decLv','decWay','insertUserName', 'insertUserIdCard','decUserName'], 'required'],
|
|
|
[['type'], 'isType', 'on'=>['userDec', 'canDec']],
|
|
|
[['insertUserName'], 'isCanAddUser'],
|
|
|
[['decUserName'], 'issetDec'],
|
|
|
@@ -688,11 +688,30 @@ class DeclarationForm extends Model
|
|
|
*/
|
|
|
public function addUser($allData){
|
|
|
$period = Period::instance();
|
|
|
+ $userPasswd = $this->password;
|
|
|
+ $userPayPasswd = $this->payPassword;
|
|
|
+ // 如果身份证信息有误,或不足6位,并且没有手动填写密码,就用111111
|
|
|
+ if (Info::simpleIdCardCheck($this->insertUserIdCard)) {
|
|
|
+ if (empty($userPasswd)) {
|
|
|
+ $userPasswd = Info::passwordGenerator($this->insertUserIdCard,$this->insertUserName);
|
|
|
+ }
|
|
|
+ if (empty($userPayPasswd)) {
|
|
|
+ $userPayPasswd = Info::passwordGenerator($this->insertUserIdCard,$this->insertUserName);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (empty($userPasswd)) {
|
|
|
+ $userPasswd = '111111';
|
|
|
+ }
|
|
|
+ if (empty($userPayPasswd)) {
|
|
|
+ $userPayPasswd = '111111';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 增加会员
|
|
|
$user = new User();
|
|
|
$user->USER_NAME = $this->insertUserName;
|
|
|
- $user->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
|
|
|
- $user->PAY_PASSWORD = \Yii::$app->security->generatePasswordHash($this->payPassword);
|
|
|
+ $user->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($userPasswd);
|
|
|
+ $user->PAY_PASSWORD = \Yii::$app->security->generatePasswordHash($userPayPasswd);
|
|
|
$user->NATION = 0;
|
|
|
$user->REAL_NAME = $this->realName;
|
|
|
$user->ID_CARD = $this->insertUserIdCard;
|