Browse Source

物流信息

wufeng 2 years ago
parent
commit
b2e4e8dec1

+ 0 - 7
app/admin/config/redis_key.php

@@ -1,7 +0,0 @@
-<?php
-
-return [
-
-
-
-];

+ 12 - 0
app/admin/logic/OrderLogic.php

@@ -183,6 +183,7 @@ class OrderLogic extends BaseLogic
 
             $date = date('Y-m-d H:i:s');
 
+            $insert_express_data = [];
             foreach ($list as $order) {
 
                 if (!$val->check($order)) throw new Exception($val->getError());
@@ -199,8 +200,19 @@ class OrderLogic extends BaseLogic
                     'updaterid' => self::$uid,
                     'updatetime' => $date,
                 ]);
+
+                $insert_express_data[] = [
+                    'post_code' => $order['post_code'],
+                    'post_data' => '',
+                    'status' => 1,
+                    'addtime' => $date,
+                    'updatetime' => $date,
+                ];
+
             }
 
+            if ($insert_express_data) Db::name('express_data')->insertAll($insert_express_data);
+
             Db::commit();
             return json_show(CommonModel::$success, '发货成功');
         } catch (Exception $exception) {

+ 1 - 5
app/admin/route/app.php

@@ -139,11 +139,7 @@ Route::rule('orderList', 'admin/Order/list');//列表
 Route::rule('orderRead', 'admin/Order/read');//详情
 Route::rule('orderDeliver', 'admin/Order/deliver');//发货
 Route::rule('orderExport', 'admin/Order/export');//导出
-//【服务订单】
-//Route::rule('orderServiceList', 'admin/OrderService/list');//列表
-//Route::rule('orderServiceRead', 'admin/OrderService/read');//详情
-//Route::rule('orderServiceDeliver', 'admin/OrderService/deliver');//发货
-//Route::rule('orderServiceExport', 'admin/OrderService/export');//导出
+
 
 //【手机主题】
 Route::rule('themeList', 'admin/Theme/list');//列表

+ 6 - 0
app/mobile/controller/Order.php

@@ -50,5 +50,11 @@ class Order extends BaseController
         return OrderLogic::info($id);
     }
 
+    //查看物流信息
+    public function express(){
+        $post_code = $this->request->post('post_code','');
+        return OrderLogic::express($post_code);
+    }
+
 
 }

+ 18 - 4
app/mobile/logic/OrderLogic.php

@@ -336,9 +336,9 @@ class OrderLogic extends BaseLogic
         $rs = MasterOrderModel::alias('a')
             ->field('a.id,a.masterOrderCode,a.amount,a.status,a.addtime,c.contactor,c.mobile,c.addr,c.addr_code,a.transaction_id,a.remark')
             ->leftJoin('addr c', 'c.id=a.addr_id AND c.is_del=' . CommonModel::$del_normal)
-            ->append(['order_list'])
+            ->append(['order_list', 'express_data'])
             ->withAttr('order_list', function ($val, $da) {
-                return OrderModel::field('id,orderCode,child_title,child_cover,price,num,total_price')
+                return OrderModel::field('id,orderCode,child_title,child_cover,price,num,total_price,post_code')
                     ->where(['is_del' => CommonModel::$del_normal, 'masterOrderCode' => $da['masterOrderCode'], 'uid' => self::$aid])
                     ->order('id')
                     ->select()
@@ -346,8 +346,7 @@ class OrderLogic extends BaseLogic
             })
             ->withAttr('addr', function ($val, $da) {
                 return $da['addr_code'] ? get_addr_name($da['addr_code']) . $val : $val;
-            })
-            ->where('a.id', $id)
+            })->where('a.id', $id)
             ->findOrEmpty()
             ->toArray();
 
@@ -355,5 +354,20 @@ class OrderLogic extends BaseLogic
 
     }
 
+    //物流信息
+    public static function express(string $post_code = ''): Json
+    {
+
+        $res = Db::name('express_data')
+            ->where('post_code', $post_code)
+            ->field(true)
+            ->withAttr('post_data', function ($val) {
+                return json_decode($val, true);
+            })
+            ->findOrEmpty();
+
+        return json_show(CommonModel::$success, '获取快递单号的物流信息成功', $res);
+
+    }
 
 }

+ 1 - 5
app/mobile/route/app.php

@@ -40,10 +40,6 @@ Route::rule('shoppingGoodInfo', 'Shopping/goodInfo');//商城商品详情
 Route::rule('orderAdd', 'Order/add');//下单
 Route::rule('orderList', 'Order/list');//订单列表
 Route::rule('orderInfo', 'Order/info');//订单详情
-
-
-
-
-
+Route::rule('orderExpress', 'Order/express');//订单物流信息