Customer_727

This commit is contained in:
dengbw
2022-07-27 10:13:27 +08:00
parent 0983683942
commit f4d461f36e
2 changed files with 83 additions and 41 deletions
+82 -41
View File
@@ -16,6 +16,88 @@ class Temp extends HD_Controller
$this->log_file = 'temp.log';
}
/**
* Notes:更新客户初始销售
* Created on: 2022/7/26 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer_sales
* https://api.liche.cn/plan/temp/receiver_customer_sales
*/
public function receiver_customer_sales()
{
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = array("admin_id>" => 0);
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,admin_id,sales_id');
if (!$res) {
echo '<br>本次更新客户初始销售完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/receiver_customer_sales">点击将再次更新客户初始销售>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
if (!$value['sales_id']) {
$this->mdCustomers->update(['sales_id' => $value['admin_id']], ['id' => $value['id']]);
$log[] = array('id' => $value['id'], 'sales_id' => $value['admin_id']);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
header('refresh:3;url=/plan/temp/receiver_customer_sales?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新订单初始销售
* Created on: 2022/7/26 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_ordersv2_sales
* https://api.liche.cn/plan/temp/receiver_ordersv2_sales
*/
public function receiver_ordersv2_sales()
{
$this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrdersV2');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = array("sale_id>" => 0);
$res = $this->mdOrdersV2->select($where, 'id ASC', $param['page'], $param['size'], 'id,admin_id,sale_id');
if (!$res) {
echo '<br>本次更新订单初始销售完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/receiver_ordersv2_sales">点击将再次更新订单初始销售>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
if (!$value['admin_id']) {
$this->mdOrdersV2->update(['admin_id' => $value['sale_id']], ['id' => $value['id']]);
$log[] = array('id' => $value['id'], 'admin_id' => $value['sale_id']);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
header('refresh:3;url=/plan/temp/receiver_ordersv2_sales?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新顾问日志
* Created on: 2022/7/11 11:58
@@ -737,47 +819,6 @@ class Temp extends HD_Controller
}
}
/**
* Notes:更新客户初始销售
* Created on: 2022/3/09 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer_sales
* https://api.liche.cn/plan/temp/receiver_customer_sales
*/
public function receiver_customer_sales()
{
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = array("admin_id>" => 0);
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,admin_id,sales_id');
if (!$res) {
echo '<br>本次更新客户初始销售完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/receiver_customer_sales">点击将再次更新客户初始销售>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
if (!$value['sales_id']) {
$this->mdCustomers->update(['sales_id' => $value['admin_id']], ['id' => $value['id']]);
$log[] = array('id' => $value['id'], 'sales_id' => $value['admin_id']);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
header('refresh:3;url=/plan/temp/receiver_customer_sales?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新客户线下来源
* Created on: 2022/3/09 11:58
@@ -283,6 +283,7 @@ class CusorderV2 extends Wxapp{
'name' => $name ? $name : $row['name'],
'mobile' => $mobile ? $mobile : $row['mobile'],
'biz_id' => $this->biz_id,
'admin_id' => $this->session['uid'],
'sale_id' => $this->session['uid'],
'c_time' => time()
];