|
|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
namespace client\controllers;
|
|
|
|
|
|
+use biz\MQ\services\SmsService;
|
|
|
use biz\user\services\UserAssetService;
|
|
|
use biz\user\services\UserService;
|
|
|
+use common\components\stringUtil;
|
|
|
use Yii;
|
|
|
use common\components\util;
|
|
|
use yii\helpers\Json;
|
|
|
@@ -114,7 +116,7 @@ class UserController extends BaseController
|
|
|
if (empty($old)) {
|
|
|
util::fail('请填写旧密码');
|
|
|
}
|
|
|
- if (password_verify($old , $user['password']) == false) {
|
|
|
+ if (password_verify($old, $user['password']) == false) {
|
|
|
util::fail('旧密码错误');
|
|
|
}
|
|
|
}
|
|
|
@@ -122,4 +124,39 @@ class UserController extends BaseController
|
|
|
util::ok('修改成功');
|
|
|
}
|
|
|
|
|
|
+ //申请会员 shish 2019.12.18
|
|
|
+ public function actionApplyMember()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $mobile = isset($post['mobile']) ? $post['mobile'] : 0;
|
|
|
+ if (stringUtil::isMobieNumber($mobile) == false) {
|
|
|
+ util::fail('请输入手机号');
|
|
|
+ }
|
|
|
+ $user = $this->user;
|
|
|
+ if (isset($user['isMember']) && $user['isMember'] == 1) {
|
|
|
+ util::fail('已经是会员了');
|
|
|
+ }
|
|
|
+ $userId = $this->userId;
|
|
|
+ $code = isset($post['code']) ? $post['code'] : '';
|
|
|
+ $cacheCode = SmsService::getApplyMemberCode($userId);
|
|
|
+ if (empty($cacheCode) || $cacheCode != $code) {
|
|
|
+ util::fail('验证码错误');
|
|
|
+ }
|
|
|
+ $update = [];
|
|
|
+ if (isset($post['realName']) && !empty($post['realName'])) {
|
|
|
+ $update['realName'] = $post['realName'];
|
|
|
+ }
|
|
|
+ if (isset($post['birthday']) && !empty($post['birthday'])) {
|
|
|
+ $update['birthday'] = $post['birthday'];
|
|
|
+ }
|
|
|
+ $user = UserService::getByCondition(['merchantId' => $this->merchantId, 'mobile' => $mobile]);
|
|
|
+ if (!empty($user)) {
|
|
|
+ util::fail('手机号已经注册过了');
|
|
|
+ }
|
|
|
+ $update['isMember'] = 1;
|
|
|
+ UserService::updateById($userId, $update);
|
|
|
+ UserAssetService::updateByUserId($userId, ['isMember' => 1]);
|
|
|
+ util::ok('注册成功');
|
|
|
+ }
|
|
|
+
|
|
|
}
|