Procházet zdrojové kódy

1. fix bug
2. 创建与修改花束表单,添加“重量”字段

shizhongqi před 11 měsíci
rodič
revize
bd9ded1c14

+ 10 - 0
.env.example

@@ -21,6 +21,16 @@ RABBIT_MQ_PORT=5672
 DADA_APP_KEY=dadaf2279d901a5ba40
 DADA_APP_SECRET=828a03677a1c00a3a5b3c59209c4433d
 
+#微信小程序 -- API对称密钥
+AES_SN=7138fea6df1b6b8221bc2ab90b17344a
+AES_KEY=ReqFf7q7KfIJARwrLQWi7d4eaSx2wwFStDJ7hIF4oJA=
+
+#微信小程序 -- API非对称密钥
+RSA_SN=60b64c24c6afdf1e7fa8d6467a621b55
+
+#微信小程序 -- API安全证书
+CERT_SN=424b2f2fbea24515a973ca0f81e1012d
+
 #debug和gii允许的ip
 DEBUG_ALLOWED_IP='127.0.0.1'
 GII_ALLOWED_IP='127.0.0.1'

+ 7 - 18
app-ghs/controllers/IntraCityController.php

@@ -85,7 +85,7 @@ class IntraCityController extends BaseController
                 $shopExt->wxStoreId = $result['wx_store_id'];
                 $shopExt->save();
 
-                util::success("门店创建成功", $result);
+                util::success($result, "门店创建成功");
             } else {
                 Yii::error("门店创建失败:" . $result['errmsg']);
                 util::fail($result['errmsg']);
@@ -440,7 +440,7 @@ class IntraCityController extends BaseController
                 ];
                 ExpressOrderClass::add($orderData);
 
-                util::success('订单创建成功', ['fee' => $result['fee']]);
+                util::success(['fee' => $result['fee']], '订单创建成功');
             } else {
                 noticeUtil::push("门店 -- " . $this->mainId . ",订单创建失败:" . json_encode($result));
                 Yii::error("订单创建失败:" . ($result['errmsg'] ?? '未知错误'), 'intracity');
@@ -467,7 +467,7 @@ class IntraCityController extends BaseController
             $post = Yii::$app->request->post();
             $wxOrderId = isset($post['wx_order_id']) ? $post['wx_order_id'] : '';
             $orderId = $post['orderId'];
-            $wxStoreId = isset($post['wx_store_id']) ? $post['wx_order_id'] : $shopExt['wxStoreId'];
+            $wxStoreId = isset($post['wx_store_id']) ? $post['wx_store_id'] : $shopExt['wxStoreId'];
 
             if (empty($wxOrderId) && (empty($orderId) || empty($wxStoreId))) {
                 util::fail("参数不足:wx_order_id 或 (order_id + wx_store_id) 必须提供一组");
@@ -499,7 +499,7 @@ class IntraCityController extends BaseController
 
             $result = IntraCityExpress::queryOrder($wxStoreId, $storeOrderId, $wxOrderId);
             if (isset($result['errcode']) && $result['errcode'] === 0) {
-                util::success("查询成功", $result);
+                util::success($result, "查询成功");
             } else {
                 Yii::error("订单查询失败:" . ($result['errmsg'] ?? '未知错误'), 'intracity');
                 util::fail( '订单查询失败: ' . $result['errcode']);
@@ -526,7 +526,7 @@ class IntraCityController extends BaseController
 
             $wxOrderId = isset($post['wx_order_id']) ? $post['wx_order_id'] : '';
             $orderId = $post['orderId'];    //配送订单创建成功后,也会返回的 store_order_id。 即 orderId
-            $wxStoreId = isset($post['wx_store_id']) ? $post['wx_order_id'] : $shopExt['wxStoreId'];
+            $wxStoreId = isset($post['wx_store_id']) ? $post['wx_store_id'] : $shopExt['wxStoreId'];
             if (empty($wxOrderId) && (empty($orderId) || empty($wxStoreId))) {
                 util::fail("参数不足:wx_order_id 或 (store_order_id + wx_store_id) 必须提供一组");
             }
@@ -572,12 +572,12 @@ class IntraCityController extends BaseController
                     $eo->save();
                 }
 
-                util::success("订单取消成功", $result);
+                util::success($result, "订单取消成功");
             } else {
                 if ($result['errcode'] == 934018) { // 93401 -- 订单已取消,请勿重复操作
                     // 更新订单状态
                     OrderClass::updateById($orderId, ['sendStatus' => OrderClass::ORDER_STATUS_CANCEL]);//设置为取消状态
-                    util::success("订单取消成功", $result);
+                    util::success($result, "订单取消成功");
                 }
 
                 Yii::error("订单取消失败:" . ($result['errmsg'] ?? '未知错误'), 'intracity');
@@ -589,17 +589,6 @@ class IntraCityController extends BaseController
         }
     }
 
-
-
-    /**
-     * 获取订单列表
-     * GET /intra-city/order-list
-     */
-    public function actionOrderList()
-    {
-
-    }
-
     /**
      * 微信回调接口
      * POST /intra-city/callback

+ 1 - 2
app-hd/controllers/GoodsController.php

@@ -194,11 +194,10 @@ class GoodsController extends BaseController
             util::fail('美团商品暂时不能修改');
         }
 
-        $staff = $this->shopAdmin;
-
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
+            $staff = $this->shopAdmin;
             GoodsClass::updateGoods($info, $data, $staff);
             $transaction->commit();
             util::complete();

+ 8 - 0
app-hd/models/goods/AddForm.php

@@ -39,6 +39,12 @@ class AddForm extends BaseForm
      */
     public $flowerNum;
 
+    /**
+     * 重量
+     * @var float
+     */
+    public $weight;
+
     /**
      * 商品图片
      * @var array
@@ -104,6 +110,7 @@ class AddForm extends BaseForm
             [['name'], 'required', 'message' => '请填写商品名称'],
             [['priceType'], 'required', 'message' => '请选择价格类型'],
             [['catIds'], 'required', 'message' => '请选择商品分类'],
+            ['weight', 'required', 'message' => '请填写重量'],
 
             // 默认值设置
             ['price', 'default', 'value' => 0],
@@ -117,6 +124,7 @@ class AddForm extends BaseForm
             ['priceType', 'in', 'range' => [0, 1]],
             ['price', 'number', 'min' => 0, 'message' => '商品价格必须大于或等于0'],
             ['flowerNum', 'number', 'min' => 0, 'message' => '花朵数量必须大于或等于0'],
+            ['weight', 'number', 'min' => 0, 'message' => '花朵数量必须大于或等于0'],
             ['sold', 'integer', 'min' => 0, 'message' => '已售数量必须大于或等于0'],
             [['stockSet'], 'in', 'range' => [0, 1]],
             [['needSend'], 'in', 'range' => [0, 1]],

+ 10 - 1
app-hd/models/goods/UpdateForm.php

@@ -45,6 +45,12 @@ class UpdateForm extends BaseForm
      */
     public $flowerNum;
 
+    /**
+     * 重量
+     * @var float
+     */
+    public $weight;
+
     /**
      * 自动涨价
      * @var int
@@ -127,7 +133,8 @@ class UpdateForm extends BaseForm
             [['name', 'cover'], 'string'],
             [['price'], 'number', 'min' => 0, 'message' => '商品价格必须大于或等于0'],
             [['sold'], 'integer', 'min' => 0, 'message' => '已售数量必须大于或等于0'],
-            [['flowerNum'], 'integer', 'min' => 0, 'message' => '花朵数量必须大于或等于0'],
+            ['flowerNum', 'integer', 'min' => 0, 'message' => '花朵数量必须大于或等于0'],
+            ['weight', 'number', 'min' => 0, 'message' => '重量必须大于或等于0'],
             [['autoRise'], 'in', 'range' => [0, 1]],
             [['stockSet'], 'in', 'range' => [0, 1]],
             [['stock'], 'integer', 'min' => 0, 'message' => '库存不能小于0'],
@@ -143,6 +150,8 @@ class UpdateForm extends BaseForm
 
             // 默认值设置
             ['flowerNum', 'default', 'value' => 0],
+            ['weight', 'default', 'value' => 1],//当没有重量时,默认给1千克
+            ['setItemNum', 'default', 'value' => 0],// 在更新时,没传值,会为 NULL 而导致报错
             ['status', 'default', 'value' => 1],
             ['delStatus', 'default', 'value' => 0],
             ['categoryIdList', 'default', 'value' => []],

+ 0 - 2
biz-hd/goods/classes/GoodsClass.php

@@ -607,9 +607,7 @@ class GoodsClass extends BaseClass
         $mainId = $data['mainId'] ?? 0;
         $shopId = $data['shopId'] ?? 0;
         $status = $data['status'] ?? 0;
-        $delStatus = $data['delStatus'] ?? 0;
         $setItemNum = isset($data['setItemNum']) && is_numeric($data['setItemNum']) ? $data['setItemNum'] : $preSetItemNum;
-        $flowerNum = $data['flowerNum'] ?? 0;
         $categoryData = CategoryClass::getCategory($mainId);
         $hasCategoryIds = array_keys($categoryData);
         $diff = array_diff($categoryIdList, $hasCategoryIds);