Commit 5017175f by mushishixian

fix

parent bd9ba22a
......@@ -38,12 +38,17 @@ class SupplierShareApplyApiController extends Controller
}
$userId = $request->user->userId;
$codeId = $request->user->codeId;
if (empty($codeId)) {
$this->response(-1, '你还没有绑定内部编码,无法申请共用');
}
//要判断自己是不是有这个供应商了,有的话没必要申请
$isOwn = $supplierModel->where('supplier_name', $supplierName)->where(function ($q) use ($userId, $codeId) {
$q->where('create_uid', $userId)
->orWhere('purchase_uid', $codeId)
->orwhere('channel_uid', 'like', "%$codeId%");
})->where('is_type', 0)->count();
$q->where('create_uid', $userId);
if (!empty($codeId)) {
$q->orWhere('purchase_uid', $codeId)
->orwhere('channel_uid', 'like', "%$codeId%");
}
})->where('is_type', 0)->first();
if ($isOwn) {
$this->response(-1, '你已经可以管理该供应商,无需申请共用');
}
......@@ -74,6 +79,9 @@ class SupplierShareApplyApiController extends Controller
if (empty($map['apply_department_id']) || empty($map['supplier_id'])) {
$this->response(-1, '缺少参数');
}
if (empty($request->user->codeId)) {
$this->response(-1, '你还没有绑定内部编码,无法申请共用');
}
$map['apply_code_id'] = $request->user->codeId;
$applyService = new SupplierShareApplyService();
$hasNoFinish = $applyService->checkHasNoFinishApply($map);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment