From da711eed9c1e1f4e09a66c3a026a081db425ceb3 Mon Sep 17 00:00:00 2001 From: jianghanbo Date: Mon, 19 Aug 2024 20:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E9=9F=B3=E5=A2=9E=E5=8A=A0=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/admin/controller/IndexController.php | 24 +++++++++---------- service/app/server/Douyin.php | 16 +++++++++---- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/service/app/admin/controller/IndexController.php b/service/app/admin/controller/IndexController.php index 0dc4e128..3a0062aa 100644 --- a/service/app/admin/controller/IndexController.php +++ b/service/app/admin/controller/IndexController.php @@ -71,18 +71,18 @@ class IndexController extends base // θ·ŸθΏ›ζι†’ $followMessage = 0; $followOrderId = ''; - if ($request->admin->id > 1) { - $start = strtotime(date('Y-m-d')) * 1000; - $end = strtotime(date('Y-m-d', strtotime('+1 days'))) * 1000; - $followMessageList = Orders::where(['admin_id' => $request->admin->id]) - ->whereBetween('next_follow', [$start, $end]) - ->field(['id']) - ->select(); - $followMessage = count($followMessageList); - if ($followMessage) { - $followOrderId = $followMessageList[0]['id']; - } - } +// if ($request->admin->id > 1) { +// $start = strtotime(date('Y-m-d')) * 1000; +// $end = strtotime(date('Y-m-d', strtotime('+1 days'))) * 1000; +// $followMessageList = Orders::where(['admin_id' => $request->admin->id]) +// ->whereBetween('next_follow', [$start, $end]) +// ->field(['id']) +// ->select(); +// $followMessage = count($followMessageList); +// if ($followMessage) { +// $followOrderId = $followMessageList[0]['id']; +// } +// } return $this->success(['new' => $new ?? 0, 'follow' => $follow, 'back' => $backs, 'order_write_off' => $orderWriteOff, 'follow_message' => $followMessage, 'follow_order_id' => $followOrderId]); } diff --git a/service/app/server/Douyin.php b/service/app/server/Douyin.php index d76c7bfe..dacb9a27 100644 --- a/service/app/server/Douyin.php +++ b/service/app/server/Douyin.php @@ -489,8 +489,12 @@ class Douyin public function _cookie($data = '') { - if ($data) Redis::set('Douyin:cookie', $data); - return Redis::get('Douyin:cookie'); + $key = 'Douyin:cookie'; + if ($this->os == 5) { + $key = 'Douyin:cookie-' . $this->os; + } + if ($data) Redis::set($key, $data); + return Redis::get($key); } public function _id($id = '') @@ -549,7 +553,7 @@ class Douyin 'Content-type: application/json' ]; if ($method == 'GET' || $method == 'POST') { - $header[] = 'x-secsdk-csrf-token: ' . $this->_token(); + $header[] = 'x-secsdk-csrf-token: ' . $this->_token('', $this->os); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } else { curl_setopt($ch, CURLOPT_HEADER, 1); @@ -558,12 +562,16 @@ class Douyin $header[] = 'x-secsdk-csrf-request: 1'; } curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); - curl_setopt($ch, CURLOPT_COOKIE, $this->_cookie()); + curl_setopt($ch, CURLOPT_COOKIE, $this->_cookie('')); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath); if ($method == 'POST') { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); + +// if ($this->os == 5) { +// curl_setopt($ch, CURLOPT_COOKIE, $this->_cookie()); +// } } $body = curl_exec($ch);