customers_429_2
This commit is contained in:
@@ -126,15 +126,16 @@ class Temp extends HD_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:更新战败客户信息
|
||||
* Notes:更新战败客户到店
|
||||
* Created on: 2022/3/09 11:58
|
||||
* Created by: dengbw
|
||||
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer_defeat
|
||||
* https://api.liche.cn/plan/temp/receiver_customer_defeat
|
||||
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer_oplogs
|
||||
* https://api.liche.cn/plan/temp/receiver_customer_oplogs
|
||||
*/
|
||||
public function receiver_customer_defeat()
|
||||
public function receiver_customer_oplogs()
|
||||
{
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model('receiver/receiver_customer_oplogs_model', 'mdCustomersOplogs');
|
||||
$param = $this->input->get();
|
||||
$param['page'] = intval($param['page']);
|
||||
$param['size'] = intval($param['size']);
|
||||
@@ -142,30 +143,20 @@ class Temp extends HD_Controller
|
||||
!$param['page'] && $param['page'] = 1;
|
||||
$counts = intval($param['counts']);
|
||||
ob_start(); //打开缓冲区
|
||||
$where = ["status=3 OR defeat_time<>0" => null];
|
||||
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,jsondata,status,defeat_time');
|
||||
$where = ["type" => 4];
|
||||
$res = $this->mdCustomersOplogs->select($where, 'id ASC', $param['page'], $param['size'], 'customer_id');
|
||||
if (!$res) {
|
||||
echo '<br>本次更新战败客户信息完成了:';
|
||||
echo '<br>本次更新完成了:';
|
||||
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
|
||||
echo '<br><br><a href="/plan/temp/receiver_customer_defeat">点击将再次更新战败客户信息>>></a>';
|
||||
echo '<br><br><a href="/plan/temp/receiver_customer_oplogs">点击将再次更新>>></a>';
|
||||
exit;
|
||||
}
|
||||
$log = array();
|
||||
foreach ($res as $key => $value) {
|
||||
$upDate = [];
|
||||
if ($value['status'] == 3) {
|
||||
$jsondata = $value['jsondata'] ? json_decode($value['jsondata'], true) : [];
|
||||
if ($jsondata['defeat']['pass_time']) {
|
||||
$upDate = ['def_time' => $jsondata['defeat']['pass_time']];//更新战败时间
|
||||
}
|
||||
} else if ($value['defeat_time'] > 0) {//申请中
|
||||
$upDate = ['if_defeat' => 1];
|
||||
} else if ($value['defeat_time'] == -1) {//再战
|
||||
$upDate = ['if_defeat' => 2];
|
||||
}
|
||||
if ($upDate) {
|
||||
$this->mdCustomers->update($upDate, ['id' => $value['id']]);
|
||||
$log[] = ['id' => $value['id'], 'upDate' => $upDate];
|
||||
$re = $this->mdCustomers->get(['id' => $value['customer_id']], 'id,a_num,name');
|
||||
if ($re && $re['a_num'] == 0) {
|
||||
$this->mdCustomers->update(['a_num' => 1], ['id' => $re['id']]);
|
||||
$log[] = ['id' => $re['id'], 'name' => $re['name']];
|
||||
$counts++;
|
||||
}
|
||||
}
|
||||
@@ -173,7 +164,7 @@ class Temp extends HD_Controller
|
||||
$log && print_r($log);
|
||||
echo '<br><br>数据库获取:';
|
||||
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||
header('refresh:3;url=/plan/temp/receiver_customer_defeat?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
|
||||
header('refresh:3;url=/plan/temp/receiver_customer_oplogs?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
|
||||
ob_end_flush();//输出全部内容到浏览器
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user