kevin 1 год назад
Родитель
Сommit
a41124ec71

+ 11 - 11
common/models/ShopGoods.php

@@ -67,10 +67,10 @@ class ShopGoods extends \common\components\ActiveRecord
     ];
 
     const BANK_CODE = [
-        'WECHAT'        => 'WeChat',
-        'WAPWECHAT'     => 'WeChat',
-        'ALIPAY'        => 'ALiPay',
-        'WEBSITEALIPAY' => 'ALiPay',
+        'WECHAT'        => 'wechat',
+        'WAPWECHAT'     => 'wechat',
+        'ALIPAY'        => 'alipay',
+        'WEBSITEALIPAY' => 'alipay',
     ];
 
     const GOODS_TYPE = [
@@ -208,7 +208,7 @@ class ShopGoods extends \common\components\ActiveRecord
                 'name' => '微信',
             ],
             'alipay'  => [
-                'name' => '支付',
+                'name' => '支付',
             ],
         ];
     }
@@ -222,9 +222,9 @@ class ShopGoods extends \common\components\ActiveRecord
                 'WECHAT'  => [
                     'name' => '微信',
                 ],
-                'ALIPAY'  => [
-                    'name' => '支付宝',
-                ],
+//                'ALIPAY'  => [
+//                    'name' => '支付宝',
+//                ],
             ];
         }
         if ($device == 'mobile') {
@@ -233,9 +233,9 @@ class ShopGoods extends \common\components\ActiveRecord
                 'WAPWECHAT'  => [
                     'name' => '微信',
                 ],
-                'WEBSITEALIPAY'  => [
-                    'name' => '支付宝',
-                ],
+//                'WEBSITEALIPAY'  => [
+//                    'name' => '支付宝',
+//                ],
             ];
         }
         if ($device == 'local') {

+ 0 - 17
common/models/forms/ApproachOrderForm.php

@@ -125,19 +125,14 @@ class ApproachOrderForm extends Model
      */
     public function beforeValidate()
     {
-        LoggerTool::error(['UPOP - webhook: (beforeValidate 1).']);
         $parentValidate = parent::beforeValidate();
         if ($this->sn) {
-            LoggerTool::error(['UPOP - webhook: (beforeValidate 2).', $this->sn]);
             $this->_model = ApproachOrder::findOne(['SN' => $this->sn]);
-            LoggerTool::error(['UPOP - webhook: (beforeValidate 3).', $this->_model]);
             if (!$this->_model) {
-                LoggerTool::error(['UPOP - webhook: (beforeValidate 4).', $this->_model]);
                 $this->addError('sn', '订单不存在');
                 return false;
             }
         }
-        LoggerTool::error(['UPOP - webhook: (beforeValidate 5).', $this->_model]);
         return $parentValidate;
     }
 
@@ -146,7 +141,6 @@ class ApproachOrderForm extends Model
      * @param $attribute
      */
     public function isAddress($attribute){
-        LoggerTool::error(['UPOP - webhook: (isAddress 1).']);
         if (!$receiveAddress = ReceiveAddress::find()->where('ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
             $this->addError($attribute, '收货地址不存在');
         } else {
@@ -156,7 +150,6 @@ class ApproachOrderForm extends Model
                 $this->_address = $receiveAddress;
             }
         }
-        LoggerTool::error(['UPOP - webhook: (isAddress 2).']);
     }
 
     /**
@@ -166,24 +159,20 @@ class ApproachOrderForm extends Model
      */
     public function isPayType($attribute)
     {
-        LoggerTool::error(['UPOP - webhook: (isPayType 1).']);
         if ($this->payType && !in_array($this->payType, array_values(ShopGoods::BANK_CODE))) {
             $this->addError('支付方式错误');
             return;
         }
-
         // 一个订单只能包含一类商品
         $goods = ShopGoods::find()->select('ID,CATE_ID')->where(['in', 'ID', $this->goodsId])->andWhere(['STATUS' => 1])->asArray()->all();
         if (!$goods) {
             throw new Exception('商品已下架');
-            return;
         }
         $goodsCategoryType = array_unique(array_column($goods, 'CATE_ID'));
         if (count($goodsCategoryType) > 1) {
             $this->addError($attribute, '订单不能包含多种商品分类');
             return;
         }
-        LoggerTool::error(['UPOP - webhook: (isPayType 2).']);
     }
 
     /**
@@ -192,13 +181,10 @@ class ApproachOrderForm extends Model
      * @throws Exception
      */
     public function isStatus($attribute){
-        LoggerTool::error(['UPOP - webhook: (isStatus 1).', $this->status]);
         if ($this->status && ($this->status != \Yii::$app->params['orderStatus']['notPaid']['value']) && ($this->status != \Yii::$app->params['orderStatus']['paid']['value'])) {
-            LoggerTool::error(['UPOP - webhook: (isStatus 2).']);
             $this->addError($attribute, '订单状态类型错误');
             throw new Exception('商品已下架');
         }
-        LoggerTool::error(['UPOP - webhook: (isStatus 3).']);
     }
 
     /**
@@ -250,7 +236,6 @@ class ApproachOrderForm extends Model
     public function verifyPayUPOP(): ?bool
     {
         if (!$this->validate()) {
-            LoggerTool::error(['UPOP - webhook: (validate).']);
             return null;
         }
 
@@ -263,7 +248,6 @@ class ApproachOrderForm extends Model
             $this->_model->NOTE = json_encode($this->note);
             $this->_model->PAY_AT = strtotime($this->note['pay_time']);
             if (!$this->_model->save()) {
-                LoggerTool::error(['UPOP - webhook: (update).']);
                 throw new Exception(Form::formatErrorsForApi($this->_model->getErrors()));
             }
 
@@ -280,7 +264,6 @@ class ApproachOrderForm extends Model
             $transaction->commit();
             return true;
         } catch (Exception $e) {
-            LoggerTool::error(['UPOP - webhook: (exp).' . $e->getFile() . '  ' . $e->getMessage()]);
             $transaction->rollBack();
             $this->addError('edit', $e->getFile() . '  ' . $e->getMessage());
             return null;

+ 0 - 3
frontendApi/modules/v1/controllers/ShopController.php

@@ -768,9 +768,6 @@ class ShopController extends BaseController {
         $rawPostData = \Yii::$app->request->post();
         LoggerTool::debug(['UPOP - webhook: (init).', $rawPostData]);
 
-//        $rawPostData = json_decode($rawPostData, true);
-
-        // signData agencyId encryptKey encryptData
         $agencyId = $rawPostData['agencyId'] ?? '';
         $signData = $rawPostData['signData'] ?? '';
         $encryptKey = $rawPostData['encryptKey'] ?? '';