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('对不起,你没有核销权限,请联系管理员'); }