Zory 1 month ago
parent
commit
430c70a8e1

+ 0 - 50
app/command/ShopwwiAuthCommand.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace app\command;
-
-use Shopwwi\WebmanAuth\Facade\Str;
-use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
-
-
-class ShopwwiAuthCommand extends Command
-{
-    protected static $defaultName = 'shopwwi:auth';
-    protected static $defaultDescription = 'shopwwi auth';
-
-    /**
-     * @return void
-     */
-    protected function configure()
-    {
-        $this->addArgument('name', InputArgument::OPTIONAL, 'Name description');
-    }
-
-    /**
-     * @param InputInterface $input
-     * @param OutputInterface $output
-     * @return int
-     */
-    protected function execute(InputInterface $input, OutputInterface $output): int
-    {
-        $name = $input->getArgument('name');
-        $output->writeln('生成jwtKey 开始');
-        $key = Str::random(64);
-        file_put_contents(base_path()."/config/plugin/shopwwi/auth/app.php", str_replace(
-            "'access_secret_key' => '".config('plugin.shopwwi.auth.app.jwt.access_secret_key')."'",
-            "'access_secret_key' => '".$key."'",
-            file_get_contents(base_path()."/config/plugin/shopwwi/auth/app.php")
-        ));
-        file_put_contents(base_path()."/config/plugin/shopwwi/auth/app.php", str_replace(
-            "'refresh_secret_key' => '".config('plugin.shopwwi.auth.app.jwt.refresh_secret_key')."'",
-            "'refresh_secret_key' => '".$key."'",
-            file_get_contents(base_path()."/config/plugin/shopwwi/auth/app.php")
-        ));
-        $output->writeln('生成jwtKey 结束'.$key);
-        return self::SUCCESS;
-    }
-
-}

+ 1 - 1
app/controller/api/Goods.php

@@ -61,7 +61,7 @@ class Goods extends Base
             $param['sku_name'] = $param['name'];
             $param['poi_id'] = $goods['poi_id'];
             $param['goods_id'] = $goods['id'];
-            $param['left_goods_id'] = $sku['goods_id'];
+            $param['life_goods_id'] = $sku['goods_id'];
             $state = (new SaasOrder)->setAutoData($param);
             if (!$state) return error("提交订单失败");
             return success("提交成功",['order' => $param['order_sn']]);

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

@@ -3,12 +3,12 @@
 namespace app\controller\api;
 
 use app\extra\basic\Base;
+use app\extra\dyLife\Token;
 use app\extra\dyMini\Relation;
 use app\middleware\AuthMiddleware;
 use LinFly\Annotation\Attributes\Route\Controller;
 use LinFly\Annotation\Attributes\Route\GetMapping;
-use LinFly\Annotation\Attributes\Route\Middleware;
-use LinFly\Annotation\Attributes\Route\PostMapping;
+use LinFly\Annotation\Attributes\Route\RequestMapping;
 use support\Request;
 use support\Response;
 
@@ -22,19 +22,34 @@ class Solution extends Base
 {
 
 
-    #[PostMapping("notify")]
+    #[RequestMapping(path: "notify")]
     public function getSolutionData(Request $request): Response
     {
         try {
             $data = $request->all();
             echo getDateFull()."===扩展回调\n";
             print_r($data);
+            print_r($request->rawBody());
             return json(['err_no' => 0,"err_tips" => "success"]);
         } catch (\Throwable $throwable) {
             return error($throwable->getMessage());
         }
     }
 
+    #[GetMapping("token")]
+    public function setTestToken(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "code.require"  => ""
+            ]);
+            if (!is_array($param)) return error($param);
+            $data = (new Token)->config($this->getDyConfig())->token()->getAccessTokenUser($param['code']);
+            return success("ok",$data);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
 
     #[GetMapping("test")]
     public function setTest()

+ 1 - 1
app/controller/merchant/Goods.php

@@ -41,7 +41,7 @@ class Goods extends Base
         try {
             $param = $request->all();
             $param['poi_id'] = $request->user['store_id'];
-            $data = $this->service->setModel()->getList($request->all());
+            $data = $this->service->setModel()->getList($param);
             return successTrans(100010,pageFormat($data),200);
         } catch (\Throwable $th) {
             return error($th->getMessage());

+ 1 - 0
app/extra/dyLife/BasicLife.php

@@ -85,6 +85,7 @@ class BasicLife
      */
     public function curlPostApi(string $url = "", array $data = [], string $field = "data"): array
     {
+        print_r($this->header);
         $result = Http::asJson()->withHeaders($this->header)->post($this->gateway.$url,$data)->array();
         print_r($result);
         if(!empty($result[$field]))

+ 12 - 0
app/extra/dyLife/Token.php

@@ -24,4 +24,16 @@ class Token extends BasicLife
         return $this->curlPostApi("oauth/client_token/",$data);
     }
 
+
+    public function getAccessTokenUser(string $code = "", string $grantType = 'authorization_code'): array
+    {
+        $data = [
+            "client_key"        => $this->config['appid'],
+            "client_secret"     => $this->config['secret'],
+            "code"              => $code,
+            "grant_type"        => $grantType
+        ];
+        return $this->curlPostApi("oauth/access_token/",$data);
+    }
+
 }

+ 5 - 4
app/extra/dyMini/Relation.php

@@ -44,8 +44,8 @@ class Relation extends BasicLife
                 [
                     "quantity" => 1,
                       "sku_id" => "424144008809807427",
-                      "sku_id_type" => 1,
-                      "price" =>  1,
+                      "sku_id_type" => 2,
+                      "price" =>  100,
                       "discount_amount" => 0,
                       "goods_info" => [
                             "date_rule" => "周一至周日可用",
@@ -54,15 +54,16 @@ class Relation extends BasicLife
                       ]
                 ]
             ],
+            "app_id" => sConf('wechat.mini_appid'),
             "total_amount"  => 1,
             "discount_amount" => 0,
             "phone_num" => "13265000719",
-            "contact_name" => "谢",
+            "contact_name" => "谢",
             "extra" => "AL202605156234065268123",
             "open_id" => "_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u",
             "out_order_no" => "AL202605156234065268123",
             "order_entry_schema" => [
-                "params" => ["order" => "AL202605156234065268123"],
+                "params" => json_encode(["order" => "AL202605156234065268123"]),
                 "path" => "pages/order/detail"
             ]
         ];

+ 1 - 0
app/queue/redis/SyncStore.php

@@ -47,6 +47,7 @@ class SyncStore implements Consumer
                     $inData['poi_address'] = $val['poi']['address'];
                     $inData['poi_account_id'] = $val['account']['poi_account']['account_id'];
                     $inData['store_id'] = $val['account']['parent_account']['account_id'];
+                    $inData['product_type'] = json_encode([]);
                     echo "写入新数据===".getDateFull()."===".json_encode($inData)."\n";
                     $poi->strict(false)->insertGetId($inData);
                 }

+ 1 - 0
app/service/system/UserService.php

@@ -28,6 +28,7 @@ class UserService extends Service
         $filter = [];
         !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
         !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
+        !empty($param['store_id']) && $filter[] = ["store_id", '=', $param['store_id']];
         !empty($param['name']) && $filter[] = ["poi_name", 'like', "%{$param['name']}%"];
         return $filter;
     }

+ 1 - 1
config/think-cache.php

@@ -1,7 +1,7 @@
 <?php
 return [
     // 默认缓存驱动
-    'default' => 'redis',
+    'default' => 'file',
     // 缓存连接方式配置
     'stores'  => [
         // redis缓存