瀏覽代碼

mall/user/account-login 密码错误返回码修改

shizhongqi 3 天之前
父節點
當前提交
8ec001f1ed
共有 2 個文件被更改,包括 12 次插入5 次删除
  1. 5 5
      app-mall/controllers/UserController.php
  2. 7 0
      common/components/errCode.php

+ 5 - 5
app-mall/controllers/UserController.php

@@ -13,6 +13,7 @@ use bizMall\user\services\UserAssetService;
 use bizMall\user\services\UserService;
 use biz\shop\classes\ShopClass;
 use common\components\dict;
+use common\components\errCode;
 use common\components\imgUtil;
 use common\components\jwt;
 use common\components\stringUtil;
@@ -165,13 +166,12 @@ class UserController extends BaseController
     //使用账号登录 ssh 20220920
     public function actionAccountLogin()
     {
-        $getParams = Yii::$app->request->get();
         $postParams = Yii::$app->request->post();
-        $allParams = array_merge($getParams, $postParams);
-        $mobile = $allParams['mobile'] ?? '';
-        $password = $allParams['password'] ?? '';
+        $mobile = $postParams['mobile'];
+        $password = $postParams['password'];
         if ($password != 'a.1234') {
-            util::fail('密码错误');
+            //util::fail('密码错误');
+            util::error(errCode::USER_PASSWD_WRONG, '密码错误');
         }
         $user = UserClass::getByCondition(['mobile' => $mobile], true);
         if (empty($user)) {

+ 7 - 0
common/components/errCode.php

@@ -24,6 +24,13 @@ namespace common\components;
  */
 class errCode
 {
+    /**
+     * 用户登录失败
+     * 场景:UserController::actionAccountLogin
+     * 前端:mallApp/src/pages/login/account.vue
+     */
+    const USER_PASSWD_WRONG = 2001;
+
     /**
      * 客户在当前门店暂无绑定关系(hd 表无记录)
      * 场景:GroupBuyController::actionDetail