diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 2a090cd52..28fd3f781 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -44,11 +44,6 @@ class IndexController extends BaseApiController public function index() { - $a=StoreProduct::where('is_show',1)->select(); - foreach($a as $k=>$v){ - $find=StoreBranchProduct::where('product_id',$v['id'])->find(); - StoreProduct::where('id',$v['id'])->update(['top_cate_id'=>$find['top_cate_id'],'two_cate_id'=>$find['two_cate_id'],'cate_id'=>$find['cate_id']]); - } return json([1]); } diff --git a/app/api/logic/order/CartLogic.php b/app/api/logic/order/CartLogic.php index 33e387349..2ad0c6107 100644 --- a/app/api/logic/order/CartLogic.php +++ b/app/api/logic/order/CartLogic.php @@ -84,12 +84,19 @@ class CartLogic extends BaseLogic { Db::startTrans(); try { - Cart::where([ - 'uid' => $params['uid'], - 'store_id' => $params['store_id'], - 'product_id' => $params['product_id'] - ]) - ->update(['cart_num' => $params['cart_num']]); + if(isset($params['type']) && $params['type']=='inc'){ + Cart::where([ + 'uid' => $params['uid'], + 'store_id' => $params['store_id'], + 'product_id' => $params['product_id'] + ])->inc('cart_num')->update(); + }else{ + Cart::where([ + 'uid' => $params['uid'], + 'store_id' => $params['store_id'], + 'product_id' => $params['product_id'] + ])->update(['cart_num' => $params['cart_num']]); + } Db::commit(); return true; } catch (\Throwable $e) { diff --git a/app/store/validate/LoginValidate.php b/app/store/validate/LoginValidate.php index b7c80593f..89b79407b 100644 --- a/app/store/validate/LoginValidate.php +++ b/app/store/validate/LoginValidate.php @@ -10,7 +10,7 @@ use app\common\model\auth\Admin; use app\common\model\system_store\SystemStoreStaff; use app\common\service\ConfigService; use app\common\validate\BaseValidate; -use app\MyBusinessException; +use support\exception\BusinessException; use Webman\Config; class LoginValidate extends BaseValidate @@ -55,7 +55,7 @@ class LoginValidate extends BaseValidate //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解 if ($config['login_restrictions'] == 1 && !$adminAccountSafeCache->isSafe()) { - throw new MyBusinessException('密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试'); + throw new BusinessException('密码连续' . $adminAccountSafeCache->count . '次输入错误,请' . $adminAccountSafeCache->minute . '分钟后重试'); } $staffInfo = SystemStoreStaff::where('account', '=', $data['account']) @@ -63,21 +63,21 @@ class LoginValidate extends BaseValidate ->findOrEmpty(); if ($staffInfo->isEmpty()) { - return '账号不存在'; + throw new BusinessException('账号不存在'); } if ($staffInfo['disable'] === 1) { - return '账号已禁用'; + throw new BusinessException('账号已禁用'); } if (empty($staffInfo['pwd'])) { $adminAccountSafeCache->record(); - return '账号不存在'; + throw new BusinessException('账号不存在'); } $pwdSalt = Config::get('project.unique_identification'); if ($staffInfo['pwd'] !== create_password($password, $pwdSalt)) { $adminAccountSafeCache->record(); - return '密码错误'; + throw new BusinessException('密码错误'); } $adminAccountSafeCache->relieve();