This commit is contained in:
mkm 2023-11-20 13:42:46 +08:00
parent f363de8995
commit ee92e1f33c
2 changed files with 28 additions and 25 deletions

View File

@ -244,7 +244,8 @@ class Merchant extends BaseController
if (!$this->repository->exists($id)) if (!$this->repository->exists($id))
return app('json')->fail('数据不存在'); return app('json')->fail('数据不存在');
$admins=$this->request->adminInfo(); $admins=$this->request->adminInfo();
if($admins['admin_id']!=1){ $admin_arr=explode(',',env('MERCHANT_Arr'));
if($admins['admin_id']!=1 && !in_array($admins['roles'],$admin_arr)){
$adminInfo = $adminRepository->merIdByAdmin($id,['account'=>'yy'.$admins['account']],2); $adminInfo = $adminRepository->merIdByAdmin($id,['account'=>'yy'.$admins['account']],2);
if(!$adminInfo){ if(!$adminInfo){
$pwd =password_hash(rand(100000,999999), PASSWORD_BCRYPT); $pwd =password_hash(rand(100000,999999), PASSWORD_BCRYPT);

View File

@ -90,13 +90,18 @@ class StoreProduct extends BaseController
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1; $data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
$data['rate'] = 3; $data['rate'] = 3;
$typeCode = Db::name('merchant_type')->where('mer_type_id', $merchant['type_id'])->value('type_code'); $typeCode = Db::name('merchant_type')->where('mer_type_id', $merchant['type_id'])->value('type_code');
$product_type = 0; //普通商品
if ($merchant['type_id'] == 12) { if ($merchant['type_id'] == 12) {
if ($typeCode == Merchant::TypeCode['TypeSupplyChain']) { if ($typeCode == Merchant::TypeCode['TypeSupplyChain']) {
$product_type = 98; //供应链 $product_type = 98; //供应链
}else{ }
$product_type=0;//普通商品
} }
$productId = $this->repository->create($data, $product_type, 1); $productId = $this->repository->create($data, $product_type, 1);
if ($productId) {
return app('json')->success('添加成功');
} else {
return app('json')->fail('添加失败');
}
// $unique = Db::name('store_product_attr_value')->where('product_id', $productId)->value('unique'); // $unique = Db::name('store_product_attr_value')->where('product_id', $productId)->value('unique');
// if (!empty($unique) && $stockNum > 0) { // if (!empty($unique) && $stockNum > 0) {
// $this->repository->stockIn($merId, [ // $this->repository->stockIn($merId, [
@ -105,8 +110,6 @@ class StoreProduct extends BaseController
// 'number' => $stockNum, // 'number' => $stockNum,
// ]); // ]);
} }
return app('json')->success('添加成功');
}
/** /**
* TODO 编辑 * TODO 编辑
@ -249,5 +252,4 @@ class StoreProduct extends BaseController
return app('json')->fail('入库失败'); return app('json')->fail('入库失败');
} }
} }
} }