更新标签商品
This commit is contained in:
parent
4e5e187763
commit
0d744027c9
@ -2575,4 +2575,39 @@ class ProductRepository extends BaseRepository
|
||||
);
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品到云市场
|
||||
*/
|
||||
public function add_cloud_product($data, $merchant)
|
||||
{
|
||||
if ($data['is_del'] == 1) {
|
||||
return Db::name('cloud_product')->where('product_id', $data['product_id'])->delete();
|
||||
}
|
||||
if ($data['product_id'] && $data['type']) {
|
||||
switch ($data['type']) {
|
||||
case 'two':
|
||||
$data['type'] = 6;
|
||||
break;
|
||||
case 'three':
|
||||
$data['mer_id'] = 7;
|
||||
case 'seven':
|
||||
$data['type'] = 8;
|
||||
}
|
||||
$datas = [
|
||||
'product_id' => $data['product_id'],
|
||||
'mer_id' => $merchant['mer_id'],
|
||||
'source_mer_id' => 0,
|
||||
'street_code' => $merchant['street_id'],
|
||||
'type_id' => $merchant['type_id'],
|
||||
'category_id' => $merchant['category_id'],
|
||||
'weight' => 1,
|
||||
'status' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'mer_labels' => ',' . $data['type'] . ',',
|
||||
];
|
||||
return Db::name('cloud_product')->insert($datas);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -256,4 +256,34 @@ class StoreProduct extends BaseController
|
||||
return app('json')->fail('入库失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商户添加商品到云仓
|
||||
*/
|
||||
public function add_cloud_product()
|
||||
{
|
||||
$data = $this->request->params(['product_id', 'type', 'is_del']);
|
||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $this->merId,])->find();
|
||||
$res = $this->repository->add_cloud_product($data, $merchant);
|
||||
if ($res) {
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 云仓商品列表
|
||||
*/
|
||||
public function cloud_product_list(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $this->merId,])->find();
|
||||
$select=Db::name('store_product_cloud')->where('mer_id',$merchant['mer_id'])
|
||||
->page($page)->limit($limit)->select()->toArray();
|
||||
$count = Db::name('store_product_cloud')->where('mer_id',$merchant['mer_id'])->count();
|
||||
return app('json')->success(['list'=>$select,'count'=>$count]);
|
||||
}
|
||||
}
|
||||
|
@ -425,11 +425,39 @@ class Product extends BaseController
|
||||
/**
|
||||
* 导入商品列表管理
|
||||
*/
|
||||
public function xlsx_import_list(){
|
||||
public function xlsx_import_list()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$select = Db::name('store_product_import')->where('mer_id', $this->request->merId())->page($page)->limit($limit)->select()->toArray();
|
||||
$count = Db::name('store_product_import')->where('mer_id', $this->request->merId())->count();
|
||||
return app('json')->success(['list' => $select, 'count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商户添加商品到云仓
|
||||
*/
|
||||
public function add_cloud_product()
|
||||
{
|
||||
$data = $this->request->params(['product_id', 'type', 'is_del']);
|
||||
$res = $this->repository->add_cloud_product($data, $this->request->merchant());
|
||||
if ($res) {
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 云仓商品列表
|
||||
*/
|
||||
public function cloud_product_list(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
|
||||
$select=Db::name('store_product_cloud')->where('mer_id',$this->request->merId())
|
||||
->page($page)->limit($limit)->select()->toArray();
|
||||
$count = Db::name('store_product_cloud')->where('mer_id',$this->request->merId())->count();
|
||||
return app('json')->success(['list'=>$select,'count'=>$count]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +304,8 @@ Route::group('api/', function () {
|
||||
Route::post('product/good/:id', 'StoreProduct/updateGood');
|
||||
Route::get('product/config', 'StoreProduct/config');
|
||||
Route::post('product/stockIn', 'StoreProduct/stockIn');
|
||||
|
||||
Route::post('product/add_cloud_product', 'StoreProduct/add_cloud_product');
|
||||
Route::get('product/cloud_product_list', 'StoreProduct/cloud_product_list');
|
||||
//商品分类
|
||||
Route::get('category/lst', 'StoreCategory/lst');
|
||||
Route::post('category/create', 'StoreCategory/create');
|
||||
|
@ -204,6 +204,12 @@ Route::group(function () {
|
||||
Route::post('labels/:id', '/setLabels')->name('merchantStoreProductLabels')->option([
|
||||
'_alias' => '标签',
|
||||
]);
|
||||
Route::post('add_cloud_product', '/add_cloud_product')->option([
|
||||
'_alias' => '商户设置云商品',
|
||||
]);
|
||||
Route::get('cloud_product_list', '/cloud_product_list')->option([
|
||||
'_alias' => '云商品列表',
|
||||
]);
|
||||
Route::get('attr_value/:id', '/getAttrValue')->name('merchantStoreProductAttrValue')->option([
|
||||
'_alias' => '获取规格',
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user