shish преди 5 години
родител
ревизия
1dfef724f4

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

@@ -23,7 +23,7 @@ class PurchaseController extends BaseController
         $post = Yii::$app->request->post();
         $ghsId = $post['ghsId'] ?? 0;
         //供货商
-        $ghsInfo = GhsClass::getGhsInfo($ghsId);
+        $ghsInfo = GhsClass::getById($ghsId);
         if (empty($ghsInfo)) {
             util::fail('没有找到供货商');
         }
@@ -36,7 +36,9 @@ class PurchaseController extends BaseController
             $post['shopAdminId'] = $this->shopAdminId;
             $post['ghsId'] = $ghsId;
             $post['ghsName'] = $ghsInfo['name'] ?? '';
+            $post['ghsMobile'] = $ghsInfo['mobile'] ?? '';
             $post['ghsAvatar'] = $ghsInfo['avatar'] ?? '';
+            $post['ghsFullAddress'] = $ghsInfo['fullAddress'] ?? '';
             $customId = $ghsInfo['customId'] ?? 0;
             $post['customId'] = $customId;
             $shopAdmin = $this->shopAdmin;

+ 33 - 32
biz-ghs/express/services/DadaExpressServices.php

@@ -13,6 +13,7 @@ use bizGhs\order\classes\OrderClass;
 use common\components\dada\dada;
 use common\components\util;
 use Yii;
+
 class DadaExpressServices
 {
 
@@ -33,13 +34,13 @@ class DadaExpressServices
     //根据订单号,发快递
     public static function addOrder($orderInfo)
     {
-        if(empty($orderInfo)){
+        if (empty($orderInfo)) {
             util::fail("订单不存在");
         }
         $sjId = $orderInfo['merchantId'];
         $sourceId = SjExpressClass::getSourceId($sjId);
         $orderParams = self::orderParams($orderInfo);
-        $res = dada::addOrder($sourceId,$orderParams);
+        $res = dada::addOrder($sourceId, $orderParams);
         return $res;
     }
 
@@ -56,23 +57,23 @@ class DadaExpressServices
     public static function queryDeliverFee($orderInfo)
     {
         //
-        if(empty($orderInfo)){
+        if (empty($orderInfo)) {
             util::fail("订单不存在");
         }
         $sjId = $orderInfo['merchantId'];
         $sourceId = SjExpressClass::getSourceId($sjId);
         $orderParams = self::orderParams($orderInfo);
-        $res = dada::queryDeliverFee($sourceId,$orderParams);
+        $res = dada::queryDeliverFee($sourceId, $orderParams);
         return $res;
     }
 
     //取消订单
-    public static function cancelOrder($orderSn,$reasonId,$reason='')
+    public static function cancelOrder($orderSn, $reasonId, $reason = '')
     {
         $orderInfo = OrderClass::getByOrderSn($orderSn);
         $sjId = $orderInfo['merchantId'];
         $sourceId = SjExpressClass::getSourceId($sjId);
-        $res = dada::formalCancel($sourceId,$orderSn,$reasonId,$reason);
+        $res = dada::formalCancel($sourceId, $orderSn, $reasonId, $reason);
         return $res;
     }
 
@@ -82,20 +83,20 @@ class DadaExpressServices
         $orderInfo = OrderClass::getByOrderSn($orderSn);
         $sjId = $orderInfo['merchantId'];
         $sourceId = SjExpressClass::getSourceId($sjId);
-        $res = dada::statusQuery($sourceId,$orderSn);
+        $res = dada::statusQuery($sourceId, $orderSn);
         return $res;
     }
 
     //订单重发
     public static function reAddOrder($orderInfo)
     {
-        if(empty($orderInfo)){
+        if (empty($orderInfo)) {
             util::fail("订单不存在");
         }
         $sjId = $orderInfo['merchantId'];
         $sourceId = SjExpressClass::getSourceId($sjId);
         $orderParams = self::orderParams($orderInfo);
-        $res = dada::reAddOrder($sourceId,$orderParams);
+        $res = dada::reAddOrder($sourceId, $orderParams);
         return $res;
     }
 
@@ -103,36 +104,36 @@ class DadaExpressServices
     public static function orderParams($orderInfo)
     {
         $sjId = $orderInfo['merchantId'];
-        $online = Yii::$app->params['dadaOnline'];
+        //$online = Yii::$app->params['dadaOnline'];
         $shopId = $orderInfo['shopId'];
 
         $orderSn = $orderInfo['orderSn'];
         //获取快递方 商户id, 跟门店id
-        $shopNo = ShopExpressClass::getShopNo($sjId,$shopId);
-        if(!$online){
+        $shopNo = ShopExpressClass::getShopNo($sjId, $shopId);
+        if (getenv('YII_ENV', 'local') != 'production') {
             $shopNo = '11047059';
         }
-        $params  = [
-            'shop_no'=>$shopNo,
-            'origin_id'=>$orderSn,
-            'city_code'=>'0592', //厦门  暂写死
-            'cargo_price'=>(float)$orderInfo['actPrice'], //订单金额(单位:元) 实际支付价格?
-            'is_prepay'=>0, // 是否需要垫付 1:是 0:否 (垫付订单金额,非运费)
-            'receiver_name'=>$orderInfo['customName'], //收货人姓名
-            'receiver_address'=>$orderInfo['fullAddress'], //收货人地址
-            'receiver_lat' =>(float)$orderInfo['lat'], // 存的是百度经纬度,需要转高德经纬度
-            'receiver_lng' =>(float)$orderInfo['long'], // 存的是百度经纬度,需要转高德经纬度
-            'callback'=> Yii::$app->params['ghsHost'].'/notice/express-call-back',
-
-            'cargo_weight'=>(float)$orderInfo['weight'],//订单重量(单位:Kg)
-            'receiver_phone'=>$orderInfo['customMobile'],//否	收货人手机号(手机号和座机号必填一项)
-            'info'=>'',//备注
-            'cargo_type'=>3, //类型:鲜花
-            'cargo_num'=>(int)$orderInfo['bigNum'],
-            'origin_mark_no'=>'#销花宝#',
+        $params = [
+            'shop_no' => $shopNo,
+            'origin_id' => $orderSn,
+            'city_code' => '0592', //厦门  暂写死
+            'cargo_price' => (float)$orderInfo['actPrice'], //订单金额(单位:元) 实际支付价格?
+            'is_prepay' => 0, // 是否需要垫付 1:是 0:否 (垫付订单金额,非运费)
+            'receiver_name' => $orderInfo['customName'], //收货人姓名
+            'receiver_address' => $orderInfo['fullAddress'], //收货人地址
+            'receiver_lat' => (float)$orderInfo['lat'], // 存的是百度经纬度,需要转高德经纬度
+            'receiver_lng' => (float)$orderInfo['long'], // 存的是百度经纬度,需要转高德经纬度
+            'callback' => Yii::$app->params['ghsHost'] . '/notice/express-call-back',
+
+            'cargo_weight' => (float)$orderInfo['weight'],//订单重量(单位:Kg)
+            'receiver_phone' => $orderInfo['customMobile'],//否	收货人手机号(手机号和座机号必填一项)
+            'info' => '',//备注
+            'cargo_type' => 3, //类型:鲜花
+            'cargo_num' => (int)$orderInfo['bigNum'],
+            'origin_mark_no' => '#销花宝#',
         ];
-        if($orderInfo['sendTime'] != '0000-00-00 00:00:00'){
-            $params['delay_publish_time']=strtotime($orderInfo['sendTime']);
+        if ($orderInfo['sendTime'] != '0000-00-00 00:00:00') {
+            $params['delay_publish_time'] = strtotime($orderInfo['sendTime']);
         }
         return $params;
 

+ 4 - 0
biz-ghs/order/services/OrderService.php

@@ -36,6 +36,8 @@ class OrderService extends BaseService
         }
         $ghsName = $ghs['name'] ?? '';
         $ghsAvatar = $ghs['avatar'] ?? '';
+        $ghsMobile = $ghs['mobile'] ?? '';
+        $ghsFullAddress = $ghs['fullAddress'] ?? '';
         $payWay = $data['payWay'] ?? dict::getDict('payWay', 'wxPay');
         //零售采购单
         $purchaseData = [
@@ -49,6 +51,8 @@ class OrderService extends BaseService
             'saleId' => $saleId,
             'ghsId' => $ghsId,
             'ghsName' => $ghsName,
+            'ghsMobile' => $ghsMobile,
+            'ghsFullAddress' => $ghsFullAddress,
             'ghsAvatar' => $ghsAvatar,
             'customId' => $customId,
             'payWay' => $payWay,

+ 9 - 0
biz/ghs/classes/GhsClass.php

@@ -70,6 +70,7 @@ class GhsClass extends BaseClass
             'name' => $name,
             'py' => $py,
             'mobile' => $mobile,
+            'province' => $shop['province'] ?? '',
             'city' => $shop['city'] ?? '',
             'dist' => $shop['dist'] ?? '',
             'address' => $shop['address'] ?? '',
@@ -167,4 +168,12 @@ class GhsClass extends BaseClass
         util::fail('您没有权限访问的供应商');
     }
 
+    //冗余到其它表的供货商信息,表结构变化,这里不会变化 shish 2021.5.11
+    public static function formatGhsInfo($ghs)
+    {
+        return [
+            'id' => $id,
+        ];
+    }
+
 }

+ 22 - 21
common/components/dada/dada.php

@@ -13,6 +13,7 @@ use common\components\dada\config\config;
 use common\components\dada\protocol\requestClient;
 use common\components\util;
 use Yii;
+
 //达达快递
 class dada
 {
@@ -22,7 +23,7 @@ class dada
     {
         $config = self::getConfig($sourceId);
         $api = new cityCodeApi('');
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
@@ -65,7 +66,7 @@ class dada
     {
         $config = self::getConfig($sourceId);
         $api = new reasonsApi('');
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
@@ -118,36 +119,36 @@ class dada
       "msg": "成功"
       }
      */
-    public static function addOrder($sourceId,$params)
+    public static function addOrder($sourceId, $params)
     {
         $config = self::getConfig($sourceId);
         $api = new orderApi();
         //body内容
         $api->addOrder($params);
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
 
 
     //运费查询(参数跟新增订单一致)
-    public static function queryDeliverFee($sourceId,$params)
+    public static function queryDeliverFee($sourceId, $params)
     {
         $config = self::getConfig($sourceId);
         $api = new orderApi();
         $api->queryDeliverFee($params);
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
 
     //订单重发(参数跟新增订单一致)
-    public static function reAddOrder($sourceId,$params)
+    public static function reAddOrder($sourceId, $params)
     {
         $config = self::getConfig($sourceId);
         $api = new orderApi();
         $api->reAddOrder($params);
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
 
@@ -159,50 +160,50 @@ class dada
     cancel_reason_id	Integer	是	取消原因ID(取消原因列表)
     cancel_reason	String	否	取消原因(当取消原因ID为其他时,此字段必填)
      */
-    public static function formalCancel($sourceId,$orderSn,$reasonId,$reason='')
+    public static function formalCancel($sourceId, $orderSn, $reasonId, $reason = '')
     {
         $config = self::getConfig($sourceId);
         $api = new orderApi();
         $params = [
-            'order_id'=>$orderSn,
-            'cancel_reason_id'=>$reasonId,
+            'order_id' => $orderSn,
+            'cancel_reason_id' => $reasonId,
         ];
-        if($reasonId==10000){
+        if ($reasonId == 10000) {
             $params['cancel_reason'] = $reason;
         }
         $api->formalCancel($params);
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
 
     //订单状态查询
-    public static function statusQuery($sourceId,$orderSn)
+    public static function statusQuery($sourceId, $orderSn)
     {
         $config = self::getConfig($sourceId);
         $api = new orderApi();
         $params = [
-            'order_id'=>$orderSn,
+            'order_id' => $orderSn,
         ];
         $api->queryOrderStatus($params);
-        $client = new requestClient($config,$api);
+        $client = new requestClient($config, $api);
         $resp = $client->makeRequest();
         return self::handleResp($resp);
     }
 
     public static function getConfig($sourceId)
     {
-        if(empty($sourceId)){
+        if (empty($sourceId)) {
             util::fail("暂不支持配送,请绑定达达或联系客服");
         }
         $config = new config();
-        $online = Yii::$app->params['dadaOnline'];
+        //$online = Yii::$app->params['dadaOnline'];
         $appKey = Yii::$app->params['dadaAppKey'];
         $appSecret = Yii::$app->params['dadaAppSecret'];
-        if($online){
+        if (getenv('YII_ENV', 'local') == 'production') {
             $config->setSourceId($sourceId);
             $config->setHost('https://newopen.imdada.cn');
-        }else{
+        } else {
             //测试 :商户id: 73753    门店id: 11047059
             $config->setSourceId(73753);
             $config->setHost("http://newopen.qa.imdada.cn");
@@ -214,7 +215,7 @@ class dada
 
     public static function handleResp($resp)
     {
-        if($resp->getStatus()!='success'){
+        if ($resp->getStatus() != 'success') {
             util::fail($resp->getMsg());
         }
         return $resp->getResult();

+ 1 - 1
common/components/dict.php

@@ -10,7 +10,7 @@ class dict
     public static $data = [
 
         //需要显示国兰的信息 0不需要 1需要(要审核小程序请显示国兰信息)
-        'showGlInfo' => 1,
+        'showGlInfo' => 0,
         //显示零售和供货商的演示入口
         'showDemo' => 1,
         //零售演示的管理员id

+ 4 - 4
common/config/params.php

@@ -86,7 +86,7 @@ if (getenv('YII_ENV') == 'local') {
     $config['mallImgHost'] = $prefixHttp . 'img.theflorist.cn/';
 
     $config['ossBucket'] = 'pic-hhb-cs';
-    $config['dadaOnline']= false; //正式环境改为true
+    //$config['dadaOnline']= false; //正式环境改为true
 }
 if (getenv('YII_ENV') == 'test') {
     $config['hdHost'] = $prefixHttp . 'api.shop.huaml.com';
@@ -108,7 +108,7 @@ if (getenv('YII_ENV') == 'test') {
     $config['mallImgHost'] = $prefixHttp . 'img.theflorist.cn/';
 
     $config['ossBucket'] = 'pic-hhb-cs';
-    $config['dadaOnline']= false; //正式环境改为true
+    //$config['dadaOnline']= false; //正式环境改为true
 }
 if (getenv('YII_ENV') == 'dev') {
     $config['hdHost'] = $prefixHttp . 'api.shop.huaml.com';
@@ -130,7 +130,7 @@ if (getenv('YII_ENV') == 'dev') {
     $config['mallImgHost'] = $prefixHttp . 'img.theflorist.cn/';
 
     $config['ossBucket'] = 'pic-hhb-cs';
-    $config['dadaOnline']= false; //正式环境改为true
+    //$config['dadaOnline']= false; //正式环境改为true
 }
 if (getenv('YII_ENV') == 'production') {
     $config['hdHost'] = $prefixHttp . 'api.shop.huahb.com';
@@ -152,6 +152,6 @@ if (getenv('YII_ENV') == 'production') {
     $config['mallImgHost'] = $prefixHttp . 'img.zhhinc.com/';
 
     $config['ossBucket'] = 'pic-hhb';
-    $config['dadaOnline']= true; //正式环境改为true
+    //$config['dadaOnline']= true; //正式环境改为true
 }
 return $config;

+ 15 - 1
sql.sql

@@ -2419,4 +2419,18 @@ ALTER TABLE xhRenew CHANGE userId shopAdminId INT NOT NULL DEFAULT 0 COMMENT '
 ALTER TABLE xhRenew DROP COLUMN `addTime`;
 ALTER TABLE xhRenew ADD `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间' AFTER `status`;
 ALTER TABLE xhRenew ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `addTime`;
-ALTER TABLE xhRenew ADD shopAdminName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '员工名称' AFTER shopAdminId;
+ALTER TABLE xhRenew ADD shopAdminName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '员工名称' AFTER shopAdminId;
+ALTER TABLE xhGhsCustom MODIFY `city` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '市' AFTER `province`;
+ALTER TABLE xhGhsCustom MODIFY `dist` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '区县' AFTER `city`;
+ALTER TABLE xhGhsCustom MODIFY `fullAddress` VARCHAR(800) NOT NULL DEFAULT '' COMMENT '完整地址' AFTER `dist`;
+ALTER TABLE xhGhsCustom MODIFY `address` VARCHAR(800) NOT NULL DEFAULT '' COMMENT '客户地址' AFTER `dist`;
+ALTER TABLE xhGhsCustom MODIFY `fullAddress` VARCHAR(900) NOT NULL DEFAULT '' COMMENT '完整地址' AFTER `floor`;
+ALTER TABLE xhGhsCustom ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhOrder ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhGhsOrder ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhShop ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhGhs ADD showAddress VARCHAR(900) NOT NULL DEFAULT '' COMMENT '地图接口显示的完整地址' AFTER `fullAddress`;
+ALTER TABLE xhPurchase ADD ghsInfo VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '供货商信息' AFTER `ghsId`;
+ALTER TABLE xhPurchase DROP COLUMN `ghsInfo`;
+ALTER TABLE xhPurchase ADD ghsMobile CHAR(15) NOT NULL DEFAULT '' COMMENT '供货商手机号' AFTER `ghsAvatar`;
+ALTER TABLE xhPurchase ADD ghsFullAddress VARCHAR(800) NOT NULL DEFAULT '' COMMENT '供货商地址' AFTER `ghsMobile`;