抖音增加平台

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;
$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]);
}

View File

@ -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);