调整店铺采购 商品搜索
This commit is contained in:
parent
ae39afae69
commit
34dfe7e2ad
@ -294,4 +294,14 @@ class MerchantDao extends BaseDao
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getValidMerchant($where)
|
||||||
|
{
|
||||||
|
$where = array_merge([
|
||||||
|
'is_del' => 0,
|
||||||
|
'status' => 1,
|
||||||
|
'mer_state' => 1,
|
||||||
|
], $where);
|
||||||
|
return $this->getModel()::getInstance()->where($where);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace app\controller\api\store\product;
|
namespace app\controller\api\store\product;
|
||||||
|
use app\common\dao\system\merchant\MerchantDao;
|
||||||
|
use app\common\model\system\merchant\Merchant;
|
||||||
use app\common\repositories\store\product\ProductRepository;
|
use app\common\repositories\store\product\ProductRepository;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
@ -8,13 +10,14 @@ class StoreMicro extends BaseController
|
|||||||
{
|
{
|
||||||
function seach_bar_code($mer_id,$code='',$name=''){
|
function seach_bar_code($mer_id,$code='',$name=''){
|
||||||
$category_id=Db::name('merchant')->where('mer_id',$mer_id)->value('category_id');
|
$category_id=Db::name('merchant')->where('mer_id',$mer_id)->value('category_id');
|
||||||
$mer_id=Db::name('merchant')->where('category_id',$category_id)->where('type_id',13)->value('mer_id');
|
$platformMerId = app()->make(MerchantDao::class)->getValidMerchant(['category_id' => $category_id, 'type_id' => Merchant::TypePlatform], 'mer_id')->value('mer_id');
|
||||||
|
$productWhere = ['is_show' => 1, 'status' => 1, 'mer_status' => 1, 'is_del' => 0];
|
||||||
if($code!=''){
|
if($code!=''){
|
||||||
$product_id_arr=Db::name('store_product_attr_value')->where('mer_id',$mer_id)->where('bar_code',$code)->column('product_id');
|
$product_id_arr=Db::name('store_product_attr_value')->where('mer_id',$platformMerId)->where('bar_code',$code)->column('product_id');
|
||||||
$product_id_arr=implode(',',$product_id_arr);
|
$product_id_arr=implode(',',$product_id_arr);
|
||||||
$find=Db::name('store_product')->where('product_id',$product_id_arr)->select();
|
$find=Db::name('store_product')->where('product_id',$product_id_arr)->where($productWhere)->select();
|
||||||
}else{
|
}else{
|
||||||
$find=Db::name('store_product')->where('mer_id',$mer_id)->where('store_name','like','%'.$name.'%')->select();
|
$find=Db::name('store_product')->where('mer_id',$platformMerId)->where('store_name','like','%'.$name.'%')->where($productWhere)->select();
|
||||||
}
|
}
|
||||||
if (count($find)==0){
|
if (count($find)==0){
|
||||||
if($code!=''){
|
if($code!=''){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user