更新
This commit is contained in:
parent
a48a0cee3c
commit
53dcf129fa
@ -91,10 +91,16 @@ class ProductLibrary extends BaseController
|
||||
if ($code == '') {
|
||||
return app('json')->fail('编码不能为空');
|
||||
}
|
||||
$first_char = substr($code, 0, 1);
|
||||
if($first_char!=0){
|
||||
$codes='0'.$code;
|
||||
}else{
|
||||
$codes=$code;
|
||||
}
|
||||
$client = new Client("b1eb52b9-0379-4c56-b795-47d90a73ca6a");
|
||||
|
||||
$result = $client->barcodeQuery()
|
||||
->withCode($code)
|
||||
->withCode($codes)
|
||||
->request();
|
||||
try {
|
||||
if ($result['code'] == 0) {
|
||||
|
@ -14,14 +14,6 @@ class StoreMicro extends BaseController
|
||||
$where = ['is_used' => 1, 'status' => 1, 'is_del' => 0];
|
||||
$field = 'id,store_name,bar_code,manu_address,price,stock,image,slider_image,spec,trademark,manu_name,manu_address,note';
|
||||
if($code!=''){
|
||||
$len=strlen($code);
|
||||
if ($len <13) {
|
||||
if($len==12){
|
||||
$code='0'.$code;
|
||||
}else{
|
||||
return app('json')->fail('长度不正确'.$code);
|
||||
}
|
||||
}
|
||||
$res=Db::name('product_library')->where('bar_code',$code)->where($where)->field($field)
|
||||
->withAttr('slider_image',function($value,$data){
|
||||
return $value?explode(',',$value):[];
|
||||
@ -173,4 +165,36 @@ class StoreMicro extends BaseController
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 待审核添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$uid=$this->request->userInfo()['uid'];
|
||||
$mer_id=Db::name('store_service')->where(['uid'=>$uid,'status'=>1,'is_del'=>0,'is_goods'=>1])->value('mer_id');
|
||||
$data['store_name'] = $param['store_name'];
|
||||
$data['bar_code'] = $param['bar_code'];
|
||||
$data['store_info'] = '';
|
||||
$data['keyword'] = '';
|
||||
$data['cate_id'] = 0;
|
||||
$data['unit_name'] = '';
|
||||
$data['is_used'] = 1;
|
||||
$data['status'] = 1;
|
||||
$data['price'] = $param['price'];
|
||||
$data['stock'] = $param['stock'];
|
||||
$data['create_time'] = date('Y-m-d H:i:s');
|
||||
$data['image'] = $param['image'];
|
||||
$data['slider_image'] = $param['slider_image'];
|
||||
$data['images'] = $param['images'];
|
||||
$data['mer_id'] = $mer_id;
|
||||
$data['product_library_id'] = $param['product_library_id'];
|
||||
$res = Db::name('product_library_examine')->insert($data);
|
||||
if ($res) {
|
||||
return app('json')->success('添加成功,等待审核');
|
||||
} else {
|
||||
return app('json')->fail('添加失败');
|
||||
}
|
||||
}
|
||||
}
|
@ -50,6 +50,7 @@ Route::group('api/', function () {
|
||||
Route::get('product_details', '/ProductDetails');
|
||||
Route::post('eadt_product', '/eadtProduct');
|
||||
Route::post('product_import', '/ProductImport');
|
||||
Route::post('product_add', '/add');
|
||||
})->prefix('api.store.product.StoreMicro');
|
||||
|
||||
Route::group('v2', function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user