This commit is contained in:
mkm 2023-11-04 11:43:39 +08:00
parent 868fb3ea44
commit 04c91314ee
4 changed files with 17 additions and 12 deletions

View File

@ -188,10 +188,6 @@ class Auth extends BaseController
public function test() public function test()
{ {
$merchant = Db::name('merchant')->where('status', 1)->where('is_del', 0)->where('mer_id',56)->find();
$cityMerchant = Db::name('merchant')->where('status', 1)->where('mer_state', 1)->where('category_id', $merchant['category_id'])->where('type_id', Merchant::TypeSupplyChain)->find();
$product_id = Db::name('store_product')->where('mer_id', $cityMerchant['mer_id'])->where('bar_code', '6926265365132')->value('product_id');
$type = $this->request->param('type'); $type = $this->request->param('type');
$res = []; $res = [];
switch ($type) { switch ($type) {

View File

@ -95,8 +95,11 @@ class CloudWarehouse extends BaseController
* 云仓商品列表 * 云仓商品列表
* @return mixed * @return mixed
*/ */
public function index($street_code,$page_num=1){ public function index($street_code,$page_num=1,$category_id=0){
$cloud_product=Db::name('cloud_product')->where('street_code',$street_code)->where('status',1)->page($page_num)->select(); if($category_id==0){
return app('json')->fail('分类id不能为0');
}
$cloud_product=Db::name('cloud_product')->where('street_code',$street_code)->where('category_id',$category_id)->where('status',1)->page($page_num)->column('product_id');
if(!$cloud_product){ if(!$cloud_product){
return app('json')->success(['count'=>0,'list'=>[]]); return app('json')->success(['count'=>0,'list'=>[]]);
} }
@ -108,10 +111,12 @@ class CloudWarehouse extends BaseController
'mer_status'=>1, 'mer_status'=>1,
]; ];
$count=Db::name('cloud_product')->where('street_code',$street_code)->where('status',1)->count(); $count=Db::name('cloud_product')->where('street_code',$street_code)->where('status',1)->count();
$select=Db::name('store_product')->whereIn('product_id',$cloud_product)->where($where)->select(); $select=Db::name('store_product')->whereIn('product_id',$cloud_product)->where($where)
if(!$select){ ->withAttr('merchant',function($value,$data){
$count=0; return Db::name('merchant')->where('mer_id',$data['mer_id'])->field('mer_id,mer_name')->find();
} })
->field('product_id,mer_id,store_name,bar_code,price,stock,product_type,image')
->select();
return app('json')->success(['count'=>$count,'list'=>$select]); return app('json')->success(['count'=>$count,'list'=>$select]);
} }
} }

View File

@ -72,6 +72,7 @@ class StoreMicro extends BaseController
$id = $this->request->param('id', 0); $id = $this->request->param('id', 0);
$price = $this->request->param('price', 0); $price = $this->request->param('price', 0);
$stock = $this->request->param('stock', 0); $stock = $this->request->param('stock', 0);
$store_name = $this->request->param('store_name', '');
$user = $this->request->userInfo(); $user = $this->request->userInfo();
$where = ['is_used' => 1, 'status' => 1, 'is_del' => 0]; $where = ['is_used' => 1, 'status' => 1, 'is_del' => 0];
try { try {
@ -90,7 +91,7 @@ class StoreMicro extends BaseController
$exist = Db::name('store_product')->where('source_library_id', $id)->where('mer_id', $mer_id)->find(); $exist = Db::name('store_product')->where('source_library_id', $id)->where('mer_id', $mer_id)->find();
if ($exist) { if ($exist) {
return app('json')->fail('已经导入过该商品了'); // return app('json')->fail('已经导入过该商品了');
} }
$find['attrValue']=[ $find['attrValue']=[
['image'=>$find['image'],'price'=>$price,'cost'=>$find['cost'],'ot_price'=>$find['ot_price'], ['image'=>$find['image'],'price'=>$price,'cost'=>$find['cost'],'ot_price'=>$find['ot_price'],
@ -101,6 +102,7 @@ class StoreMicro extends BaseController
}else{ }else{
$product_type=0; $product_type=0;
} }
$find['store_name'] =$store_name??$find['store_name'];
$find['content'] =['image'=>explode(',',$find['images'])]; $find['content'] =['image'=>explode(',',$find['images'])];
$find['slider_image'] =explode(',',$find['slider_image']); $find['slider_image'] =explode(',',$find['slider_image']);
$find['is_show'] = 1; $find['is_show'] = 1;

View File

@ -45,7 +45,7 @@ class ProductCreate
} }
//查询市级供应链商品 //查询市级供应链商品
$product_id = Db::name('store_product')->where('mer_id', $cityMerchant['mer_id'])->where('bar_code', $product['bar_code'])->value('product_id'); $product_id = Db::name('store_product')->where('mer_id', $cityMerchant['mer_id'])->where('bar_code', $product['bar_code'])->value('product_id');
if ($product_id) { if (!$product_id) {
return false; return false;
} }
//添加到云仓 //添加到云仓
@ -54,6 +54,8 @@ class ProductCreate
'mer_id'=>$merchant['mer_id'], 'mer_id'=>$merchant['mer_id'],
'source_mer_id'=>$cityMerchant['mer_id'], 'source_mer_id'=>$cityMerchant['mer_id'],
'street_code'=>$merchant['street_id'], 'street_code'=>$merchant['street_id'],
'type_id'=>$merchant['type_id'],
'category_id'=>$merchant['category_id'],
'weight'=>1, 'weight'=>1,
'status'=>1, 'status'=>1,
'create_time'=>date('Y-m-d H:i:s'), 'create_time'=>date('Y-m-d H:i:s'),