Browse Source

Merge branch 'master' into zhongqi-quickOrder

shish 7 months ago
parent
commit
e832a9200b

+ 16 - 10
app-ghs/controllers/ProductController.php

@@ -172,10 +172,13 @@ class ProductController extends BaseController
         $num = floatval($num);
         $num = (int)$num;
         $type = $get['type'] ?? 0;
+        $priceOption = $get['priceOption'] ?? 0;
         $info = ProductClass::getById($id, true);
         if (empty($info)) {
             util::fail('没有找到花材');
         }
+        $price = $info->skPrice ?? 0;
+        $price = floatval($price);
         $name = $info->name ?? '';
         $ptItemId = $info->itemId ?? 0;
         $mainId = $info->mainId ?? 0;
@@ -185,9 +188,9 @@ class ProductController extends BaseController
             util::fail('请设置标签打印机');
         }
         $p = new printUtil($printLabelSn);
-        $unit = $info->ratio . $info->smallUnit . '/' . $info->bigUnit;
+        $unit = $info->ratio . $info->smallUnit . '装';
         if (isset($info->ratioType) && $info->ratioType == 1) {
-            $unit = '若干' . $info->smallUnit . '/' . $info->bigUnit;
+            $unit = '若干' . $info->smallUnit . '装';
         }
         $p->times = $num;
         if (stringUtil::getWordNum($name) > 8) {
@@ -203,8 +206,14 @@ class ProductController extends BaseController
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
             } elseif ($mainId == 16948) {
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+            } elseif ($mainId == 72057) {
+                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
             } else {
-                $content .= '<TEXT x="30" y="250" font="12" w="1" h="1" r="0">' . $unit . '</TEXT>';
+                if ($priceOption == 0) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                } else {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                }
             }
         } else {
             if (getenv('YII_ENV') == 'production') {
@@ -213,22 +222,19 @@ class ProductController extends BaseController
                 $doublePrice = [];
             }
             if (in_array($this->mainId, $doublePrice)) {
-                //打价格,显示正价和会员价
-                $price = $info->skPrice ?? 0;
-                $price = floatval($price);
+                //惠雅鲜花,打价格,显示正价和会员价,多处同步修改,关键词 hy_print_label_price ssh 20260101
                 $hyPrice = $info->price ?? 0;
                 $hyPrice = floatval($hyPrice);
                 $content .= '<TEXT x="35" y="90" font="12" w="2" h="2" r="0">----------</TEXT>';
                 $content .= '<TEXT x="35" y="150" font="12" w="2" h="2" r="0">正价 ' . $price . '元</TEXT>';
                 $content .= '<TEXT x="35" y="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';
-            } else {
+            } elseif ($this->mainId == 4556) {
                 //打价格,显示零售价,并且不带元,杭州斗南鲜花不要带元
-                $price = $info->skPrice ?? 0;
-                $price = floatval($price);
                 $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '</TEXT>';
+            } else {
+                $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '元</TEXT>';
             }
         }
-
         $p->printLabelMsg($content);
         util::complete();
     }

+ 27 - 12
app-ghs/controllers/PurchaseOrderController.php

@@ -179,6 +179,7 @@ class PurchaseOrderController extends BaseController
         $get = Yii::$app->request->get();
         $orderSn = $get['orderSn'] ?? 0;
         $type = $get['type'] ?? 0;
+        $priceOption = $get['priceOption'] ?? 0;
         $itemList = PurchaseOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
         if (empty($itemList)) {
             util::fail('没有商品');
@@ -213,13 +214,15 @@ class PurchaseOrderController extends BaseController
             $p->times = $num;
 
             $smallUnit = $item->smallUnit ?? '';
-            $bigUnit = $item->bigUnit ?? '';
             $ratio = $item->ratio ?? 0;
-            $unit = $ratio . $smallUnit . '/' . $bigUnit;
+            $unit = $ratio . $smallUnit . '装';
             if (isset($item->ratioType) && $item->ratioType == 1) {
-                $unit = '若干' . $smallUnit . '/' . $bigUnit;
+                $unit = '若干' . $smallUnit . '装';
             }
 
+            $price = $infoList[$productId] && $infoList[$productId]['skPrice'] ? $infoList[$productId]['skPrice'] : 0;
+            $price = floatval($price);
+
             if (stringUtil::getWordNum($name) > 8) {
                 $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
             } else {
@@ -234,23 +237,33 @@ class PurchaseOrderController extends BaseController
                     $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
                 } elseif ($mainId == 16948) {
                     $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+                } elseif ($mainId == 72057) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
                 } else {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                    if($priceOption == 0){
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                    }else{
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                    }
                 }
             } else {
                 if (getenv('YII_ENV') == 'production') {
-                    $printPrice = [4556];
+                    $doublePrice = [52, 1459];
                 } else {
-                    $printPrice = [644];
+                    $doublePrice = [];
                 }
-                if (in_array($this->mainId, $printPrice)) {
-                    //打价格
-                    $price = $infoList[$productId] && $infoList[$productId]['skPrice'] ? $infoList[$productId]['skPrice'] : 0;
-                    $price = floatval($price);
+                if (in_array($this->mainId, $doublePrice)) {
+                    //惠雅鲜花,打价格,显示正价和会员价,多处同步修改,关键词 hy_print_label_price ssh 20260101
+                    $hyPrice = $infoList[$productId] && $infoList[$productId]['price'] ? $infoList[$productId]['price'] : 0;
+                    $hyPrice = floatval($hyPrice);
+                    $content .= '<TEXT x="35" y="90" font="12" w="2" h="2" r="0">----------</TEXT>';
+                    $content .= '<TEXT x="35" y="150" font="12" w="2" h="2" r="0">正价 ' . $price . '元</TEXT>';
+                    $content .= '<TEXT x="35" y="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';
+                }elseif ($this->mainId == 4556) {
+                    //打价格,显示零售价,并且不带元,杭州斗南鲜花不要带元
                     $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '</TEXT>';
                 } else {
-                    $content .= '<QR x="35"  y="100"  e="L"  w="5">' . Yii::$app->params['mallHost'] . "/item/show-info?id=" . $productId . '</QR>';
-                    $content .= '<TEXT x="40" y="270" font="12" w="1" h="1" r="0">扫码看价格</TEXT>';
+                    $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '元</TEXT>';
                 }
             }
             $p->printLabelMsg($content);
@@ -312,6 +325,8 @@ class PurchaseOrderController extends BaseController
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
             } elseif ($mainId == 16948) {
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+            } elseif ($mainId == 72057) {
+                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
             } else {
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
             }

+ 2 - 1
app-ghs/controllers/TestController.php

@@ -452,7 +452,8 @@ class TestController extends BaseController
             //['name' => '宿州万花城鲜花', 'merchantNo' => '82237405992003F', 'wx' => [840725899, 840726149], 'zfb' => '2088180514587023'],
             //['name' => '蚌埠云采鲜花批发', 'merchantNo' => '82236305992003R', 'wx' => [840974082, 840973879], 'zfb' => '2088180525938209'],
             //['name' => '昆明源花汇鲜花', 'merchantNo' => '8227310599200Y7', 'wx' => [847054539, 847054222], 'zfb' => '2088180838553432'],
-            ['name' => '宝鸡美婷鲜花批发', 'merchantNo' => '82279305992004N', 'wx' => [847681058, 847680856], 'zfb' => '2088180872582801'],
+            //['name' => '宝鸡美婷鲜花批发', 'merchantNo' => '82279305992004N', 'wx' => [847681058, 847680856], 'zfb' => '2088180872582801'],
+            ['name' => '广州翰林花卉', 'merchantNo' => '8225810599201LR', 'wx' => [850644821, 850644094], 'zfb' => '2088280085826650'],
             ['name' => '深圳鼎盛皇室花卉', 'merchantNo' => '8225840599201MF', 'wx' => [807078304, 807076486], 'zfb' => '2088970117746334'],
             //['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],
             //['name' => '东莞惠雅鲜花(南城店)', 'merchantNo' => '8226020599200JK', 'wx' => [802315656, 802315755], 'zfb' => '2088870583889365'],

+ 19 - 7
app-hd/controllers/AuthController.php

@@ -7,6 +7,8 @@ use biz\shop\classes\ShopClass;
 use bizHd\admin\classes\ShopAdminClass;
 use bizHd\admin\services\ShopAdminService;
 use bizHd\admin\services\AdminService;
+use bizHd\member\classes\MemberLevelClass;
+use bizHd\recharge\classes\RechargeSqClass;
 use bizHd\user\classes\UserClass;
 use bizHd\wx\services\WxOpenService;
 use common\components\dict;
@@ -65,7 +67,7 @@ class AuthController extends PublicController
             //noticeUtil::push($cacheKey . " 登录失败了!获取手机号失败", '15280215347');
             util::success(['hasNoOpenId' => 1], '登录失败了哦');
         }
-        $cacheKey = 'getMobile_'.$phoneNumber;
+        $cacheKey = 'getMobile_' . $phoneNumber;
         Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 300, 1]);
         util::success(['mobile' => $phoneNumber]);
     }
@@ -166,6 +168,11 @@ class AuthController extends PublicController
             $shopAdmin->super = 0;
         }
 
+        //充值送钱有没设置,没有设置则进行设置,临时方法,后面需要去掉,有多处,关键词recharge_sq_init ssh 20251229
+        RechargeSqClass::initData($currentShop);
+        //会员等级有没设置,没有设置则进行设置,临时方法,后面需要去掉,有多处,关键词member_level_init ssh 20251229
+        MemberLevelClass::initData($currentShop);
+
         //涉及几个登录的地方,需要同步修改,请搜索关键词uni_login_info
         util::success([
             'token' => $token,
@@ -262,6 +269,11 @@ class AuthController extends PublicController
             $shopAdmin->super = 0;
         }
 
+        //充值送钱有没设置,没有设置则进行设置,临时方法,后面需要去掉,有多处,关键词recharge_sq_init ssh 20251229
+        RechargeSqClass::initData($currentShop);
+        //会员等级有没设置,没有设置则进行设置,临时方法,后面需要去掉,有多处,关键词member_level_init ssh 20251229
+        MemberLevelClass::initData($currentShop);
+
         //涉及几个登录的地方,需要同步修改,请搜索关键词uni_login_info
         util::success([
             'token' => $token,
@@ -595,12 +607,12 @@ class AuthController extends PublicController
         if (empty($openid)) {
             Yii::info(json_encode($arr));
             //没有管理店铺不允许登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>1]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 1]);
         }
         $admin = AdminService::getByCondition(['miniOpenId' => $openid]);
         if (empty($admin)) {
             //没有管理店铺不允许登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>2]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 2]);
         }
         $adminId = $admin['id'];
 
@@ -621,12 +633,12 @@ class AuthController extends PublicController
         $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             //没有管理店铺不允许登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>3]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 3]);
         }
         $currentShop = ShopClass::getById($currentShopId, true);
         if (empty($currentShop)) {
             //没有管理店铺不允许登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>4]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 4]);
         }
         $mainId = $currentShop->mainId ?? 0;
         $pfShopId = $currentShop->pfShopId ?? 0;
@@ -640,11 +652,11 @@ class AuthController extends PublicController
         $shopAdmin = ShopAdminClass::getByCondition(['mainId' => $mainId, 'adminId' => $adminId], true);
         if (empty($shopAdmin)) {
             //没有管理店铺不允许登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>5]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 5]);
         }
         if (isset($shopAdmin->status) == false || $shopAdmin->status == 0) {
             //账号冻结不再自动登录
-            util::success(['token' => '', 'currentMiniOpenId' => $openid,'sn'=>6]);
+            util::success(['token' => '', 'currentMiniOpenId' => $openid, 'sn' => 6]);
         }
         $shopAdmin->lastLogin = date("Y-m-d H:i:s");
         $shopAdmin->save();

+ 2 - 0
app-hd/controllers/ProductController.php

@@ -218,6 +218,8 @@ class ProductController extends BaseController
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
             } elseif ($mainId == 16948) {
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+            } elseif ($mainId == 72057) {
+                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
             } else {
                 $content .= '<TEXT x="30" y="250" font="12" w="1" h="1" r="0">' . $unit . '</TEXT>';
             }

+ 8 - 0
app-hd/controllers/PurchaseController.php

@@ -1006,6 +1006,14 @@ class PurchaseController extends BaseController
         $info['ghsMobile'] = $ghsShopInfo->telephone ?? '';
         $info['ghsMobile2'] = $ghsShopInfo->telephone2 ?? '';
         $info['hasRenew'] = 1;
+
+        //如果是快捷开单,则不需要显示累计待结,因为商家经常把快捷开单的订单发给客户结账
+        $showForPay = 1;
+        if ($ghsShopInfo->skCustomId == $info['customId']) {
+            $showForPay = 0;
+        }
+        $info['showForPay'] = $showForPay;
+
         util::success($info);
     }
 

+ 3 - 1
app-hd/controllers/RefundController.php

@@ -110,7 +110,9 @@ class RefundController extends BaseController
             if ($order->debt != 1 && $order->addTime < '2023-10-17 00:00:00') {
                 util::fail('2023年10月17日前订单无法申请退款');
             }
-
+            if ($order->status != 4) {
+                //util::fail('订单完成了才能售后');
+            }
             $addTime = $order->addTime ?? '';
             $current = time();
             if ($order->debt != 1 && (strtotime($addTime) + 3 * 30 * 24 * 60 * 60) < $current) {

+ 2 - 2
app-pt/views/main/app.php

@@ -236,8 +236,8 @@
             }
             // 这里可以根据appType跳转到对应的下载链接
             const downloadUrls = {
-                'xiaohuabao': 'https://api.shop.hzghd.com/1268.apk', // 销花宝APP下载链接
-                'huazhanggui': 'https://api.shop.hzghd.com/221.apk', // 花掌柜APP下载链接
+                'xiaohuabao': 'https://api.shop.hzghd.com/1270.apk', // 销花宝APP下载链接
+                'huazhanggui': 'https://api.shop.hzghd.com/222.apk', // 花掌柜APP下载链接
                 'huazhanggui_cashier': 'https://api.shop.hzghd.com/189.apk', // 花掌柜收银下载链接
                 'xiaohuabao_cashier': 'https://api.shop.hzghd.com/148.apk' // 销花宝收银下载链接
             };

+ 6 - 0
biz-ghs/order/classes/OrderClass.php

@@ -1809,6 +1809,12 @@ class OrderClass extends BaseClass
                     $showPrice = 0;
                 }
             }
+            //美婷鲜花批发,线上下单,不显示价格
+            if (isset($orderInfo->mainId) && $orderInfo->mainId == 73125) {
+                if (!empty($orderInfo->customShopAdminId)) {
+                    $showPrice = 0;
+                }
+            }
             //淄博花超鲜花小票不带价格
             if (isset($orderInfo->mainId) && $orderInfo->mainId == 16293) {
                 $showPrice = 0;

+ 59 - 57
biz-mall/coupon/classes/CouponClass.php

@@ -10,61 +10,63 @@ use bizMall\base\classes\BaseClass;
 
 class CouponClass extends BaseClass
 {
-	
-	public static $baseFile = '\bizMall\coupon\models\Coupon';
-	
-	//获取客户没有使用的优惠券,默认取最新的6张
-	public static function getUnUseCoupon($userId, $num = 6)
-	{
-		$time = time();
-		return self::getLimitList('*', ['userId' => $userId, 'status' => 0, 'deadline>' => $time], $num, 'addTime DESC');
-	}
-	
-	//使用优惠券 ssh 2020.3.10
-	public static function useCoupon($couponId, $orderId)
-	{
-		if (empty($couponId)) {
-			return false;
-		}
-		$coupon = self::getById($couponId, true);
-		if (empty($coupon)) {
-			return false;
-		}
-		$coupon->status = 1;
-		$coupon->orderId = $orderId;
-		$coupon->save();
-		
-		//老带新获得的优惠券
-		if ($coupon->source == 1) {
-			$time = time();
-			$sourceId = $coupon->sourceId;
-			$invite = InviteClass::getById($sourceId, true);
-			if (!empty($invite)) {
-				$invite->status = 1;
-				$invite->orderTime = $time;
-				$invite->save();
-				//下单人数+1
-				$introUserId = $invite->introUserId;
-				$introStat = InviteStatClass::getByCondition(['userId' => $introUserId], true);
-				if (!empty($introStat)) {
-					$introStat->orderNum += 1;
-					$introStat->save();
-				}
-			}
-		}
-	}
-	
-	//增加优惠券 ssh 2020.5.5
-	public static function add($data, $returnObject = false)
-	{
-		$model = Yii::createObject(['class' => static::$baseFile]);
-		$model->add($data, $returnObject);
-		//领券次数增加
-		$userId = $data['userId'];
-		$userAsset = $userAsset = UserAssetClass::getByUserId($userId);
-		$getCouponNum = $userAsset['getCouponNum'];
-		$getCouponNum++;
-		UserAssetClass::updateByUserId($userId, ['getCouponNum' => $getCouponNum]);
-	}
-	
+
+    public static $baseFile = '\bizMall\coupon\models\Coupon';
+
+    //获取客户没有使用的优惠券,默认取最新的6张
+    public static function getUnUseCoupon($userId, $num = 6)
+    {
+        $time = time();
+        //return self::getLimitList('*', ['userId' => $userId, 'status' => 0, 'deadline>' => $time], $num, 'addTime DESC');
+        //deadline字段去掉了
+        return self::getLimitList('*', ['userId' => $userId, 'status' => 0], $num, 'addTime DESC');
+    }
+
+    //使用优惠券 ssh 2020.3.10
+    public static function useCoupon($couponId, $orderId)
+    {
+        if (empty($couponId)) {
+            return false;
+        }
+        $coupon = self::getById($couponId, true);
+        if (empty($coupon)) {
+            return false;
+        }
+        $coupon->status = 1;
+        $coupon->orderId = $orderId;
+        $coupon->save();
+
+        //老带新获得的优惠券
+        if ($coupon->source == 1) {
+            $time = time();
+            $sourceId = $coupon->sourceId;
+            $invite = InviteClass::getById($sourceId, true);
+            if (!empty($invite)) {
+                $invite->status = 1;
+                $invite->orderTime = $time;
+                $invite->save();
+                //下单人数+1
+                $introUserId = $invite->introUserId;
+                $introStat = InviteStatClass::getByCondition(['userId' => $introUserId], true);
+                if (!empty($introStat)) {
+                    $introStat->orderNum += 1;
+                    $introStat->save();
+                }
+            }
+        }
+    }
+
+    //增加优惠券 ssh 2020.5.5
+    public static function add($data, $returnObject = false)
+    {
+        $model = Yii::createObject(['class' => static::$baseFile]);
+        $model->add($data, $returnObject);
+        //领券次数增加
+        $userId = $data['userId'];
+        $userAsset = $userAsset = UserAssetClass::getByUserId($userId);
+        $getCouponNum = $userAsset['getCouponNum'];
+        $getCouponNum++;
+        UserAssetClass::updateByUserId($userId, ['getCouponNum' => $getCouponNum]);
+    }
+
 }

+ 3 - 1
common/components/book.php

@@ -98,7 +98,9 @@ class book
         'chargeStandard' => [
             ['style' => 'info', 'value' => '软件年费1580元,年费需每年付一次,客户通过小程序下单,会扣0.33手续费,即100元扣3毛3。',],
             ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国200家鲜花批发店和11万家花店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
-            ['style' => 'miniTitle', 'value' => '软件的研发成本巨大,不管是年费、费率和套餐,都已经底价,没有商量的空间,请理解。付费后不支持退货。',],
+            ['style' => 'miniTitle', 'value' => '软件的研发成本巨大,不管是年费、费率和套餐,都已经底价,已无商谈的空间,请理解。付费后不支持退货。',],
+            ['style' => 'miniTitle', 'value' => '以下硬件请通过我们来购买,公司统一跟厂家采购,售后各方面比较有保障。自行采购的,使用和售后有问题的,请自行解决。',],
+            ['style' => 'info', 'value' => '小票机和标签机,使用的是飞鹅4G带切刀版本,比较好维护,里面带电话卡的,第二年开始,每年要充60块话费。请不要贪便宜使用wifi版,公司将拒绝提供技术支持,因为很容易出问题,维护成本很高。',],
             ['style' => 'info', 'value' => '提供上门培训服务,培训时间3天,需报销差旅住宿费用,公司地址在福建厦门。',],
             ['style' => 'smallTitle', 'value' => '仓库版',],
             ['style' => 'info', 'value' => '整套软件功能(一年)',],

+ 8 - 5
common/components/jwt.php

@@ -33,7 +33,7 @@ class jwt
 		->identifiedBy($jwtId, true)//该jwt的唯一ID编号
 		->issuedAt($time)//该jwt的发布时间
 		->canOnlyBeUsedAfter($time)//该jwt的使用时间不能早于该时间
-		->expiresAt($time + 31536000)//该jwt销毁的时间(1年)
+		->expiresAt($time + 94608000)//该jwt销毁的时间(3年)
 		->set('uniqueId', $uniqueId)
 			->set('sourceId', $sourceId)
 			->sign($signer, $key)->getToken();
@@ -53,10 +53,10 @@ class jwt
 		//数据校验
 		$data = new ValidationData();//使用当前时间来校验数据
 		
-		if (!$token->validate($data)) {
-			Yii::info('token时间验证没有通过。token:' . $token);
-			return 0;
-		}
+//		if (!$token->validate($data)) {
+//			Yii::info('token时间验证没有通过。token:' . $token);
+//			return 0;
+//		}
 		//token校验
 		$signer = new Sha256();//生成JWT时使用的加密方式
 		$salt = Yii::$app->params['secretKey'];
@@ -72,6 +72,9 @@ class jwt
 		if ($sourceId != $currentSourceId) {
 			return 0;
 		}
+        if (!$token->validate($data)) {
+            Yii::info('token时间验证没有通过,但还是返回了uniqueId:'.$uniqueId.'。 token:' . $token);
+        }
 		return $uniqueId;
 	}
 	

+ 29 - 19
common/components/push.php

@@ -1,6 +1,8 @@
 <?php
+
 namespace common\components;
 
+use bizGhs\custom\classes\CustomClass;
 use yii\db\ActiveRecord;
 use Yii;
 
@@ -22,7 +24,8 @@ class push
     private $client = '';
     private $msgType = '';
 
-    public function __construct($client, $msgType) {
+    public function __construct($client, $msgType)
+    {
         $this->client = $client;
         if ($client == 'ghs') {
             $this->url = self::GHS_URL;
@@ -38,7 +41,8 @@ class push
      * 实现部分厂商特定功能,包括仅部分厂商支持、不常用或厂商临时新增的功能(不依赖 uni-push,厂商文档支持的参数可直接使用)。
      * 例如:推送渠道 ID、消息分类(部分厂商未配置时可能被限量推送或静默推送,即静音且需下拉系统通知栏才可见通知内容)、通知栏富文本
      */
-    public function getOptions($client) {
+    public function getOptions($client)
+    {
         if ($client == 'ghs') {
             return $this->initGhsOptions();
         }
@@ -50,11 +54,12 @@ class push
      * 花店的厂商options
      * @return array
      */
-    public function initHdOptions() {
+    public function initHdOptions()
+    {
         $optionsArr = [];
         switch ($this->msgType) {
             case self::MSG_TYPE_ORDER:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142737" //小米后台申请的通知类别id -- https://admin.xmpush.xiaomi.com/zh_CN/channel/list?appId=2882303761520146676
@@ -69,7 +74,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_LOGISTICS:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142737"
@@ -84,7 +89,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_ACCOUNT:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "143019"
@@ -99,7 +104,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_WORK:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "143018"
@@ -114,7 +119,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_SUBSCRIPTION:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "0" // TODO 暂无
@@ -143,11 +148,12 @@ class push
      * 批发商的厂商options
      * @return array
      */
-    public function initGhsOptions() {
+    public function initGhsOptions()
+    {
         $optionsArr = [];
         switch ($this->msgType) {
             case self::MSG_TYPE_ORDER:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142743" //小米后台申请的通知类别id -- https://admin.xmpush.xiaomi.com/zh_CN/channel/list?appId=2882303761520146676
@@ -162,7 +168,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_LOGISTICS:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142744"
@@ -177,7 +183,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_ACCOUNT:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142895"
@@ -192,7 +198,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_WORK:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "142892"
@@ -207,7 +213,7 @@ class push
                 ];
                 break;
             case self::MSG_TYPE_SUBSCRIPTION:
-                $optionsArr = [ "android" =>
+                $optionsArr = ["android" =>
                     [
                         "XM" => [
                             "/extra.channel_id" => "0" // TODO 暂无
@@ -231,9 +237,9 @@ class push
 
         $optionsArr = $this->getOptions($this->client);
         // 测试环境的特殊处理
-        if ( getenv('YII_ENV') == 'dev') {
+        if (getenv('YII_ENV') == 'dev') {
             $optionsArr["android"]["HW"]["/message/android/target_user_type"] = 1; //华为 -- 值为int 类型。1 表示华为测试消息,华为每个应用每日可发送该测试消息500条,此target_user_type 参数请勿发布至线上。
-            $optionsArr["android"]["VV"]["/pushMode"] =  1;                 //VIVO  --  值为int 类型。0 表示正式推送;1 表示测试推送,不填默认为0。线上请勿使用测试推送
+            $optionsArr["android"]["VV"]["/pushMode"] = 1;                 //VIVO  --  值为int 类型。0 表示正式推送;1 表示测试推送,不填默认为0。线上请勿使用测试推送
             $optionsArr["android"]["HO"]["/android/targetUserType"] = 1;    //荣耀  -- 值为int 类型。1 表示测试推送,不填默认为0。荣耀每个应用每日可发送该测试消息1000条。此测试参数请勿发布至线上。
         }
 
@@ -285,11 +291,15 @@ class push
     public function ghsOrderMessage($shop, $cgShop, $order)
     {
         try {
-            $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId'=>$shop->id]);
+            $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId' => $shop->id]);
             $cids = array_column($allDevices, 'clientId');
             $title = '你有新的订单';
-            $shopName = $cgShop->merchantName . ($cgShop->shopName != '首店' ? '(' . $cgShop->shopName . ')' : '');
-            $content = $shopName . ' ¥' . $order->actPrice;
+
+            $customId = $order->customId ?? 0;
+            $custom = CustomClass::getById($customId, true);
+            $customName = $custom->name ?? '';
+            $actPrice = $order->actPrice ? floatval($order->actPrice) : 0;
+            $content = $customName . ' ¥' . $actPrice;
             $payload = [
                 "page" => "pagesOrder/detail",
                 "params" => ["id" => $order->id]