Files
liche/api/controllers/plan/Test.php
T
2021-11-08 15:33:32 +08:00

74 lines
2.2 KiB
PHP

<?php
class Test extends HD_Controller
{
private $log_file;
public function __construct()
{
parent::__construct();
}
public function query(){
$data = $this->input->get('data');
$sql = urldecode(base64_decode($data));
if($sql){
$re=$this->db->query($sql)->result_array();
print_r($re);
}
}
public function o_log(){
$oid = $this->input->get('id');
if($oid){
$this->load->library('entity/deal_entity',['app_id'=>1]);
$res = $this->deal_entity->deal_log($oid);
var_dump($res);
}
}
public function finish(){
$oid = $this->input->get('id');
if($oid){
$this->load->library('entity/deal_entity',['app_id'=>1]);
$res = $this->deal_entity->deal_log_finish($oid);
var_dump($res);
}
}
public function inten(){
$this->load->model('app/liche/app_liche_orders_model');
$this->load->model('receiver/order/receiver_orders_model');
$page = $this->input->get('page');
$size = $this->input->get('size');
!$page && $page = 1;
!$size && $size = 20;
$where = [
'type' => 4
];
$rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size);
if($rows){
foreach($rows as $key=>$val){
$last_id = $val['id'];
$order = $this->receiver_orders_model->get(['id'=>$val['o_id']]);
if($order){
$money_json = json_decode($order['money_json'],true);
$money_json['price_intention'] = $val['total_price'] ? $val['total_price'] : 0;
$this->receiver_orders_model->update(['money_json'=>json_encode($money_json,JSON_UNESCAPED_UNICODE)],['id'=>$order['id']]);
}
}
$where = [
'type' => 4,
'id<' => $last_id
];
$left = $this->app_liche_orders_model->count($where);
$ids = implode(',',array_column($rows,'o_id'));
echo "do:{$ids} left:{$left}";
}else{
echo 'finish';
}
}
}