Răsfoiți Sursa

Merge branch 'master' into zhongqi-chat

shish 11 luni în urmă
părinte
comite
9a3d287b8d

+ 8 - 5
app-ghs/controllers/OrderController.php

@@ -704,20 +704,23 @@ class OrderController extends BaseController
             util::success(['returnStatus' => 'FAILURE'], $msg);
         }
 
-
         $codePayErrorKey = 'code_pay_error_' . $id;
         $hasFailPay = Yii::$app->redis->executeCommand('GET', [$codePayErrorKey]);
         //前面有付失败过,要重新生成单号
         if (!empty($hasFailPay)) {
             $oldOrderSn = $orderSn;
-            $orderSn = orderSn::getPurchaseSn();
+            $shopId = $cg->shopId ?? 0;
+            $mainId = $cg->mainId ?? 0;
+            $ghsId = $cg->ghsId ?? 0;
+            $customId = $cg->customId ?? 0;
+            $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'customId' => $customId];
+            $orderSn = orderSn::getPurchaseSn($snData);
             $cg->orderSn = $orderSn;
             $cg->save();
             //noticeUtil::push("重新扫码,成功更换单号 {$oldOrderSn} {$orderSn}", '15280215347');
             PurchaseItemClass::updateByCondition(['orderSn' => $oldOrderSn], ['orderSn' => $orderSn]);
         }
 
-
         $shop = $this->shop;
         $sj = $shop->merchantName;
         $shopName = $shop->shopName;
@@ -1033,7 +1036,7 @@ class OrderController extends BaseController
         $modifyPrice = $post['modifyPrice'] ?? 0;
         $pattern = '/^\d+(\.\d{1,2})?$/';
         if ($modifyPrice > 0) {
-            if (preg_match($pattern, $modifyPrice) == false) {
+            if (!preg_match($pattern, $modifyPrice)) {
                 //容错前端
                 util::fail('金额不能超2位小数');
             }
@@ -1174,7 +1177,7 @@ class OrderController extends BaseController
             $post['debt'] = OrderClass::DEBT_YES;
         }
 
-        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+        if (!isset($shopAdmin->super) || $shopAdmin->super != 1) {
             if ($hasPay == dict::getDict('hasPay', 'payed')) {
                 //util::fail('没有权限');
             }

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

@@ -1011,70 +1011,12 @@ class TestController extends BaseController
 
     public function actionAliRun2()
     {
-        $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
-        $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
-        $params = [
-            'appid' => 'OP00002119',
-            'serial_no' => '018b08cfddbd',
-            'merchant_no' => '82240505992000N',
-            'term_no' => 'C6337694',
-            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
-            'lklCertificatePath' => $lklCertificatePath,
-        ];
-        $outTradeNo = orderSn::getPurchaseSn();
-        $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
-        $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
-        $aliParams = [
-            'orderSn' => $outTradeNo,
-            'amount' => 0.16,
-            'capitalType' => $currentCapitalType,
-            'notifyUrl' => $notifyUrl,
-        ];
-        $laResource = new Lakala($params);
-        $response = $laResource->driveAliPay($aliParams);
-        if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
-            echo '<pre>';
-            echo "下单成功<br/>";
-            print_r($response);
-        } else {
-            echo '<pre>';
-            echo "下单失败<br/>";
-            print_r($response);
-        }
+
     }
 
     public function actionAliRun3()
     {
-        $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
-        $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
-        $params = [
-            'appid' => 'OP00002119',
-            'serial_no' => '018b08cfddbd',
-            'merchant_no' => '82240505992000N',
-            'term_no' => 'C6337694',
-            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
-            'lklCertificatePath' => $lklCertificatePath,
-        ];
-        $laResource = new Lakala($params);
-        $outTradeNo = orderSn::getPurchaseSn();
-        $notifyUrl = Yii::$app->params['hdHost'] . "/notice/pay-callback";
-        $currentCapitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
-        $wxParams = [
-            'orderSn' => $outTradeNo,
-            'amount' => 0.16,
-            'capitalType' => $currentCapitalType,
-            'notifyUrl' => $notifyUrl,
-        ];
-        $response = $laResource->driveWxPay($wxParams);
-        if ($response && isset($response['cmdRetCode']) && $response['cmdRetCode'] == 'GLOBAL_SUCCESS') {
-            echo '<pre>';
-            echo "下单成功<br/>";
-            print_r($response);
-        } else {
-            echo '<pre>';
-            echo "下单失败<br/>";
-            print_r($response);
-        }
+
     }
 
     //dada 城市code

+ 10 - 4
app-hd/controllers/ApplyController.php

@@ -128,6 +128,12 @@ class ApplyController extends BaseController
 
             $post = Yii::$app->request->post();
 
+            //前期限制只有批发店邀请了才能注册
+            $ghsShopAdminId = $post['ghsShopAdminId'] ?? 0;
+            if (empty($ghsShopAdminId)) {
+                util::fail('批发店推荐才能注册');
+            }
+
             $shopName = $post['name'] ?? '';
             if (empty($shopName)) {
                 util::fail('名称不能为空');
@@ -172,7 +178,7 @@ class ApplyController extends BaseController
             $cacheKey = 'register_mobile_code_' . $ptStyle . '_' . $mobile;
             $saveAuthCode = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
 
-            if($fillMobile == 1){
+            if ($fillMobile == 1) {
                 if ($authCode != 19640123) {
                     if (empty($saveAuthCode)) {
                         util::fail('请填写验证码哦');
@@ -184,10 +190,10 @@ class ApplyController extends BaseController
                         util::fail('验证码错误');
                     }
                 }
-            }else{
-                $cacheKey = 'getMobile_'.$mobile;
+            } else {
+                $cacheKey = 'getMobile_' . $mobile;
                 $hasGet = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
-                if(empty($hasGet)){
+                if (empty($hasGet)) {
                     util::fail('请获取手机');
                 }
             }

+ 0 - 1
app-hd/controllers/CustomController.php

@@ -18,7 +18,6 @@ use common\components\wxUtil;
 use common\services\xhMerchantExtendService;
 use common\services\xhRechargeService;
 use common\services\xhTMessageService;
-use common\services\xhUserIntegralService;
 use Yii;
 use common\components\stringUtil;
 use common\components\util;

+ 3 - 2
app-hd/controllers/IntraCityController.php

@@ -335,7 +335,7 @@ class IntraCityController extends BaseController
             util::checkRepeatCommit($adminId, 4);
 
             $orderId = $post['orderId'];
-            $field = 'mainId, status, sendStatus, repeat, forward, orderSn, userId, actPrice, sendNum';
+            $field = 'mainId, status, sendStatus, repeat, forward, orderSn, userId, actPrice, sendNum, salt';
             $order = OrderClass::getById($orderId, false, $field);
             if (empty($order)) {
                 util::fail('没有找到订单');
@@ -360,6 +360,7 @@ class IntraCityController extends BaseController
             }
 
             $sn = $order['orderSn'];
+            $salt = $order['salt'] ?? "";
             $itemInfoList = OrderItemClass::getListBySn($sn, 'id, name, cover, num');
             $itemList = [];
             $orderType = 2; // 默认是 2。说明:1花束订单 2花材订单 3花束和花材都有
@@ -457,7 +458,7 @@ class IntraCityController extends BaseController
                 'user_phone' => $post['user_phone'],
                 'order_seq' => $order['sendNum'], // 用于配送员快速寻找到匹配的商品(非必传) -- 对应 xhOrder 表的 sendNum
                 'verify_code_type' => 0,
-                'order_detail_path' => '/admin/order/detail?id=' . $orderId, // TODO 使用花掌柜的地址,后期要重新选个地址
+                'order_detail_path' => '/admin/order/info?id=' . $orderId . '&salt=' . $salt,
                 'callback_url' => $callbackUrl, // 订单状态回调地址(非必传)
                 //'use_sandbox' => getenv('YII_ENV') == 'production' ? 0 : 1, // 是否使用沙箱(非必传)
                 'cargo' => $cargo

+ 7 - 1
app-hd/controllers/MemberLevelController.php

@@ -89,7 +89,13 @@ class MemberLevelController extends BaseController
                     'name' => $name,
                     'amount' => $amount,
                 ];
-                MemberLevelClass::add($it, true);
+                $has = MemberLevelClass::getByCondition(['mainId' => $mainId, 'level' => $level], true);
+                if (!empty($has)) {
+                    $has->amount = $amount;
+                    $has->save();
+                } else {
+                    MemberLevelClass::add($it, true);
+                }
             }
             $shop->memberLevelSet = 1;
             $shop->save();

+ 13 - 7
app-hd/controllers/MemberWealController.php

@@ -72,18 +72,16 @@ class MemberWealController extends BaseController
         if (empty($data)) {
             util::fail('请填写内容');
         }
+        $shopId = $this->shopId;
+        $mainId = $this->mainId;
 
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
-
-            $shopId = $this->shopId;
-            $mainId = $this->mainId;
-
             //验证recharge和give值递增
             $prevRecharge = -1;
             $prevGive = -1;
-            foreach ($data as $item) {
+            foreach ($data as $key => $item) {
                 $currentRecharge = floatval($item['recharge'] ?? 0);
                 $currentGive = floatval($item['give'] ?? 0);
                 if ($currentRecharge <= $prevRecharge) {
@@ -94,8 +92,16 @@ class MemberWealController extends BaseController
                 }
                 $prevRecharge = $currentRecharge;
                 $prevGive = $currentGive;
-                $add = ['shopId' => $shopId, 'mainId' => $mainId, 'recharge' => $currentRecharge, 'give' => $currentGive];
-                MemberWealClass::add($add, true);
+                $sn = $key + 1;
+                $add = ['shopId' => $shopId, 'mainId' => $mainId, 'recharge' => $currentRecharge, 'give' => $currentGive, 'sn' => $sn];
+                $has = MemberWealClass::getByCondition(['mainId' => $mainId, 'sn' => $sn], true);
+                if (!empty($has)) {
+                    $has->recharge = $currentRecharge;
+                    $has->give = $currentGive;
+                    $has->save();
+                } else {
+                    MemberWealClass::add($add, true);
+                }
             }
             $shop->rechargeWeal = 1;
             $shop->save();

+ 24 - 2
app-hd/controllers/OrderController.php

@@ -36,7 +36,7 @@ use common\components\lakala\Lakala;
 class OrderController extends BaseController
 {
 
-    public $guestAccess = ['order-relate', 'fast-pay', 'create-order', 'list'];
+    public $guestAccess = ['order-relate', 'fast-pay', 'create-order', 'list', 'info'];
 
     public function actionDebt()
     {
@@ -1096,7 +1096,29 @@ class OrderController extends BaseController
         util::complete('提交成功');
     }
 
-    //订单详情 ssh 2019.12.16
+    //订单详情,不需要登陆可以查看,要有盐,给跑腿上查看订单信息用的
+    public function actionInfo()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $salt = $get['salt'] ?? '';
+        $detail = OrderClass::getFullInfo($id);
+        if (empty($detail)) {
+            util::fail('没有找到订单');
+        }
+        if (empty($detail['salt'])) {
+            util::fail('没有找到订单信息');
+        }
+        if (empty($salt)) {
+            util::fail('请求参数错误');
+        }
+        if ($detail['salt'] != $salt) {
+            util::fail('不是你的订单');
+        }
+        util::success($detail);
+    }
+
+    //订单详情
     public function actionDetail()
     {
         $id = Yii::$app->request->get('id', 0);

+ 6 - 1
app-hd/controllers/ProductController.php

@@ -122,11 +122,16 @@ class ProductController extends BaseController
         //扫码收款、直接收款和特价商品,不可删除,多处要同步修改 system_item
         if (getenv('YII_ENV') == 'production') {
             $systemItem = [78076, 80960, 81004];
+            $adminList = [4, 1960];
         } else {
             $systemItem = [11157, 11156, 11158];
+            $adminList = [919, 932];
         }
         if (in_array($product->itemId, $systemItem)) {
-            util::fail('系统花材,不可删除');
+            $adminId = $this->adminId;
+            if (!in_array($adminId, $adminList)) {
+                util::fail('系统花材,不可删除');
+            }
         }
 
         $product->delStatus = $delStatus;

+ 11 - 99
app-hd/controllers/PurchaseController.php

@@ -1039,8 +1039,12 @@ class PurchaseController extends BaseController
                     noticeUtil::push('注意花店买花更换单号:' . $oldOrderSn . ',关单没有成功(收银台-支付宝),' . $msg, '15280215347');
                 }
             }
-
-            $newOrderSn = orderSn::getPurchaseSn();
+            $shopId = $order->shopId ?? 0;
+            $mainId = $order->mainId ?? 0;
+            $customId = $order->customId ?? 0;
+            $ghsId = $order->ghsId ?? 0;
+            $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'customId' => $customId, 'ghsId' => $ghsId];
+            $newOrderSn = orderSn::getPurchaseSn($snData);
             $orderSn = $newOrderSn;
             $order->orderSn = $newOrderSn;
             $order->save();
@@ -1171,7 +1175,11 @@ class PurchaseController extends BaseController
                 }
             }
 
-            $newOrderSn = orderSn::getPurchaseSn();
+            $shopId = $order->shopId ?? 0;
+            $mainId = $order->mainId ?? 0;
+            $customId = $order->customId ?? 0;
+            $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'customId' => $customId, 'ghsId' => $ghsId];
+            $newOrderSn = orderSn::getPurchaseSn($snData);
             $orderSn = $newOrderSn;
             $order->orderSn = $newOrderSn;
             $order->save();
@@ -1303,102 +1311,6 @@ class PurchaseController extends BaseController
     {
         //lqh 2021.6.25 运费固定返回0
         util::success(['sedCost' => 0]);
-        $post = Yii::$app->request->post();
-        $ghsId = $post['ghsId'] ?? 0;
-        //供货商
-        $ghsInfo = GhsClass::getById($ghsId);
-
-        if (empty($ghsInfo)) {
-            util::fail('没有找到供货商');
-        }
-        //花材信息
-        $productJson = $post['product'] ?? '';
-        // $productJson = '[{"productId":31993,"bigNum":1,"smallNum":0}]';
-        if (empty($productJson)) {
-            util::fail('请选择花材');
-        }
-        $productList = json_decode($productJson, true);
-        if (empty($productList)) {
-            util::fail('请选择花材25');
-        }
-
-        $productList = PurchaseClass::mergeItemInfo($productList);
-        $weight = 0;
-        $price = 0;
-        $productData = ProductClass::getProductMapData($productList);
-        $bigNum = 0;
-        foreach ($productList as $key => $val) {
-            $productId = $val['productId'];
-            $w = ProductClass::getWeight($val['productId'], $val['bigNum'], $val['smallNum']);
-            $bigNum += $val['bigNum'];
-            $weight = bcadd($w, $weight, 2);
-            $ratio = $productData[$productId]['ratio'] ?? 0;
-            //大小数量合并多少扎
-            $itemNum = ProductClass::mergeItemNum($val['bigNum'], $val['smallNum'], $ratio);
-            //售卖价格
-            $itemPrice = $productData[$productId]['price'] ?? 0;
-            //合计价格
-            $price = bcadd($price, bcmul($itemNum, $itemPrice, 2), 2);
-        }
-        $ghsShopId = $ghsInfo['shopId'] ?? 0;
-        $ghsSjId = $ghsInfo['sjId'] ?? 0;
-
-        $sendTime = $post['sendTime'] ?? '';
-        if (!empty($sendTime)) {
-            //配送时间不为空
-            // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
-            $sendTimeInt = strtotime($sendTime);
-            $now = time();
-            $diff = $sendTimeInt - $now;
-            //因服务器写入时间,改为至少提前6分钟
-            if ($diff <= 360) {
-                util::fail('配送时间至少提前6分钟');
-            }
-            $sendTime = date('Y-m-d H:i', strtotime($sendTime));
-        } else {
-            $sendTime = date('Y-m-d H:i', strtotime("+30 minute"));
-        }
-
-        //找供货商的客户信息,用里面的配送相关地址信息
-        $customId = $ghsInfo['customId'] ?? 0;
-        $customInfo = CustomClass::getById($customId);
-        if (empty($customInfo)) {
-            util::fail('没有找到客户');
-        }
-
-        //判断商家是否开启达达,若未开启,则使用自定义运费计算
-        $shopNo = ShopExpressClass::getShopNo($ghsSjId, $ghsShopId);
-        if (!$shopNo) {
-            //使用自定义运费
-            //util::fail('供货商暂未开通配送');
-            $cost = freight::getCost($ghsInfo['lat'], $ghsInfo['long'], $customInfo['lat'], $customInfo['long'], $weight);
-            util::success(['sedCost' => $cost]);
-        }
-        //组装订单信息
-        $info = [];
-        //发送放的商家信息,即供货商的相关信息
-        $info['sjId'] = $ghsSjId;
-        $info['shopId'] = $ghsShopId;
-        $info['actPrice'] = $price;//价格
-        $info['weight'] = $weight;
-        $info['orderSn'] = \common\components\orderSn::getGhsOrderSn();
-        $info['bigNum'] = $bigNum;
-
-        //配送地址,当前零售端的门店地址
-        $info['customName'] = $customInfo['name'] ?? '';
-        $info['customMobile'] = $customInfo['mobile'] ?? '';
-        $info['province'] = $customInfo['province'] ?? '';
-        $info['city'] = $customInfo['city'] ?? '';;
-        $info['address'] = $customInfo['address'] ?? '';;
-        $info['floor'] = $customInfo['floor'] ?? '';;
-        $info['fullAddress'] = $customInfo['fullAddress'] ?? '';;
-        $info['lat'] = $customInfo['lat'] ?? '';;
-        $info['long'] = $customInfo['long'] ?? '';;
-        $info['sendTime'] = $sendTime;
-
-        $res = DadaExpressServices::queryDeliverFee($info);
-        util::success(['sedCost' => $res['fee']]);
-
     }
 
 }

+ 7 - 1
biz-ghs/order/classes/OrderClass.php

@@ -782,7 +782,13 @@ class OrderClass extends BaseClass
     //添加订单 ssh 2019.12.5
     public static function addOrder($data)
     {
-        $orderSn = orderSn::getGhsOrderSn();
+        $shopId = $data['shopId'] ?? 0;
+        $mainId = $data['mainId'] ?? 0;
+        $ghsId = $data['ghsId'] ?? 0;
+        $customId = $data['customId'] ?? 0;
+        $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'customId' => $customId];
+        $orderSn = orderSn::getGhsOrderSn($snData);
+
         $data['orderSn'] = $orderSn;
         $data['payStatus'] = self::PAY_STATUS_UN_PAY;
         $data['customId'] = isset($data['customId']) && !empty($data['customId']) ? $data['customId'] : 0;

+ 5 - 1
biz-ghs/product/classes/ProductClass.php

@@ -1466,11 +1466,15 @@ class ProductClass extends BaseClass
         //扫码收款、直接收款,不包括特价商品,不可修改,多处要同步修改 system_item
         if (getenv('YII_ENV') == 'production') {
             $systemItem = [78076, 80960];
+            $adminList = [4, 1960];
         } else {
             $systemItem = [11157, 11156];
+            $adminList = [919, 932];
         }
         if (in_array($product->itemId, $systemItem)) {
-            util::fail('系统花材,不可修改');
+            if (!in_array($adminId, $adminList)) {
+                util::fail('系统花材,不可修改');
+            }
         }
 
         $name = $product->name ?? '';

+ 6 - 9
biz-hd/custom/classes/CustomClass.php

@@ -7,6 +7,7 @@ use bizHd\balance\classes\BalanceChangeClass;
 use bizHd\balance\classes\BalanceGiveChangeClass;
 use bizHd\balance\classes\BalancePayChangeClass;
 use bizHd\member\classes\MemberChangeClass;
+use bizHd\member\classes\MemberLevelClass;
 use bizHd\member\classes\MemberWealClass;
 use bizHd\order\classes\OrderClass;
 use bizHd\order\classes\SettleClass;
@@ -185,14 +186,13 @@ class CustomClass extends BaseClass
         $staffName = $params['staffName'] ?? '';
         $style = $params['style'] ?? 0;
         $target = $params['target'] ?? [];
-        $onlinePay = $params['onlinePay'] ?? 1;
         $rechargeAmount = $params['rechargeAmount'] ?? 0;
         $targetId = $target->id ?? 0;
         $mainId = $shop->mainId;
         $shopId = $shop->id;
-        $weal = MemberWealClass::getAllByCondition(['mainId' => $mainId], null, '*', 'level');
-        $current = $weal[$newLevel] ?? [];
-        $before = $weal[$oldLevel] ?? [];
+        $levelData = MemberLevelClass::getAllByCondition(['mainId' => $mainId], null, '*', 'level');
+        $current = $levelData[$newLevel] ?? [];
+        $before = $levelData[$oldLevel] ?? [];
         $beforeName = $before['name'] ?? '普通客户';
         $discount = $current['discount'] ?? 1;
         $memberName = $current['name'] ?? '';
@@ -209,11 +209,7 @@ class CustomClass extends BaseClass
 
         $event = '手动修改';
         if ($style == 0) {
-            if ($onlinePay == 2) {
-                $event = '线上充值' . $rechargeAmount . '元';
-            } else {
-                $event = '线下充值' . $rechargeAmount . '元';
-            }
+            util::fail('充值不支持升级会员');
         }
 
         $change = [
@@ -763,6 +759,7 @@ class CustomClass extends BaseClass
             $avatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_800,w_800";
             $smallAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
             $bigAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+            $list[$key]['shortAvatar'] = $shortAvatar;
             $list[$key]['avatar'] = $avatar;
             $list[$key]['smallAvatar'] = $smallAvatar;
             $list[$key]['bigAvatar'] = $bigAvatar;

+ 1 - 1
biz-hd/member/models/MemberWeal.php

@@ -7,7 +7,7 @@ class MemberWeal extends Base
 
     public static function tableName()
     {
-        return 'xhMemberWeal';
+        return 'xhMemberRecharge';
     }
 
 }

+ 11 - 5
biz-hd/message/services/ChatService.php

@@ -8,6 +8,7 @@ use bizHd\message\classes\ChatClass;
 use bizHd\user\classes\UserClass;
 use bizHd\user\services\UserService;
 use common\components\arrayUtil;
+use common\components\imgUtil;
 use Yii;
 
 class ChatService extends BaseService
@@ -190,8 +191,13 @@ class ChatService extends BaseService
         $ids = array_column($arr, 'cId');
         $infoList = CustomClass::getByIds($ids, null, null, 'id,name,mobile,avatar,shopId,userId');
         foreach ($infoList as $customId => $info) {
-            $infoList[$customId]['unReadNum'] = isset($userData[$info['id']]['unReadNum']) ? $userData[$info['id']]['unReadNum'] : 0;
-            $infoList[$customId]['chatTime'] = isset($userData[$info['id']]['time']) ? $userData[$info['id']]['time'] : 0;
+            $infoList[$customId]['unReadNum'] = $userData[$info['id']]['unReadNum'] ?? 0;
+            $infoList[$customId]['chatTime'] = $userData[$info['id']]['time'] ?? 0;
+            //头像
+            $shortAvatar = $info['avatar'] ?? '';
+            $smallAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
+            $infoList[$customId]['shortAvatar'] = $shortAvatar;
+            $infoList[$customId]['smallAvatar'] = $smallAvatar;
         }
         $infoList = arrayUtil::arraySort($infoList, 'chatTime', SORT_DESC);
         return array_values($infoList);
@@ -228,7 +234,7 @@ class ChatService extends BaseService
      * @param string $unit 单位分:个数(person)消息(message)
      * @return int
      */
-    public static function getUnReadMsgCount($shopId, $unit='person')
+    public static function getUnReadMsgCount($shopId, $unit = 'person')
     {
         $cacheKey = ChatClass::getLatestUsersKey($shopId);
         //返回有序集合,从高分到低分排序
@@ -255,9 +261,9 @@ class ChatService extends BaseService
             $unReadNum = intval($decimalPart * 10000 + 0.5); // 加0.5 -- 使用四舍五入来处理浮点数精度问题
 
             //根据未读消息数的单位进行计算总数
-            if ($unit == 'person'){
+            if ($unit == 'person') {
                 $msgCount += ($unReadNum >= 1 ? 1 : 0);
-            } else if ($unit == 'message'){
+            } else if ($unit == 'message') {
                 $msgCount += $unReadNum;
             }
         }

+ 4 - 0
biz-hd/order/classes/OrderClass.php

@@ -26,6 +26,7 @@ use common\components\miniUtil;
 use common\components\noticeUtil;
 use common\components\orderSn;
 use common\components\printUtil;
+use common\components\stringUtil;
 use common\components\util;
 use Yii;
 use bizHd\base\classes\BaseClass;
@@ -270,6 +271,9 @@ class OrderClass extends BaseClass
         $riseNum = StatOrderCountClass::addOrder($shop, $main);
         $data['sendNum'] = date("d") . $riseNum;
         $data['totalFlow'] = OrderClass::ORDER_TOTAL_FLOW;
+        $salt = stringUtil::charsShuffleLowerCase(10);
+        $data['salt'] = $salt;
+
         return self::add($data, true);
     }
 

+ 25 - 21
biz-hd/purchase/classes/PurchaseClass.php

@@ -186,7 +186,8 @@ class PurchaseClass extends BaseClass
         foreach ($productIds as $productId) {
             $product = ProductClass::getById($productId, true);
             $oldStocks[$productId] = $product;
-        }        self::takeToPutIn($cg);
+        }
+        self::takeToPutIn($cg);
         $shop = ShopClass::getLockById($cg->shopId);
         if (empty($shop)) {
             util::fail('没有找到门店14');
@@ -300,11 +301,11 @@ class PurchaseClass extends BaseClass
             $formNum = ProductClass::formatStock($product->stock, $ratio); //花材的库存转换
             $itemInfo[] = [
                 'productId' => $productId,
-                'itemNum'   => $product->stock, // 回滚为入库前的库存
-                'itemId'    => $product->itemId,
-                'bigNum'    => $formNum['bigNum'],
-                'smallNum'  => $formNum['smallNum'],
-                'price'     => $product->price,
+                'itemNum' => $product->stock, // 回滚为入库前的库存
+                'itemId' => $product->itemId,
+                'bigNum' => $formNum['bigNum'],
+                'smallNum' => $formNum['smallNum'],
+                'price' => $product->price,
             ];
         }
 
@@ -334,11 +335,11 @@ class PurchaseClass extends BaseClass
             $formNum = ProductClass::formatStock($newStock, $ratio); //花材的库存转换
             $itemInfo[] = [
                 'productId' => $productId,
-                'itemNum'   => $newStock, // 新库存数
-                'itemId'    => $product->itemId,
-                'bigNum'    => $formNum['bigNum'],
-                'smallNum'  => $formNum['smallNum'],
-                'price'     => $product->price,
+                'itemNum' => $newStock, // 新库存数
+                'itemId' => $product->itemId,
+                'bigNum' => $formNum['bigNum'],
+                'smallNum' => $formNum['smallNum'],
+                'price' => $product->price,
             ];
         }
 
@@ -716,16 +717,25 @@ class PurchaseClass extends BaseClass
     //添加采购 ssh 2021.1.18
     public static function addPurchase($data, $ghs)
     {
-        $orderSn = orderSn::getPurchaseSn();
+        $shopId = $data['shopId'] ?? 0;
+        $sjId = $data['sjId'] ?? 0;
+        $mainId = $data['mainId'] ?? 0;
+        $ghsId = $data['ghsId'] ?? 0;
+        $book = $data['book'] ?? 0;
+        $shopAdminId = $data['shopAdminId'] ?? 0;
+        $customId = $data['customId'] ?? 0;
+
+        $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'customId' => $customId];
+        $orderSn = orderSn::getPurchaseSn($snData);
         $data['orderSn'] = $orderSn;
         $prePrice = 0;
-        $live = isset($ghs['live']) ? $ghs['live'] : 1;
-        $sendTimeWant = isset($data['sendTimeWant']) && !empty($data['sendTimeWant']) ? $data['sendTimeWant'] : date("Y-m-d");
+        $live = $ghs['live'] ?? 1;
+        $sendTimeWant = !empty($data['sendTimeWant']) ? $data['sendTimeWant'] : date("Y-m-d");
         if ($sendTimeWant < date("Y-m-d")) {
             util::fail('您选了过去时间');
         }
         $data['sendTimeWant'] = $sendTimeWant;
-        if (isset($data['product']) == false || empty($data['product'])) {
+        if (empty($data['product'])) {
             util::fail('请选择花材17');
         }
         $productList = $data['product'];
@@ -734,12 +744,6 @@ class PurchaseClass extends BaseClass
 
         //传过来的是供货商的productId,需要转换为零售端的productId
         //数据格式 [{"productId":"113","bigNum":1,"smallNum":0,"classId":"-2","hdProductId":1}]
-        $shopId = $data['shopId'] ?? 0;
-        $sjId = $data['sjId'] ?? 0;
-        $mainId = $data['mainId'] ?? 0;
-        $ghsId = $data['ghsId'] ?? 0;
-        $book = $data['book'] ?? 0;
-        $shopAdminId = $data['shopAdminId'] ?? 0;
 
         if ($live == 1) {
             //花店真实向批发店采购花材,因为拿的供货商的ID,所以需要转化花店的id

+ 13 - 2
biz-hd/purchase/services/PurchaseService.php

@@ -23,6 +23,7 @@ use bizHd\base\services\BaseService;
 use bizHd\cg\classes\CgRefundClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseItemClass;
+use bizHd\purchase\classes\PurchaseSnClass;
 use bizHd\shop\classes\MainClass;
 use common\components\dict;
 use common\components\imgUtil;
@@ -281,9 +282,19 @@ class PurchaseService extends BaseService
     {
         $info = self::getByCondition(['orderSn' => $orderSn], true);
         if (empty($info)) {
-            noticeUtil::push('花店采购,付款成功,支付回调,单号:' . $orderSn . ',没有找到订单 ' . $attach, '15280215347');
+            $ghsName = '无供货商';
+            preg_match('/\d+/', $orderSn, $m);
+            if ($m[0]) {
+                $cgSnId = $m[0];
+                $snData = PurchaseSnClass::getById($cgSnId, true);
+                $ghsId = $snData->ghsId ?? 0;
+                if (!empty($ghsId)) {
+                    $ghs = \bizHd\ghs\classes\GhsClass::getById($ghsId, true);
+                    $ghsName = $ghs->name;
+                }
+            }
+            noticeUtil::push('花店采购,付款成功,支付回调,单号:' . $orderSn . ',没有找到订单 ' . $ghsName . ',' . $attach, '15280215347');
             $msg = "没有找到订单 orderSn:{$orderSn}";
-            Yii::info($msg);
             util::fail($msg);
         }
         if ($info->actPrice != $totalFee) {

+ 1 - 1
biz-mall/member/models/MemberWeal.php

@@ -9,7 +9,7 @@ class MemberWeal extends Base
 
     public static function tableName()
     {
-        return 'xhMemberWeal';
+        return 'xhMemberRecharge';
     }
 
 }

+ 1 - 1
common/components/book.php

@@ -91,7 +91,7 @@ class book
         'chargeStandard' => [
             ['style' => 'info', 'value' => '软件年费1580元,年费需每年付一次,客户通过小程序下单,会扣千分之3.3手续费(即1千元扣3.3元)。',],
             ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国100多家鲜花批发店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
-            ['style' => 'smallTitle', 'value' => '注意,软件的研发成本巨大,不管是年费、费率和套餐,都已经给到大家最低价,没有谈的空间。如果还要再谈,不需要再找我们浪费时间,请理解。',],
+            ['style' => 'smallTitle', 'value' => '注意,软件的研发成本巨大,不管是年费、费率和套餐,都已经给到大家最低价,没有谈的空间,不需要再找我们浪费时间,请理解。付费后不支持退货。',],
             ['style' => 'info', 'value' => '首次开通系统,另外赠送30天有效期,保证有足够时间试运营。',],
             ['style' => 'info', 'value' => '-------------------------------------------',],
             ['style' => 'smallTitle', 'value' => '仓库版',],

+ 5 - 5
common/components/dict.php

@@ -271,14 +271,14 @@ class dict
             ['name' => '银行卡', 'id' => 5],
         ],
         //零售会员的等级
-        'memberLevel' => ['general' => 1, 'silver' => 2, 'gold' => 3, 'diamond' => 4, 'super' => 5,],
-        'memberLevelName' => [1 => '入门会员', 2 => '白银会员', 3 => '黄金会员', 4 => '钻石会员', 5 => '超级会员'],
+        'memberLevel' => ['general' => 1, 'silver' => 2, 'gold' => 3, 'diamond' => 4, 'blackGold' => 5,],
+        'memberLevelName' => [1 => '普通会员', 2 => '白银会员', 3 => '黄金会员', 4 => '钻石会员', 5 => '黑金会员'],
         'memberLevelMap' => [
-            ['name' => '入门会员', 'level' => 1, 'levelSn' => 'general', 'amount' => 3000,],
+            ['name' => '普通会员', 'level' => 1, 'levelSn' => 'general', 'amount' => 3000,],
             ['name' => '白银会员', 'level' => 2, 'levelSn' => 'silver', 'amount' => 6000,],
             ['name' => '黄金会员', 'level' => 3, 'levelSn' => 'gold', 'amount' => 10000,],
             ['name' => '钻石会员', 'level' => 4, 'levelSn' => 'diamond', 'amount' => 20000,],
-            ['name' => '超级会员', 'level' => 5, 'levelSn' => 'super', 'amount' => 100000,],
+            ['name' => '黑金会员', 'level' => 5, 'levelSn' => 'blackGold', 'amount' => 100000,],
         ],
         'rechargeMap' => [
             ['recharge' => 500, 'give' => 3,],
@@ -322,7 +322,7 @@ class dict
             'nextDistance' => 1000,//每增加1公里
             'nextPrice' => 2,//增加2元
         ],
-
+//4
         "io" => ['payout' => 0, 'income' => 1, 'other' => 2],
         "ioName" => [0 => '支出', 1 => '收入', 2 => '其它'],
 

+ 6 - 4
common/components/orderSn.php

@@ -95,13 +95,14 @@ class orderSn
     }
 
     //供货商订单号生成 ssh 2021.1.19
-    public static function getGhsOrderSn()
+    public static function getGhsOrderSn($params = [])
     {
         $prefix = 'XSD_CS';
         if (getenv('YII_ENV', 'local') == 'production') {
             $prefix = 'XSD';
         }
-        $respond = OrderSnClass::add(['id' => null]);
+        $params['id'] = null;
+        $respond = OrderSnClass::add($params);
         $id = $respond['id'] ?? 0;
         if (empty($id)) {
             util::fail('订单号没有生成');
@@ -169,13 +170,14 @@ class orderSn
     }
 
     //零售商采购单号 ssh 2021.1.19
-    public static function getPurchaseSn()
+    public static function getPurchaseSn($params = [])
     {
         $prefix = 'CG_CS';
         if (getenv('YII_ENV', 'local') == 'production') {
             $prefix = 'CG';
         }
-        $respond = \bizHd\purchase\classes\PurchaseSnClass::add(['id' => null]);
+        $params['id'] = null;
+        $respond = \bizHd\purchase\classes\PurchaseSnClass::add($params);
         $id = $respond['id'] ?? 0;
         if (empty($id)) {
             util::fail('采购单号没有生成');