|
|
|
@ -3,8 +3,10 @@ |
|
|
|
namespace App\Admin\Extensions\Grid; |
|
|
|
use App\Common\UserStatus; |
|
|
|
use App\Models\Supplier; |
|
|
|
use Dcat\Admin\Admin; |
|
|
|
use Dcat\Admin\Grid\RowAction; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
|
|
|
|
/** |
|
|
|
* 供应商审核 |
|
|
|
@ -38,6 +40,12 @@ class AuditSupplier extends RowAction |
|
|
|
$user->status = $request->action == 1 ? UserStatus::NORMAL : UserStatus::REFUSE; |
|
|
|
$user->save(); |
|
|
|
|
|
|
|
//插入权限表
|
|
|
|
if ($user->status == UserStatus::NORMAL) { |
|
|
|
DB::table(config('admin-supplier.database.role_users_table')) |
|
|
|
->insertOrIgnore(['role_id' => 1, 'user_id' => Admin::user()->id]); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->response()->success("审核成功")->refresh(); |
|
|
|
} catch (\Exception $e) { |
|
|
|
return $this->response()->error($e->getMessage()); |
|
|
|
|