Browse Source

0805-00590h01

Zory 8 hours ago
parent
commit
8a9c9c73b5

+ 10 - 2
app/command/SyncPlan.php

@@ -18,7 +18,7 @@ class SyncPlan extends Command
     {
         try {
 
-            $output->writeln("开始更新快递信息====>" . getDateFull());
+            $output->writeln("开始更计划带货数据信息====>" . getDateFull());
             $nextPage = 1;
             while (is_numeric($nextPage)) {
                 $resp = (new SaasLivePlan)->where(["status" => 1])->page($nextPage, 10)->select();
@@ -33,7 +33,15 @@ class SyncPlan extends Command
                         "appid"     => sConf("wechat.mini_appid"),
                         "secret"    => sConf("wechat.mini_secret"),
                     ])->token()->getPlanData([intval($item['plan_id'])]);
-                    print_r($planData);
+                    if (isset($planData['data'][$item['plan_id']])) {
+                        echo getDateFull()."更新数据成功\n";
+                        (new SaasLivePlan)->where("id",$item['id'])->save([
+                            "order_money"   => $planData['data'][$item['plan_id']]['gmv']??0,
+                            "done_money"   => $planData['data'][$item['plan_id']]['used_gmv']??0
+                        ]);
+                    } else {
+                        echo getDateFull()."没有查询到数据\n";
+                    }
                 }
                 $nextPage = $nextPage+1;
                 $output->writeln("进入下一页=={$nextPage}==".getDateFull());

+ 9 - 1
app/controller/admin/Bills.php

@@ -25,10 +25,18 @@ class Bills extends Base
     {
         try {
             $param = $request->all();
+            if ($request->user['is_super'] == 0) {
+                $param['poi_id'] = $request->user['store_id'];
+            }
             $data = $this->serviceDay->setModel()->getList($param,['store' => function($query){
                 $query->field("poi_id,poi_name,poi_address,nick_name,poi_city");
             }]);
-            return successTrans("success.data",pageFormat($data),200);
+            if ($request->user['is_super'] == 0) {
+                $return = pageFormatBills($data);
+            } else {
+                $return = pageFormat($data);
+            }
+            return successTrans("success.data",$return,200);
         } catch (\Throwable $throwable) {
             return error($throwable->getMessage());
         }

+ 5 - 4
app/controller/api/Goods.php

@@ -39,10 +39,11 @@ class Goods extends Base
             $data = $this->model->where("product_id",$param['goods'])->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);
-                return array_map(function ($v) {
-                    return $v['url'];
-                }, $img);
+//                $img = json_decode($resp['image_list'],true);
+//                return array_map(function ($v) {
+//                    return $v['url'];
+//                }, $img);
+                return "";
             }])->findOrEmpty();
             if ($data->isEmpty()) return errorTrans("empty.data");
             if ($data['poi']['status'] <> 1) return error("该店铺已关闭,请联系管理员");

+ 0 - 6
app/extra/dyMini/PlanLive.php

@@ -91,16 +91,10 @@ class PlanLive extends BasicLife
         $param = [
             "plan_id_list"   => $planId
         ];
-        echo json_encode($param)."\n";
-        print_r([
-            "access-token" => $this->getAccessToken(),
-            "Rpc-Transit-Life-Account" => "7595228109947947043"
-        ]);
         $result = Http::asJson()->withHeaders([
             "access-token" => $this->getAccessToken(),
             "Rpc-Transit-Life-Account" => "7595228109947947043"
         ])->post($this->gateway."api/match/v2/poi/oriented_plan_detail/",$param)->array();
-        print_r($result);
         if(!empty($result['data']))
         {
             return $result['data'];

+ 33 - 0
app/functions.php

@@ -377,6 +377,39 @@ if (!function_exists("pageFormat")) {
     }
 }
 
+
+if (!function_exists("pageFormatBills")) {
+    /**
+     * @param $data
+     * @param int $size
+     * @return array {page:"",pageSize:"",rows:[],total:""}
+     */
+    function pageFormatBills($data, int $size = 10): array
+    {
+        if (empty($data)) return [];
+        $billsData = [];
+        foreach ($data as $key=>$bill) {
+            $billsData[$key] = [
+                "title"             => $bill["title"],
+                "day"               => $bill["day"],
+                "end_day"           => $bill["end_day"],
+                "order_number"      => $bill["order_number"],
+                "order_money"       => $bill["order_money"],
+                "store_money"       => $bill["store_money"],
+                "star_fee_total"    => $bill["star_fee_total"],
+                "status"            => $bill["status"],
+                "sys_fee"           => $bill["life_fee_total"]+$bill["sys_fee_total"],
+            ];
+        }
+        return [
+            'total'     => $data->total(),
+            'page'      => $data->currentPage(),
+            'pageSize'  => $size,
+            'rows'      => $billsData
+        ];
+    }
+}
+
 if (!function_exists("pageFormatMsg")) {
     /**
      * @param $data