bizLog_1114

This commit is contained in:
dengbw
2022-11-14 15:10:29 +08:00
committed by xiaoyu
parent fbc2122f7e
commit 8f5de125d8
3 changed files with 64 additions and 6 deletions
+2 -2
View File
@@ -130,8 +130,8 @@ class Userslog extends HD_Controller
, 'bills' => $v['bills'], 'reassigns' => $v['reassigns'], 'receives' => $v['receives']
, 'qy_adds' => $v['qy_adds'], 'log_date' => $v['log_date']];
$customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : [];
$c_num_json = $v['customer_json'] ? json_decode($v['c_num_json'], true) : [];
$order_json = $v['customer_json'] ? json_decode($v['order_json'], true) : [];
$c_num_json = $v['c_num_json'] ? json_decode($v['c_num_json'], true) : [];
$order_json = $v['order_json'] ? json_decode($v['order_json'], true) : [];
foreach ($offlineSources as $key1 => $value1) {
$nums = intval($v['customer_' . $key1]);
$nums_c_num = intval($v['c_num_' . $key1]);
+5 -3
View File
@@ -267,7 +267,7 @@ class Licheb extends HD_Controller
echo "开始执行库门店日志[{$hour}]";
}
} else {
echo '[00.00-03.00]执行门店日志[' . $hour . ']';
echo '[03.00-05.00]执行门店日志[' . $hour . ']';
return;
}
$this->load->model("biz/biz_model", 'mdBiz');
@@ -291,6 +291,8 @@ class Licheb extends HD_Controller
}
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
$this->load->model('app/licheb/app_licheb_bizs_log_model', 'mdBizsLog');
$offlineSources = $this->mdCustomers->offlineSources();
$offlineSources_count = count($offlineSources);//一级统计数
foreach ($res as $key => $value) {
$biz_id = $id = $value['id'];
if ($biz_id == 1 || $biz_id == 110) {//门店不写入
@@ -319,7 +321,7 @@ class Licheb extends HD_Controller
$reassigns += $value2['reassigns'];
$receives += $value2['receives'];
//一级统计
for ($ii = 1; $ii < 5; ++$ii) {
for ($ii = 1; $ii <= $offlineSources_count; ++$ii) {
$c_num_ary[$ii] += $value2['c_num_' . $ii];
$order_ary[$ii] += $value2['order_' . $ii];
$customer_ary[$ii] += $value2['customer_' . $ii];
@@ -368,7 +370,7 @@ class Licheb extends HD_Controller
$add_item = ['biz_id' => $biz_id, 'type' => $value['type'], 'city_id' => $value['city_id'], 'c_num' => $c_num
, 'a_num' => $a_num, 't_num' => $t_num, 'orders' => $orders, 'bills' => $bills, 'follows' => $follows, 'defeats' => $defeats
, 'log_date' => $log_date, 'qy_adds' => $qy_adds, 'qy_dels' => $qy_dels, 'reassigns' => $reassigns, 'receives' => $receives, 'c_time' => time()];
for ($ii = 1; $ii < 5; ++$ii) {
for ($ii = 1; $ii <= $offlineSources_count; ++$ii) {
$add_item['c_num_' . $ii] = intval($c_num_ary[$ii]);
$add_item['order_' . $ii] = intval($order_ary[$ii]);
$add_item['customer_' . $ii] = intval($customer_ary[$ii]);
+57 -1
View File
@@ -16,6 +16,62 @@ class Temp extends HD_Controller
$this->log_file = 'temp.log';
}
/**
* Notes:更新门店日志
* Created on: 2022/3/09 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_bizs_log_5
* https://api.liche.cn/plan/temp/receiver_bizs_log_5
*/
public function receiver_bizs_log_5()
{
$param = $this->input->get();
$page = intval($param['page']);
!$page && $page = 0;
ob_start(); //打开缓冲区
$log_date = date("Y-m-d", strtotime("+{$page} day", strtotime("2022-04-15")));
echo "log_date={$log_date}<br>";
if ($log_date >= date("Y-m-d")) {
echo '<br>本次更新门店日志完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $param['page'] . '</span> 次';
echo '<br><br><a href="/plan/temp/receiver_bizs_log_5">点击将再次更新门店日志>>></a>';
exit;
}
$log = [];
$this->load->model('app/licheb/app_licheb_bizs_log_model', 'mdBizsLog');
$res = $this->mdBizsLog->select(['log_date' => $log_date], 'id asc', 0, 0, 'id,c_num_json,order_json,customer_json');
foreach ($res as $k => $v) {
$customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : [];
$c_num_json = $v['c_num_json'] ? json_decode($v['c_num_json'], true) : [];
$order_json = $v['order_json'] ? json_decode($v['order_json'], true) : [];
$upData = [];
if ($customer_json[5]['num']) {
$upData['customer_5'] = $customer_json[5]['num'];
}
if ($c_num_json[5]['num']) {
$upData['c_num_5'] = $c_num_json[5]['num'];
}
if ($order_json[5]['num']) {
$upData['order_5'] = $order_json[5]['num'];
}
if ($upData) {
$ret = $this->mdBizsLog->update($upData, ['id' => $v['id']]);
if ($ret) {
$log[] = $upData;
}
}
}
echo '<br>成功更新:';
if ($log) {
echo json_encode($log, JSON_UNESCAPED_UNICODE);
}
echo '<br><br>数据库获取:';
//echo json_encode($res, JSON_UNESCAPED_UNICODE);
echo 'count=' . count($res);
header('refresh:3;url=/plan/temp/receiver_bizs_log_5?page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新客户初始销售
* Created on: 2022/7/26 11:58
@@ -107,7 +163,7 @@ class Temp extends HD_Controller
$re = $this->mdOwners->get(['o_id' => $value['id']]);
if ($re) {
//$data['u_time'] = $re['u_time'];
// $this->mdOwners->update($data, ['id' => $re['id']]);
// $this->mdOwners->update($data, ['id' => $re['id']]);
} else {
$data['c_time'] = time();
$data['u_time'] = '0000-00-00 00:00:00';