抖音增加平台

This commit is contained in:
jianghanbo 2024-08-19 20:47:34 +08:00
parent a1067ea50d
commit da711eed9c
2 changed files with 24 additions and 16 deletions

View File

@ -71,18 +71,18 @@ class IndexController extends base
// 跟进提醒 // 跟进提醒
$followMessage = 0; $followMessage = 0;
$followOrderId = ''; $followOrderId = '';
if ($request->admin->id > 1) { // if ($request->admin->id > 1) {
$start = strtotime(date('Y-m-d')) * 1000; // $start = strtotime(date('Y-m-d')) * 1000;
$end = strtotime(date('Y-m-d', strtotime('+1 days'))) * 1000; // $end = strtotime(date('Y-m-d', strtotime('+1 days'))) * 1000;
$followMessageList = Orders::where(['admin_id' => $request->admin->id]) // $followMessageList = Orders::where(['admin_id' => $request->admin->id])
->whereBetween('next_follow', [$start, $end]) // ->whereBetween('next_follow', [$start, $end])
->field(['id']) // ->field(['id'])
->select(); // ->select();
$followMessage = count($followMessageList); // $followMessage = count($followMessageList);
if ($followMessage) { // if ($followMessage) {
$followOrderId = $followMessageList[0]['id']; // $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]); return $this->success(['new' => $new ?? 0, 'follow' => $follow, 'back' => $backs, 'order_write_off' => $orderWriteOff, 'follow_message' => $followMessage, 'follow_order_id' => $followOrderId]);
} }

View File

@ -489,8 +489,12 @@ class Douyin
public function _cookie($data = '') public function _cookie($data = '')
{ {
if ($data) Redis::set('Douyin:cookie', $data); $key = 'Douyin:cookie';
return Redis::get('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 = '') public function _id($id = '')
@ -549,7 +553,7 @@ class Douyin
'Content-type: application/json' 'Content-type: application/json'
]; ];
if ($method == 'GET' || $method == 'POST') { 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); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
} else { } else {
curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HEADER, 1);
@ -558,12 +562,16 @@ class Douyin
$header[] = 'x-secsdk-csrf-request: 1'; $header[] = 'x-secsdk-csrf-request: 1';
} }
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); 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_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
if ($method == 'POST') { if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
// if ($this->os == 5) {
// curl_setopt($ch, CURLOPT_COOKIE, $this->_cookie());
// }
} }
$body = curl_exec($ch); $body = curl_exec($ch);