8点20 开始分配订单
This commit is contained in:
parent
a5a985ef19
commit
d95d56d034
|
@ -73,7 +73,7 @@ class IndexController extends base
|
|||
$followOrderId = '';
|
||||
if ($request->admin->id > 1) {
|
||||
$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 - 1;
|
||||
$followMessageList = Orders::where(['admin_id' => $request->admin->id])
|
||||
->whereBetween('next_follow', [$start, $end])
|
||||
->field(['id'])
|
||||
|
|
|
@ -169,9 +169,14 @@ class SpiderDy extends Command
|
|||
// // $this->_kuaishouOrder($start, $end, false);
|
||||
// }
|
||||
|
||||
// 8点20 开始分配订单
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$startTime = strtotime(date('Y-m-d 08:20'));
|
||||
if (time() > $startTime) {
|
||||
$start = date('Y-m-d 00:00:00', strtotime("-{$d} days"));
|
||||
$end = date('Y-m-d 23:59:59');
|
||||
$this->orders($start, $end, false);
|
||||
}
|
||||
|
||||
if (date('H') >= 1 && date('H') <= 7) {
|
||||
$this->reload($output);
|
||||
|
@ -335,7 +340,7 @@ class SpiderDy extends Command
|
|||
// echo '==========pages='.$pages;
|
||||
try {
|
||||
$dou = new Douyin($k);
|
||||
$list = $dou->get($page, $start, $end, '', $k);
|
||||
$list = $dou->get($page, $start, $end, '');
|
||||
$pages = $dou->totalPage;
|
||||
} catch (\Exception $e) {
|
||||
Log::error(dirname(__FILE__) . __LINE__ . $e);
|
||||
|
@ -441,7 +446,7 @@ class SpiderDy extends Command
|
|||
case 3:
|
||||
case 5:
|
||||
$m = new Douyin($item->os);
|
||||
$it = $m->get(1, null, null, $item->sn, $item->os);
|
||||
$it = $m->get(1, null, null, $item->sn);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -194,9 +194,13 @@ class SpiderMt extends Command
|
|||
// // $this->_kuaishouOrder($start, $end, false);
|
||||
// }
|
||||
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$startTime = strtotime(date('Y-m-d 08:20'));
|
||||
if (time() > $startTime) {
|
||||
$start = date('Y-m-d 00:00:00', strtotime("-{$d} days"));
|
||||
$end = date('Y-m-d 23:59:59');
|
||||
$this->orders($start, $end, false);
|
||||
}
|
||||
|
||||
if (date('H') >= 1 && date('H') <= 7) {
|
||||
$this->reload($output);
|
||||
|
|
|
@ -137,7 +137,7 @@ class Douyin
|
|||
* @throws DbException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function get($page, $start = null, $end = null, $orderId = '', $osId = 3)
|
||||
public function get($page, $start = null, $end = null, $orderId = '')
|
||||
{
|
||||
if (empty($start) || empty($end)) {
|
||||
$start = date('Y-m-d 00:00:00');
|
||||
|
@ -157,7 +157,7 @@ class Douyin
|
|||
}
|
||||
|
||||
$_list = [];
|
||||
$list = $this->_certificateList($start, $end, $page, $orderId, $osId);
|
||||
$list = $this->_certificateList($start, $end, $page, $orderId);
|
||||
if (empty($list->data->list) || $list->status_code !== 0) {
|
||||
$this->totalPage = 1;
|
||||
return $_list;
|
||||
|
@ -174,7 +174,7 @@ class Douyin
|
|||
}
|
||||
|
||||
$item = new Orders();
|
||||
$item->os = $osId;
|
||||
$item->os = $this->os;
|
||||
$item->sn = $order->order_id;
|
||||
$item->product_id = $order->sku->sku_id;
|
||||
$item->product_name = $order->sku->title;
|
||||
|
@ -228,7 +228,7 @@ class Douyin
|
|||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function _certificateList($start, $end, $page, $orderId, $osId = '')
|
||||
public function _certificateList($start, $end, $page, $orderId)
|
||||
{
|
||||
$params = [
|
||||
"filter" => [
|
||||
|
@ -249,11 +249,11 @@ class Douyin
|
|||
// Log::error('===_certificateList查询page='.$page.'时间:'.date('Y-m-d H:i:s',$start).'--'.date('Y-m-d H:i:s',$end).'====');
|
||||
$this->_getRetriesLock();
|
||||
|
||||
$list = $this->_curl("/life/trip/fulfilment/v1/query/certificate_list?end_time={$end}&page_index={$page}&page_size=50&start_time={$start}&root_life_account_id=" . $this->_id($osId), $params, 'POST');
|
||||
$list = $this->_curl("/life/trip/fulfilment/v1/query/certificate_list?end_time={$end}&page_index={$page}&page_size=50&start_time={$start}&root_life_account_id=" . $this->_id(), $params, 'POST');
|
||||
|
||||
if (empty($list) || $list->status_code != 0) {
|
||||
$this->_getRetriesLock();
|
||||
$list = $this->_curl("/life/trip/fulfilment/v1/query/certificate_list?end_time={$end}&page_index={$page}&page_size=50&start_time={$start}&root_life_account_id=" . $this->_id($osId), $params, 'POST');
|
||||
$list = $this->_curl("/life/trip/fulfilment/v1/query/certificate_list?end_time={$end}&page_index={$page}&page_size=50&start_time={$start}&root_life_account_id=" . $this->_id(), $params, 'POST');
|
||||
if (empty($list) || $list->status_code != 0) {
|
||||
Log::error('===查询时间:' . $start . '--' . $end . '====certificate_list: ' . json_encode($list));
|
||||
throw new Exception("抖音拉单失败,Err:" . json_encode($list));
|
||||
|
@ -499,7 +499,7 @@ class Douyin
|
|||
|
||||
public function _id($id = '')
|
||||
{
|
||||
if ($id == 5) {
|
||||
if ($this->os == 5) {
|
||||
return '7399206501845403686';
|
||||
} else {
|
||||
// return '7259680722519066679';
|
||||
|
@ -509,9 +509,9 @@ class Douyin
|
|||
|
||||
protected $_try = 0;
|
||||
|
||||
public function _token($token = '', $os = 3)
|
||||
public function _token($token = '')
|
||||
{
|
||||
$dyKey = sprintf('Douyin:token-%s', $os);
|
||||
$dyKey = sprintf('Douyin:token-%s', $this->os);
|
||||
if ($token) Redis::set($dyKey, $token, 'ex', 3600 * 24 - 50);
|
||||
$token = Redis::get($dyKey);
|
||||
if (empty($token) && $this->_cookie()) {
|
||||
|
|
Loading…
Reference in New Issue