Browse Source

代理商自营产品核销

master
李可松 4 years ago
parent
commit
8fd3f529d6
  1. 8
      MySQL_change.sql
  2. 7
      app/Http/Controllers/Api/VerificationController.php

8
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 '核销人员手机号'; CHANGE `verify_mobile` `verify_mobile` CHAR(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '核销人员手机号';
ALTER TABLE `agent_products` ALTER TABLE `agent_products`
CHANGE COLUMN `verify_mobile` `verify_mobile` CHAR(11) NOT NULL DEFAULT '' COMMENT '核销人员手机号' COLLATE 'utf8_general_ci' AFTER `single_deposit`; 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`;

7
app/Http/Controllers/Api/VerificationController.php

@ -6,6 +6,7 @@ use App\Common\PayType;
use App\Common\StatementType; use App\Common\StatementType;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Agent; use App\Models\Agent;
use App\Models\AgentProduct;
use App\Models\Guide; use App\Models\Guide;
use App\Models\IndustryOrder; use App\Models\IndustryOrder;
use App\Models\Order; use App\Models\Order;
@ -45,7 +46,11 @@ class VerificationController extends Controller
$mobile = User::where('id', $this->user_id)->value('mobile'); $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) { if ($checkMobile) {
return $this->error('对不起,你没有核销权限,请联系管理员'); return $this->error('对不起,你没有核销权限,请联系管理员');
} }

Loading…
Cancel
Save