更新代码
This commit is contained in:
parent
6e1272781a
commit
3f9bee5592
@ -14,8 +14,13 @@ class StoreMicro extends BaseController
|
|||||||
$where = ['is_used' => 1, 'status' => 1, 'is_del' => 0];
|
$where = ['is_used' => 1, 'status' => 1, 'is_del' => 0];
|
||||||
$field = 'id,store_name,bar_code,unit_name,price,cost,ot_price,stock,image';
|
$field = 'id,store_name,bar_code,unit_name,price,cost,ot_price,stock,image';
|
||||||
if($code!=''){
|
if($code!=''){
|
||||||
if (strlen($code) <13) {
|
$len=strlen($code);
|
||||||
return app('json')->success('条形码长度不正确');
|
if ($len <13) {
|
||||||
|
if($len==12){
|
||||||
|
$code='0'.$code;
|
||||||
|
}else{
|
||||||
|
return app('json')->success('条形码长度不正确');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$res=Db::name('product_library')->where('bar_code',$code)->where($where)->field($field)->find();
|
$res=Db::name('product_library')->where('bar_code',$code)->where($where)->field($field)->find();
|
||||||
if($res==null){
|
if($res==null){
|
||||||
@ -70,8 +75,12 @@ class StoreMicro extends BaseController
|
|||||||
if ($mer_id == 0) {
|
if ($mer_id == 0) {
|
||||||
return app('json')->fail('商户不存在');
|
return app('json')->fail('商户不存在');
|
||||||
}
|
}
|
||||||
// $mer= Db::name('merchant')->where('mer_id', $mer_id)->where('status', 1)->find();
|
$mer= Db::name('merchant')->where('mer_id', $mer_id)->find();
|
||||||
|
$category_name= Db::name('merchant_category')->where('merchant_category_id', $mer['category_id'])->value('category_name');
|
||||||
|
$store_category_id= Db::name('store_category')->where(['cate_name'=>$category_name,'level'=>2,'mer_id'=>0])->value('store_category_id');
|
||||||
|
if(!$store_category_id){
|
||||||
|
return app('json')->fail('没有对应的分类,请联系工作人员添加');
|
||||||
|
}
|
||||||
$find=Db::name('product_library')->where('id',$id)->where($where)->find();
|
$find=Db::name('product_library')->where('id',$id)->where($where)->find();
|
||||||
if ($find) {
|
if ($find) {
|
||||||
|
|
||||||
@ -104,6 +113,7 @@ class StoreMicro extends BaseController
|
|||||||
$find['source_library_id'] = $find['id'];
|
$find['source_library_id'] = $find['id'];
|
||||||
$find['spec_type'] = 0;
|
$find['spec_type'] = 0;
|
||||||
$find['delivery_free'] = 0;
|
$find['delivery_free'] = 0;
|
||||||
|
$find['cate_id'] = $store_category_id;
|
||||||
unset($find['create_time']);
|
unset($find['create_time']);
|
||||||
}
|
}
|
||||||
$a= app()->make( ProductRepository::class)->create($find,0,1);
|
$a= app()->make( ProductRepository::class)->create($find,0,1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user