log_file = 'temp.log'; } /** * Notes:更新商品操作日志 * Created on: 2021/9/18 11:58 * Created by: dengbw * https://liche-api-dev.xiaoyu.com/plan/temp/items_oplogs * https://api.liche.cn/plan/temp/items_oplogs */ public function items_oplogs() { $this->load->model('items/items_model', 'mdItems'); $this->load->model('items/items_oplogs_model', 'mdItemsOplogs'); $this->load->library('entity/items_entity'); $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('status >' => 0, 'in_time <>' => '0000-00-00 00:00:00'); $res = $this->mdItems->select($where, 'id ASC', $param['page'], $param['size'], 'id,biz_id,addr_id,in_time'); if (!$res) { echo '
本次更新商品操作日志完成了:'; echo '

成功更新 ' . $counts . ' 条'; echo '

点击将再次更新商品操作日志>>>'; exit; } $log = array(); foreach ($res as $key => $value) { $re_c = $this->mdItemsOplogs->get(array('item_id' => $value['id'], 'biz_id' => $value['biz_id'], 'type' => 1)); if (!$re_c['id']) { if ($value['biz_id'] == -1 && !$value['addr_id']) { continue; } $params = array('item_id' => $value['id'], 'type' => 1, 'uid' => 0, 'uname' => '系统' , 'com_time' => $value['in_time'], 'biz_id' => $value['biz_id'], 'addr_id' => $value['addr_id']); $this->items_entity->add_log($params); $log[] = array('id' => $value['id']); $counts++; } } echo '
成功更新:'; $log && print_r($log); echo '

数据库获取:'; echo json_encode($res, JSON_UNESCAPED_UNICODE); header('refresh:3;url=/plan/temp/items_oplogs?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); ob_end_flush();//输出全部内容到浏览器 } /** * Notes:更新客户表来源id * Created on: 2021/9/18 11:58 * Created by: dengbw * https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer * https://api.liche.cn/plan/temp/receiver_customer */ public function receiver_customer() { $this->load->model('receiver/receiver_clues_model', 'mdClues'); $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('rid >' => 0); $res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,rid,cf_id'); if (!$res) { echo '
本次更新客户来源id完成了:'; echo '

成功更新 ' . $counts . ' 条'; echo '

点击将再次更新客户来源id>>>'; exit; } $log = array(); foreach ($res as $key => $value) { $re_c = $this->mdClues->get(array('id' => $value['rid'])); if ($re_c['cf_id']) { $this->mdCustomers->update(array('cf_id' => $re_c['cf_id']), array('id' => $value['id'])); $log[] = array('id' => $value['id'], 'cf_id' => $re_c['cf_id']); $counts++; } } echo '
成功更新:'; $log && print_r($log); echo '

数据库获取:'; echo json_encode($res, JSON_UNESCAPED_UNICODE); header('refresh:3;url=/plan/temp/receiver_customer?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); ob_end_flush();//输出全部内容到浏览器 } }