From 8fd3f529d6836a6dd08408779756ff2eff6bf688 Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 31 Oct 2021 15:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E8=87=AA=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=A0=B8=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MySQL_change.sql | 8 ++++++++ app/Http/Controllers/Api/VerificationController.php | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/MySQL_change.sql b/MySQL_change.sql index 1d7d1f4..9dea4f5 100644 --- a/MySQL_change.sql +++ b/MySQL_change.sql @@ -444,3 +444,11 @@ ALTER TABLE `products` CHANGE `verify_mobile` `verify_mobile` CHAR(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '核销人员手机号'; ALTER TABLE `agent_products` CHANGE COLUMN `verify_mobile` `verify_mobile` CHAR(11) NOT NULL DEFAULT '' COMMENT '核销人员手机号' COLLATE 'utf8_general_ci' AFTER `single_deposit`; +ALTER TABLE `users` + CHANGE COLUMN `mobile` `mobile` CHAR(11) NOT NULL DEFAULT '' COMMENT '手机号' COLLATE 'utf8_general_ci' AFTER `id`; + +# 15:01 ‎2021/‎10/‎31 +ALTER TABLE `collect_products` + CHANGE COLUMN `verify_mobile` `verify_mobile` CHAR(11) NOT NULL DEFAULT '' COMMENT '核销人员手机号' COLLATE 'utf8_general_ci' AFTER `agent_id`; +ALTER TABLE `industry_products` + CHANGE COLUMN `verify_mobile` `verify_mobile` CHAR(11) NOT NULL DEFAULT '' COMMENT '核销人员手机号' COLLATE 'utf8_general_ci' AFTER `min_sale`; diff --git a/app/Http/Controllers/Api/VerificationController.php b/app/Http/Controllers/Api/VerificationController.php index cb7be6b..aaabd41 100644 --- a/app/Http/Controllers/Api/VerificationController.php +++ b/app/Http/Controllers/Api/VerificationController.php @@ -6,6 +6,7 @@ use App\Common\PayType; use App\Common\StatementType; use App\Http\Controllers\Controller; use App\Models\Agent; +use App\Models\AgentProduct; use App\Models\Guide; use App\Models\IndustryOrder; use App\Models\Order; @@ -45,7 +46,11 @@ class VerificationController extends Controller $mobile = User::where('id', $this->user_id)->value('mobile'); - $checkMobile = Product::query()->whereIn('id', explode(',', $order->product_ids))->where('verify_mobile', $mobile)->doesntExist(); + if ($order->product_id) { + $checkMobile = Product::query()->whereIn('id', explode(',', $order->product_ids))->where('verify_mobile', $mobile)->doesntExist(); + } else { + $checkMobile = AgentProduct::where(['id' => $order->agent_product_id, 'verify_mobile' => $mobile])->doesntExist(); + } if ($checkMobile) { return $this->error('对不起,你没有核销权限,请联系管理员'); }