Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-php into dev
This commit is contained in:
commit
2ddf2e98f7
@ -116,7 +116,7 @@ class StoreCartDao extends BaseDao
|
||||
->append(['bc_extension_one', 'bc_extension_two']);
|
||||
},
|
||||
'merchant' => function (Relation $query) use ($uid) {
|
||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id')
|
||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id,credit_buy,settle_cycle,interest_rate')
|
||||
->with([
|
||||
'coupon' => function ($query) use ($uid) {
|
||||
$query->where('uid', $uid);
|
||||
|
@ -10,18 +10,21 @@ class StoreMicro extends BaseController
|
||||
{
|
||||
function seach_bar_code($mer_id,$code='',$name=''){
|
||||
$category_id=Db::name('merchant')->where('mer_id',$mer_id)->value('category_id');
|
||||
$typePlatformId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypePlatform'])->value('mer_type_id');
|
||||
$platformMerId = app()->make(MerchantDao::class)->getValidMerchant(['category_id' => $category_id, 'type_id' => $typePlatformId], 'mer_id')->value('mer_id');
|
||||
$typePlatformId = Db::name('MerchantType')->where('type_code', 'in',[Merchant::TypeCode['TypePlatform'],Merchant::TypeCode['TypeTownSupplyChain']])->column('mer_type_id');
|
||||
$platformMerId = app()->make(MerchantDao::class)->getValidMerchant(['category_id' => $category_id])->whereIn('type_id',$typePlatformId)->column('mer_id');
|
||||
if($platformMerId==null){
|
||||
return app('json')->fail('没有市级供应链或者镇级供应链');
|
||||
}
|
||||
$productWhere = ['is_show' => 1, 'status' => 1, 'mer_status' => 1, 'is_del' => 0];
|
||||
if($code!=''){
|
||||
if (strlen($code) != 13) {
|
||||
return app('json')->success('条形码长度不正确');
|
||||
}
|
||||
$product_id_arr=Db::name('store_product_attr_value')->where('mer_id',$platformMerId)->where('bar_code',$code)->column('product_id');
|
||||
$product_id_arr=Db::name('store_product_attr_value')->whereIn('mer_id',$platformMerId)->where('bar_code',$code)->column('product_id');
|
||||
$product_id_arr=implode(',',$product_id_arr);
|
||||
$find=Db::name('store_product')->where('product_id',$product_id_arr)->where($productWhere)->select();
|
||||
}else{
|
||||
$find=Db::name('store_product')->where('mer_id',$platformMerId)->where('store_name','like','%'.$name.'%')->where($productWhere)->select();
|
||||
$find=Db::name('store_product')->whereIn('mer_id',$platformMerId)->where('store_name','like','%'.$name.'%')->where($productWhere)->select();
|
||||
}
|
||||
if (count($find)==0){
|
||||
if($code!=''){
|
||||
|
Loading…
x
Reference in New Issue
Block a user