zory пре 3 недеља
родитељ
комит
273dae2a8e

+ 2 - 0
app/controller/api/Notify.php

@@ -5,6 +5,7 @@ namespace app\controller\api;
 use app\extra\basic\Base;
 use app\extra\dyLife\data\OrderData;
 use app\extra\tools\LifeWeb;
+use app\model\saas\SaasGoods;
 use app\model\saas\SaasOrder;
 use app\model\saas\SaasOrderItem;
 use LinFly\Annotation\Attributes\Route\Controller;
@@ -43,6 +44,7 @@ class Notify extends Base
 //            if (isset($orderData['orders'][0]['anchor_id'])) {
 //                $order->douyin_uid = $orderData['orders'][0]['anchor_id'];
 //            }
+            (new SaasGoods)->where("goods_id",$order['life_goods_id'])->inc("sale_stock")->save();
             $order->status = 1;
             $order->pay_at = getDateFull();
             $order->pay_type = $data['pay_channel'];

+ 3 - 1
app/controller/api/Solution.php

@@ -67,11 +67,13 @@ class Solution extends Base
                     case "pre_create_refund": // 退款回调
                         $order = (new SaasOrder)->where("order_sn",$msgData['order_id'])->findOrEmpty();
                         if ($order->isEmpty()) return json(['err_no' => 0,"err_tips" => "success"]);
-                        if (!in_array($order['status'],[1,6])) return json(['err_no' => 0,"err_tips" => "success"]);
+//                        if (!in_array($order['status'],[1,6])) return json(['err_no' => 0,"err_tips" => "success"]);
                         $order->status = 4; // 退款中
                         $order->refund_msg = json_encode($msgData['refund_reason']);
                         $order->refund_apply = getDateFull();
                         $order->save();
+                        // 推送审核机制
+
                         return json(['err_no' => 0,"err_tips" => "success","data" => [
                             "out_refund_no" => "R".$order['out_order_no'],
                             "order_entry_schema"    => [

+ 3 - 1
app/controller/merchant/Order.php

@@ -81,7 +81,9 @@ class Order extends Base
                 "order.require" => trans("empty.require"),
             ],$request->method());
             if (!is_array($param)) return error($param);
-            $order = $this->model->where("out_order_no",$param['order'])->with(['product','poi','user','address','express'])->findOrEmpty();
+            $order = $this->model->where("out_order_no",$param['order'])->with(['product','poi','user','address' => function($query){
+                $query->with(['goods']);
+            },'express'])->findOrEmpty();
             if ($order->isEmpty()) return errorTrans("empty.data");
             if ($order['poi_id'] <> $request->user['store_id'] && $request->user['is_super'] == 0) return errorTrans("empty.data");
             $order['end_time'] = timeDiff(strtotime("+30 minutes",strtotime($order['create_at'])),time());

+ 7 - 1
app/controller/v2/Goods.php

@@ -36,7 +36,13 @@ class Goods extends Base
                 "option.default"    => ""
             ],$request->method());
             if (!is_array($param)) return error($param);
-            $data = $this->model->where("goods_id",$param['goods'])->with(['poi' => function ($query) {
+            $where = [];
+            if (is_numeric($param['goods'])) {
+                $where['goods_id'] = $param['goods'];
+            } else {
+                $where['product_id'] = $param['goods'];
+            }
+            $data = $this->model->where($where)->with(['poi' => function ($query) {
                 $query->field("poi_id,poi_name,poi_address,longitude,latitude,service_mobile,start_at,end_at,status");
             },'skuSpecs'])->append(['otherImg'])->withAttr(['otherImg' => function ($qu,$resp) {
                 $img = json_decode($resp['image_list'],true);

+ 15 - 4
app/controller/v2/Order.php

@@ -65,7 +65,7 @@ class Order extends Base
             if (empty($param['status'])) {
                 $param['statusGt'] = 1;
             }
-//            $param['openid'] = $request->user['openid'];
+            $param['openid'] = $request->user['openid'];
             $data = $this->service->setModel()->getList($param,['product' => function($query){
                 $query->field("product_id,product_name,price");
             },'poi' => function($query){
@@ -86,7 +86,13 @@ class Order extends Base
                 "option.default"    => ""
             ],$request->method());
             if (!is_array($param)) return error($param);
-            $order = $this->model->where("out_order_no",$param['order'])->with(['product' => function($query){
+            $where = [];
+            if (stripos($param['order'], 'AL') !== false) {
+                $where['out_order_no'] = $param['order'];
+            } else {
+                $where['order_sn'] = $param['order'];
+            }
+            $order = $this->model->where($where)->with(['product' => function($query){
                 $query->field("product_id,product_name,price,is_new,line_price");
             },'poi' => function($query){
                 $query->field("poi_id,poi_name,poi_address,poi_logo,longitude,latitude,poi_city,service_mobile,start_at,end_at");
@@ -157,7 +163,7 @@ class Order extends Base
             if (!is_array($param)) return error($param);
             $order = (new SaasOrder)->where("out_order_no",$param['order'])->findOrEmpty();
             if ($order->isEmpty()) return error("该笔交易不存在");
-//            if ($order['openid'] <> $request->user['openid']) return error("非法操作");
+            if ($order['openid'] <> $request->user['openid']) return error("非法操作");
             $goods = (new SaasGoodsOff)->where("goods_id",$order['life_goods_id'])->append(['check','number'])->withAttr(['check' => function(){
                 return false;
             },'number' => function () {
@@ -202,7 +208,12 @@ class Order extends Base
             if ($order['openid'] <> $request->user['openid']) return error("关联订单错误");
             if ($order['status'] <> 1) return error("关联订单错误");
             $address = (new SaasOrderAddress)->where(['openid' => $request->user['openid'],'order_sn' => $param['order']])->findOrEmpty();
-            if (!$address->isEmpty()) return error("请勿重复提交");
+            if (!$address->isEmpty()) {
+                $state = $address->setAutoData($param);
+                if (!$state) return error("提交失败");
+                return success("更新信息成功");
+            }
+            $param['order_sn'] = $param['order'];
             $address->setAutoData($param);
             $order->status = 7; // 7进行中
             $order->express_status = 1;

+ 14 - 8
app/model/saas/SaasOrderAddress.php

@@ -3,17 +3,18 @@
 namespace app\model\saas;
 
 use app\extra\basic\Model;
+use think\model\relation\HasOne;
 
 
 /**
- * @property integer $id (主键)
- * @property mixed $order_sn 
- * @property mixed $openid 
- * @property string $city_text 
- * @property mixed $city_code 
- * @property string $nickname 
- * @property string $mobile 
- * @property string $address 
+ * @property integer $id (主键)
+ * @property mixed $order_sn 
+ * @property mixed $openid 
+ * @property string $city_text 
+ * @property mixed $city_code 
+ * @property string $nickname 
+ * @property string $mobile 
+ * @property string $address 
  * @property mixed $create_at
  */
 class SaasOrderAddress extends Model
@@ -46,5 +47,10 @@ class SaasOrderAddress extends Model
      */
     public bool $timestamps = false;
 
+    public function goods(): HasOne
+    {
+        return $this->hasOne(SaasGoodsOff::class,"id","goods");
+    }
+
 
 }

+ 13 - 3
app/queue/redis/slow/ExportOrder.php

@@ -33,6 +33,9 @@ class ExportOrder implements Consumer
         "4" => "退款中",
         "5" => "已关闭",
         "6" => "部分退款",
+        "7" => "履约中",
+        "8" => "退款审核中",
+        "9" => "退款审核中",
     ];
 
     protected array $express = [
@@ -47,7 +50,7 @@ class ExportOrder implements Consumer
         try {
             if(empty($data['logId'])) return true;
             $spreadsheet = new Spreadsheet();
-            $title = ['店铺名称','下单人昵称','订单编号','订单状态','发货状态', '收件人', '手机号码', '收货地址','商品ID','商品标题', '创建时间'];
+            $title = ['店铺名称','下单人昵称','订单编号','订单状态','发货状态', '收件人', '手机号码', '收货地址','商品ID','团单标题','兑换商品', '创建时间'];
             $sheet = $spreadsheet->getActiveSheet();
             $titCol = 'A';
             foreach ($title as $key => $value) {
@@ -57,7 +60,9 @@ class ExportOrder implements Consumer
             }
             $row = 2; // 从第二行开始
             $searchKey = (new OrderService)->searchFilter($data['param']);
-            $orderData = (new SaasOrder)->where($searchKey)->with(['address','poi','user','product'])->select();
+            $orderData = (new SaasOrder)->where($searchKey)->with(['address' => function($query) {
+                $query->with(['goods']);
+            },'poi','user','product'])->order("create_at","desc")->select();
             if ($orderData->isEmpty()) {
                 (new SystemExport)->where("id",$data['logId'])->update(['status' => 2]);
                 return true;
@@ -68,6 +73,10 @@ class ExportOrder implements Consumer
                 if (!empty($item['address'])) {
                     $address = $item['address']['city_text'].$item['address']['address'];
                 }
+                $goodsTitle = $item['product']['product_name']??'-';
+                if ($item['product']['is_new'] == 1) {
+                    $goodsTitle = "{$item['product']['price']}元代{$item['product']['line_price']}元商场权益券{$item['product']['product_name']}";
+                }
                 $newData = [
                     "shop"      => $item['poi']['poi_name']??'-', // 店铺名称
                     "nickname"  => $item['user']['nickname']??'-', // 下单人昵称
@@ -78,7 +87,8 @@ class ExportOrder implements Consumer
                     "mobile"    => $item['address']['mobile']??'-',
                     "address"   => $address,
                     "goods_id"  => $item['product']['goods_id']??'-',
-                    "goods_name" => $item['product']['product_name']??'-',
+                    "goods_name" => $goodsTitle,
+                    "product"   => $item['address']['goods']['title']??'-',
                     "create_at" => $item['create_at'],
                 ];
                 foreach ($newData as $value) {

+ 1 - 0
app/queue/redis/slow/ImportOrder.php

@@ -78,6 +78,7 @@ class ImportOrder implements Consumer
                                 "type"      => "text"
                             ]);
                             $expressData[$key] = [
+                                'openid'        => $order['openid'],
                                 "order_sn"      => trim($val['A']),
                                 "express_sn"    => trim($val['C']),
                                 "mobile"        => trim($val['B']),

+ 0 - 0
public/download/~$订单列表_1787653541761.xlsx


+ 0 - 0
public/download/~$订单列表_1787654041465.xlsx


BIN
public/download/订单列表_1787653541761.xlsx


BIN
public/download/订单列表_1787654041465.xlsx