|
@@ -23,82 +23,82 @@ class Goodup extends Base
|
|
|
public function list(){
|
|
|
$page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']):"1";
|
|
|
$size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']):"10";
|
|
|
- $where =[["is_del","=",0]];
|
|
|
+ $where =[["gb.is_del","=",0]];
|
|
|
$condit =[["a.is_del","=",0]];
|
|
|
$cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] !=="" ? intval($this->post['cat_id']):"";
|
|
|
if($cat_id!==""){
|
|
|
$cat_ids=catChild($cat_id);
|
|
|
- $where[]=['cat_id',"in",$cat_ids];
|
|
|
+ $where[]=['gb.cat_id',"in",$cat_ids];
|
|
|
$condit[]=['a.cat_id',"in",$cat_ids];
|
|
|
}
|
|
|
$good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
|
|
|
if($good_name!==""){
|
|
|
- $where[]=['good_name',"like","%$good_name%"];
|
|
|
+ $where[]=['gb.good_name',"like","%$good_name%"];
|
|
|
$condit[]=['a.good_name',"like","%$good_name%"];
|
|
|
}
|
|
|
$spucode = isset($this->post['spucode']) && $this->post['spucode'] !=="" ? trim($this->post['spucode'])
|
|
|
:"";
|
|
|
if($spucode!==""){
|
|
|
- $where[]=['spuCode',"like","%$spucode%"];
|
|
|
+ $where[]=['gb.spuCode',"like","%$spucode%"];
|
|
|
$condit[]=['a.spuCode',"like","%$spucode%"];
|
|
|
}
|
|
|
$good_type = isset($this->post['good_type']) && $this->post['good_type'] !=="" ? trim($this->post['good_type'])
|
|
|
:"";
|
|
|
if($good_type!==""){
|
|
|
- $where[]=['good_type',"=",$good_type];
|
|
|
+ $where[]=['gb.good_type',"=",$good_type];
|
|
|
$condit[]=['a.good_type',"=",$good_type];
|
|
|
}
|
|
|
$companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo'])
|
|
|
:"";
|
|
|
if($companyNo!==""){
|
|
|
- $where[]=['companyNo',"like","%$companyNo%"];
|
|
|
+ $where[]=['gb.companyNo',"like","%$companyNo%"];
|
|
|
$condit[]=['a.companyNo',"like","%$companyNo%"];
|
|
|
}
|
|
|
$supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !=="" ? trim($this->post['supplierNo'])
|
|
|
:"";
|
|
|
if($supplierNo!==""){
|
|
|
- $where[]=['supplierNo',"like","%$supplierNo%"];
|
|
|
+ $where[]=['gb.supplierNo',"like","%$supplierNo%"];
|
|
|
$condit[]=['a.supplierNo',"like","%$supplierNo%"];
|
|
|
}
|
|
|
$supplier = isset($this->post['supplier']) && $this->post['supplier'] !=="" ? trim($this->post['supplier'])
|
|
|
:"";
|
|
|
if($supplier!==""){
|
|
|
$suppliernos = Db::name("supplier")->where([["name","like","%$supplier%"]])->column("code");
|
|
|
- $where[]=['supplierNo',"in",$suppliernos];
|
|
|
+ $where[]=['gb.supplierNo',"in",$suppliernos];
|
|
|
$condit[]=['a.supplierNo',"in",$suppliernos];
|
|
|
}
|
|
|
$company = isset($this->post['company']) && $this->post['company'] !=="" ? trim($this->post['company'])
|
|
|
:"";
|
|
|
if($company!==""){
|
|
|
$companyNos = Db::name("business")->where([["company","like","%$company%"]])->column("companyNo");
|
|
|
- $where[]=['companyNo',"in",$companyNos];
|
|
|
+ $where[]=['gb.companyNo',"in",$companyNos];
|
|
|
$condit[]=['a.companyNo',"in",$companyNos];
|
|
|
}
|
|
|
|
|
|
$brandid = isset($this->post['brandid']) && $this->post['brandid'] !=="" ? intval($this->post['brandid'])
|
|
|
:"";
|
|
|
if($brandid!==""){
|
|
|
- $where[]=['brand_id',"=",$brandid];
|
|
|
+ $where[]=['gb.brand_id',"=",$brandid];
|
|
|
$condit[]=['a.brand_id',"=",$brandid];
|
|
|
}
|
|
|
$status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
|
|
|
:"";
|
|
|
if($status!==""){
|
|
|
- $where[]=['status',"=",$status];
|
|
|
+ $where[]=['gb.status',"=",$status];
|
|
|
$condit[]=['a.status',"=",$status];
|
|
|
}
|
|
|
$is_stock = isset($this->post['is_stock']) && $this->post['is_stock'] !== "" ? intval($this->post['is_stock']) : '';
|
|
|
if ($is_stock!=='') {
|
|
|
- $where[] = ['is_stock', "=", $is_stock];
|
|
|
+ $where[] = ['gb.is_stock', "=", $is_stock];
|
|
|
}
|
|
|
$start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
|
|
|
if($start!==""){
|
|
|
- $where[]=['addtime',">=",date('Y-m-d H:i:s',strtotime($start))];
|
|
|
+ $where[]=['gb.addtime',">=",date('Y-m-d H:i:s',strtotime($start))];
|
|
|
$condit[]=['a.addtime',">=",date('Y-m-d H:i:s',strtotime($start))];
|
|
|
}
|
|
|
$end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
|
|
|
if($end!==""){
|
|
|
- $where[]=['addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
|
|
|
+ $where[]=['gb.addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
|
|
|
$condit[]=['a.addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
|
|
|
}
|
|
|
$isonline = isset($this->post['isonline']) && $this->post['isonline']!=="" ? $this->post['isonline']:"";
|
|
@@ -116,8 +116,8 @@ class Goodup extends Base
|
|
|
->group("a.spuCode")
|
|
|
->column('a.spuCode');
|
|
|
|
|
|
- if($isonline==1) $where[]=["spuCode","in",$sta];
|
|
|
- else $where[]=["spuCode","not in",$sta];
|
|
|
+ if($isonline==1) $where[]=["gb.spuCode","in",$sta];
|
|
|
+ else $where[]=["gb.spuCode","not in",$sta];
|
|
|
}
|
|
|
$token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
|
if($token==""){
|
|
@@ -135,17 +135,29 @@ class Goodup extends Base
|
|
|
// }
|
|
|
// $check = checkRole($useinfo['roleid'],115);
|
|
|
// if($check){
|
|
|
-// $where[]=['createrid', "=" ,$rm];
|
|
|
+// $where[]=['gb.createrid', "=" ,$rm];
|
|
|
// }
|
|
|
// }
|
|
|
$role=$this->checkRole();
|
|
|
if(!empty($role['write'])){
|
|
|
- $where[]=["createrid","in",$role['write']];
|
|
|
+ $where[]=["gb.createrid","in",$role['write']];
|
|
|
}
|
|
|
- $count = Db::name('good_basic')->where($where)->count();
|
|
|
+ $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
+ if ($company_name !== "") $where[] = ["gb.createrid", 'in', get_company_item_user_by_name($company_name)];
|
|
|
+
|
|
|
+
|
|
|
+ $count = Db::name('good_basic')->alias('gb')->where($where)->count();
|
|
|
$total = ceil($count / $size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
- $list = Db::name('good_basic')->where($where)->page($page,$size)->order("addtime desc")->select()->toArray();
|
|
|
+ $list = Db::name('good_basic')
|
|
|
+ ->alias('gb')
|
|
|
+ ->field('gb.*,u.itemid')
|
|
|
+ ->leftJoin("depart_user u", "u.uid=gb.createrid AND u.is_del=0")
|
|
|
+ ->where($where)
|
|
|
+ ->page($page,$size)
|
|
|
+ ->order("addtime desc")
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
$data=[];
|
|
|
|
|
|
//查询一下这些spucode是否在平台上成功上线
|
|
@@ -172,7 +184,9 @@ class Goodup extends Base
|
|
|
$value['is_online'] = 1;
|
|
|
}
|
|
|
|
|
|
- $data[]=$value;
|
|
|
+ $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
+
|
|
|
+ $data[] = $value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
|
|
|
}
|