log_file = 'temp.log'; } /** * Notes:更新狸车宝渠道门店 * Created on: 2021/9/18 11:58 * Created by: dengbw * https://liche-api-dev.xiaoyu.com/plan/temp/channel_biz * https://api.liche.cn/plan/temp/channel_biz */ public function channel_biz() { $this->load->model('app/licheb/App_licheb_users_model', 'mdUsers'); $this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz'); $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 ' => 1, 'group_id' => 4); $res = $this->mdUsers->select($where, 'id ASC', $param['page'], $param['size'], 'id,biz_id,uname'); if (!$res) { echo '
本次更新狸车宝渠道门店完成了:'; echo '

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

点击将再次更新狸车宝渠道门店>>>'; exit; } $log = array(); foreach ($res as $key => $value) { if ($value['biz_id']) { $biz_id_arr = explode(',', $value['biz_id']); foreach ($biz_id_arr as $key2 => $value2) { $where = ["uid" => $value['id'], 'biz_id' => $value2]; $re_cb = $this->mdChannelBiz->get($where); if (!$re_cb) { $where['c_time'] = time(); $this->mdChannelBiz->add($where); } } $log[] = array('uname' => $value['uname'], 'biz_id' => $value['biz_id']); $counts++; } } echo '
成功更新:'; $log && print_r($log); echo '

数据库获取:'; echo json_encode($res, JSON_UNESCAPED_UNICODE); header('refresh:3;url=/plan/temp/channel_biz?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); ob_end_flush();//输出全部内容到浏览器 } /** * 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();//输出全部内容到浏览器 } //更新下定时间 public function order_time(){ $this->load->model('receiver/order/receiver_orders_model'); $this->load->model('app/liche/app_liche_orders_model'); $param = $this->input->get(); $param['page'] = intval($param['page']); $param['size'] = intval($param['size']); !$param['size'] && $param['size'] = 50; !$param['page'] && $param['page'] = 1; $where = [ 'status>' => 0, 'order_time' => '0000-00-00 00:00:00', ]; $rows = $this->receiver_orders_model->select($where, 'id ASC', $param['page'], $param['size'], 'id'); if($rows){ foreach($rows as $key=>$val){ $pay_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'status'=>1,'type'=>1]); if(!$pay_row){ $pay_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'status'=>1,'type'=>4]); } if($pay_row){ $this->receiver_orders_model->update(['order_time'=>$pay_row['pay_time']],['id'=>$val['id']]); } } $ids = implode(',',array_column($rows,'id')); echo "do:{$ids} "; }else{ echo 'finish'; } } }