Merge remote-tracking branch 'shop/dev' into dev
This commit is contained in:
commit
51e993c128
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,9 @@ class Product extends BaseModel
|
|||||||
|
|
||||||
protected $deleteTime = 'is_del';
|
protected $deleteTime = 'is_del';
|
||||||
protected $defaultSoftDelete = 0;
|
protected $defaultSoftDelete = 0;
|
||||||
|
|
||||||
|
const IS_SHOW = 1; //上架
|
||||||
|
const IS_NOT_SHOW = 0; //下架
|
||||||
/**
|
/**
|
||||||
* @Author:Qinii
|
* @Author:Qinii
|
||||||
* @Date: 2020/5/8
|
* @Date: 2020/5/8
|
||||||
|
@ -122,6 +122,7 @@ class Merchant extends BaseModel
|
|||||||
{
|
{
|
||||||
$list = Product::where('mer_id', $this['mer_id'])
|
$list = Product::where('mer_id', $this['mer_id'])
|
||||||
->where((new ProductDao())->productTypeShow(98))
|
->where((new ProductDao())->productTypeShow(98))
|
||||||
|
->where('is_show', Product::IS_SHOW)
|
||||||
->field('mer_id,product_id,product_type,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
->field('mer_id,product_id,product_type,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
||||||
->order('sort DESC, create_time DESC')
|
->order('sort DESC, create_time DESC')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
|
@ -147,6 +147,7 @@ class Merchant extends BaseController
|
|||||||
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
||||||
$data['margin'] = $margin['margin'];
|
$data['margin'] = $margin['margin'];
|
||||||
$data['is_margin'] = $margin['is_margin'];
|
$data['is_margin'] = $margin['is_margin'];
|
||||||
|
$data['ot_margin'] = $data['paid_margin'];
|
||||||
$datas=$data;
|
$datas=$data;
|
||||||
$this->repository->update($id, $datas);
|
$this->repository->update($id, $datas);
|
||||||
return app('json')->success('编辑成功');
|
return app('json')->success('编辑成功');
|
||||||
|
@ -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