|
@@ -303,9 +303,11 @@ class Purchin extends Base
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
|
|
|
- //如果开通了供应商账号,则只允许level3账号操作,level2账号不允许操作
|
|
|
- $all_has_supplier_account = checkHasAccountBySupplierNos([$cgdinfo['supplierNo']]);
|
|
|
- if (isset($all_has_supplier_account['data'][$cgdinfo['supplierNo']]) && $this->level == 2) throw new Exception('已开通供应商账号,当前账号不能操作');
|
|
|
+ if ($this->level == 2) {
|
|
|
+ //如果开通了供应商账号,则只允许level3账号操作,level2账号不允许操作
|
|
|
+ $all_has_supplier_account = checkHasAccountBySupplierNos([$cgdinfo['supplierNo']]);
|
|
|
+ if (isset($all_has_supplier_account[$cgdinfo['supplierNo']])) throw new Exception('已开通供应商账号,当前账号不能操作');
|
|
|
+ }
|
|
|
|
|
|
$win = Db::name("purchease_in")->insert($orin,true);
|
|
|
if($win){
|
|
@@ -362,7 +364,11 @@ class Purchin extends Base
|
|
|
// if ($this->uid != $personid) throw new Exception('只能由供应商负责人操作');
|
|
|
// }
|
|
|
|
|
|
-// if ($this->level == 2) {
|
|
|
+ $userCommon = new \app\admin\common\User();
|
|
|
+ $supplier_temp = $userCommon->handle('sInfo',['code'=>$cgdinfo['supplierNo']]);
|
|
|
+ $person = $supplier_temp['data'];
|
|
|
+
|
|
|
+ if ($this->level == 2 && $this->uid != $person['personid']) throw new Exception('只能由供应商负责人操作');
|
|
|
// $person = Db::connect('mysql_sys')
|
|
|
// ->name('supplier')
|
|
|
// ->where('code', $cgdinfo['supplierNo'])
|