liugc 9 месяцев назад
Родитель
Сommit
7ae7d85ccf

+ 14 - 2
app/api/controller/DouYinController.php

@@ -34,7 +34,7 @@ use think\facade\Log;
 class DouYinController extends BaseApiController
 {
 
-    public array $notNeedLogin = ['testNotify','getClientToken','register','account','getAllGoods','getGoodsDetail','submitOrderNotify','payNotify','payTailNotify'];
+    public array $notNeedLogin = ['testNotify','getClientToken','getOpenid','register','account','goodsNotify','getAllGoods','getGoodsDetail','submitOrderNotify','payNotify','payTailNotify'];
     public function testNotify()
     {
         $params = $this->request->post();
@@ -102,7 +102,19 @@ class DouYinController extends BaseApiController
         return $this->success();
     }
 
-
+    public function getOpenid()
+    {
+        $params = $this->request->post();
+        $toData = [
+            'appid' => 'tt74fb0246ebf34b0601',
+            'secret' => "0c841cc324e8bea8a584d248556d6263fb2dadb2",
+            'code' => $params['code'],
+            'anonymous_code' => $params['anonymous_code']
+        ];
+        $res = http_request('https://developer.toutiao.com/api/apps/v2/jscode2session',$toData,['Content-Type' => 'application/json']);
+        Log::info(json_encode($res));
+        return $this->success('',$res);
+    }
     // ******************************** 列表详情 _商品 _订单 _退款
     /*
      * 商品审核结果回调

+ 7 - 4
app/api/service/DouYinService.php

@@ -193,6 +193,9 @@ class DouYinService
             }
             $platformGoods = $platformGoods->toArray();
             $quantity = $quantity?:1;
+            $appointment_time = strtotime($params['appointment_time']??date('Y-m-d H:i:s',time()));
+            $bookStartTime = $appointment_time * 1000;
+            $bookEndTime = ($appointment_time + (2 * 86400)) * 1000;
             $data = [
                 /*"goodsList" => [
                     "quantity" => $quantity,
@@ -204,24 +207,24 @@ class DouYinService
                 ],*/
                 "skuList" => [
                     [
-                        "quantity" => $quantity,
+                        "quantity" => (int)$quantity,
                         "skuId" => (string)$platformGoods['external_goods_sn'],
                         "skuType" => 1, // 1:商品库商品  2:非商品库商品(融合预约品走加价时,固定传2)
                         "price" => $platformGoods['service_fee'] * 100,
                     ]
                 ],
-                /*"bookInfo" => [
+                "bookInfo" => [
                     "itemBookInfoList"=>[
                         [
                             "poiId" => '7511543640776017961',
                             "shopName" => '亿蜂快修·武汉市',
-                            "outShopId" => self::EXTERNAL_PLATFORM_ID,
+                            "outShopId" => (string)self::EXTERNAL_PLATFORM_ID,
                             "skuId" => (string)$platformGoods['external_goods_sn'],
                             "bookStartTime" => $bookStartTime?:'',
                             "bookEndTime" => $bookEndTime?:'',
                         ]
                     ]
-                ],*/
+                ],
                 "payment" => [
                     "totalAmount" => $quantity * $platformGoods['service_fee'] * 100,
                 ],

+ 1 - 0
app/api/validate/SendSmsValidate.php

@@ -44,6 +44,7 @@ class SendSmsValidate extends BaseValidate
      */
     public function sceneSendCode()
     {
+        if(env('node_env','pro') == 'dev') return $this->only(['mobile','scene']);
         return $this->only(['mobile','scene','verifyCode']);
     }