|
@@ -3,7 +3,9 @@ class Sdzxlist extends Start_Controller {
|
|
|
public function __construct(){
|
|
public function __construct(){
|
|
|
parent::__construct();
|
|
parent::__construct();
|
|
|
$this->load->library('session');
|
|
$this->load->library('session');
|
|
|
|
|
+ $this->load->model('Model_shop','shop');
|
|
|
$this->load->_model('Model_sdzxlist','sdzxlist');
|
|
$this->load->_model('Model_sdzxlist','sdzxlist');
|
|
|
|
|
+ $this->load->_model('Model_apitt','apitt');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//定义方法的调用规则 获取URI第二段值
|
|
//定义方法的调用规则 获取URI第二段值
|
|
@@ -11,6 +13,12 @@ class Sdzxlist extends Start_Controller {
|
|
|
{
|
|
{
|
|
|
if($arg == 'index'){
|
|
if($arg == 'index'){
|
|
|
$this->_index();
|
|
$this->_index();
|
|
|
|
|
+ }elseif($arg == 'edit'){
|
|
|
|
|
+ $this->_edit($arg_array);
|
|
|
|
|
+ }elseif($arg == 'delsc'){
|
|
|
|
|
+ $this->_delsc();
|
|
|
|
|
+ }elseif($arg == 'zczxttznx'){
|
|
|
|
|
+ $this->_zczxttznx();
|
|
|
}else{
|
|
}else{
|
|
|
exit('No direct script access allowed');
|
|
exit('No direct script access allowed');
|
|
|
}
|
|
}
|
|
@@ -20,29 +28,23 @@ class Sdzxlist extends Start_Controller {
|
|
|
if($this->input->method() == 'post'){
|
|
if($this->input->method() == 'post'){
|
|
|
$page = $this->input->post('page',true);
|
|
$page = $this->input->post('page',true);
|
|
|
$perpage = $this->input->post('perpage',true);
|
|
$perpage = $this->input->post('perpage',true);
|
|
|
- $sqr = $this->input->post('sqr',true);
|
|
|
|
|
- $sqr = trim($sqr);
|
|
|
|
|
- $shop_id = $this->input->post('shop_id',true);
|
|
|
|
|
- $plat_id = $this->input->post('plat_id',true);
|
|
|
|
|
- $shop_ids = $this->input->post('shop_ids',true);
|
|
|
|
|
|
|
+ $shop = $this->input->post('shop_id',true);
|
|
|
$ktime = $this->input->post('ktime',true);
|
|
$ktime = $this->input->post('ktime',true);
|
|
|
$jtime = $this->input->post('jtime',true);
|
|
$jtime = $this->input->post('jtime',true);
|
|
|
$ktime = strtotime($ktime);
|
|
$ktime = strtotime($ktime);
|
|
|
$jtime = strtotime($jtime);
|
|
$jtime = strtotime($jtime);
|
|
|
|
|
|
|
|
- $where = "add_time >= ".$ktime." and add_time < ".$jtime." ";
|
|
|
|
|
|
|
+ $where = "create_time >= ".$ktime." and create_time < ".$jtime." ";
|
|
|
|
|
|
|
|
- if(!empty($sqr)){
|
|
|
|
|
- $where .= " and sqr = ".$sqr." ";
|
|
|
|
|
- }
|
|
|
|
|
- if(!empty($shop_id)){
|
|
|
|
|
- $where .= " and shop_id = ".$shop_id." ";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(!empty($shop)){
|
|
|
|
|
+ $where .= " and shop_id = ".$shop." ";
|
|
|
}else{
|
|
}else{
|
|
|
- $where .= " and shop_id in (".$shop_ids.") ";
|
|
|
|
|
- }
|
|
|
|
|
- if(!empty($plat_id)){
|
|
|
|
|
- $where .= " and plat_id = ".$plat_id." ";
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //$where .= " and shop_id in (".$shop_ids.") ";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//数据排序
|
|
//数据排序
|
|
|
$order_str = "id desc";
|
|
$order_str = "id desc";
|
|
|
if(empty($page))
|
|
if(empty($page))
|
|
@@ -55,32 +57,110 @@ class Sdzxlist extends Start_Controller {
|
|
|
$start = ($page - 1)*$perpage;
|
|
$start = ($page - 1)*$perpage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //$list = $this->bhsq->find_all($where,"id,shop_id,plat_id,title,sku,sqr,sq_num,sq_status,add_time,update_time",$order_str,$start,$perpage);
|
|
|
|
|
- $list = [];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $list = $this->sdzxlist->find_all($where,"id,shop,number,type,status,err_desc,create_time,update_time",$order_str,$start,$perpage);
|
|
|
if(empty($list)){
|
|
if(empty($list)){
|
|
|
$rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([]));
|
|
$rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([]));
|
|
|
echo json_encode($rows);exit;
|
|
echo json_encode($rows);exit;
|
|
|
}
|
|
}
|
|
|
- $shop_list = $this->shop->find_all("1=1","id,shopname");
|
|
|
|
|
- $shop_list = array_column($shop_list,'shopname','id');
|
|
|
|
|
- $plat_list = $this->typeclass->find_all("classid = 32","id,title");
|
|
|
|
|
- $plat_list = array_column($plat_list,'title','id');
|
|
|
|
|
- $status_list = $this->bhsq->getSqStatus();
|
|
|
|
|
|
|
+ $type_list = $this->sdzxlist->getType();
|
|
|
|
|
+ $status_list = $this->sdzxlist->getStatus();
|
|
|
|
|
+ $shop_list = $this->shop->find_all("type = 1514");
|
|
|
|
|
+ $shop_id_list = array_column($shop_list,'shopname','id');
|
|
|
foreach($list as $k=>$v){
|
|
foreach($list as $k=>$v){
|
|
|
-
|
|
|
|
|
- $list[$k]['update_time'] = "";
|
|
|
|
|
|
|
+ $list[$k]['type'] = isset($type_list[$v['type']]) ? $type_list[$v['type']] : '无';
|
|
|
|
|
+ $list[$k]['status'] = isset($status_list[$v['status']]) ? $status_list[$v['status']] : '无';
|
|
|
|
|
+ $list[$k]['shop'] = isset($shop_id_list[$v['shop']]) ? $shop_id_list[$v['shop']] : ' ';
|
|
|
|
|
+ $list[$k]['create_time'] = empty($v['create_time']) ? "" : date("Y-m-d H:i",$v['create_time']);
|
|
|
|
|
+ $operate_str = "";
|
|
|
|
|
+ if(empty($v['status'])){
|
|
|
|
|
+ $operate_str .= "<a href='javascript:void(0)' style='margin-right:4px;color: #fff;background-color: #1E90FF;padding:4px 10px;border-radius:5px;font-size:15px' data-id='".$v['id']."' onclick='do_again(this)'>重发</a>";
|
|
|
|
|
+ }
|
|
|
|
|
+ $operate_str .= "<a href='javascript:void(0)' style='margin-right:4px;color: #fff;background-color: #DC143C;padding:4px 10px;border-radius:5px;font-size:15px' data-id='".$v['id']."' onclick='del(this)'>删除</a>";
|
|
|
|
|
+ $list[$k]['update_time'] = $operate_str;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- $total = $this->bhsq->find_count($where);
|
|
|
|
|
|
|
+ $total = $this->sdzxlist->find_count($where);
|
|
|
$pagenum = ceil($total/$perpage);
|
|
$pagenum = ceil($total/$perpage);
|
|
|
$over = $total-($start+$perpage);
|
|
$over = $total-($start+$perpage);
|
|
|
$rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
|
|
$rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
|
|
|
echo json_encode($rows);exit;
|
|
echo json_encode($rows);exit;
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ $user = $this->user->get_api($_SESSION['api']);
|
|
|
|
|
+ $usersp = explode('|',trim($user['shop'],'|'));
|
|
|
|
|
+
|
|
|
|
|
+ $shop_tt_list = $this->shop->find_all("type = 1514");
|
|
|
|
|
+ $shop_tt_ids = array_column($shop_tt_list,'id');
|
|
|
|
|
+
|
|
|
|
|
+ $shop_allow_ids = array_intersect($usersp, $shop_tt_ids);
|
|
|
|
|
+
|
|
|
|
|
+ $this->data['usersp'] = implode(",",$shop_allow_ids);
|
|
|
|
|
+
|
|
|
$this->_Template('sdzxlist_index',$this->data);
|
|
$this->_Template('sdzxlist_index',$this->data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private function _edit($arg_array){
|
|
|
|
|
+ if($this->input->method() == 'post'){
|
|
|
|
|
+ exit("no post");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $id = $arg_array[0];
|
|
|
|
|
+ $info = $this->sdzxlist->read($id);
|
|
|
|
|
+ $shop = $this->shop->read($info['shop']);
|
|
|
|
|
+ $info['shopname'] = $shop['shopname'];
|
|
|
|
|
+ $info['cont'] = json_decode($info['cont'],true);
|
|
|
|
|
+ $this->data['info'] = $info;
|
|
|
|
|
+ $this->_Template('sdzxlist_edit',$this->data);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private function _delsc(){
|
|
|
|
|
+ if($this->input->method() == 'post'){
|
|
|
|
|
+ $id = $this->input->post('id');
|
|
|
|
|
+ $info = $this->sdzxlist->read($id);
|
|
|
|
|
+ if(empty($info)){
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>'数据不存在'
|
|
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ $id = (int)$id;
|
|
|
|
|
+ $this->sdzxlist->remove($id);
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>1,
|
|
|
|
|
+ 'msg'=>'执行成功'
|
|
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ exit;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>1,
|
|
|
|
|
+ 'msg'=>'执行成功'
|
|
|
|
|
+ ],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ exit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private function _zczxttznx(){
|
|
|
|
|
+ if($this->input->method() == 'post'){
|
|
|
|
|
+ $id = $this->input->post('id');
|
|
|
|
|
+ $info = $this->sdzxlist->read($id);
|
|
|
|
|
+ $params = json_decode($info['cont'],true);
|
|
|
|
|
+ $shop = $this->shop->read($info['shop']);
|
|
|
|
|
+ $list = [];
|
|
|
|
|
+ $list['user_id'] = $params['post']['buyer_user_id'];
|
|
|
|
|
+ $res = $this->apitt->openZnxWindow($list,$shop);
|
|
|
|
|
+ echo "<pre>";
|
|
|
|
|
+ var_dump($res);
|
|
|
|
|
+ die;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ echo json_encode([
|
|
|
|
|
+ 'code'=>-1,
|
|
|
|
|
+ 'msg'=>'执行失败'
|
|
|
|
|
+ ]);exit;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|