6
0
Fork 0

调整问题

release
vine_liutk 2022-01-23 14:28:36 +08:00
parent 07b57cd39d
commit f8397236e2
4 changed files with 15 additions and 2 deletions

View File

@ -2,9 +2,11 @@
namespace App\Admin\Actions\Grid;
use App\Exceptions\BizException;
use App\Models\DealerOrder;
use App\Services\Dealer\OrderService;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Throwable;
@ -43,6 +45,12 @@ class DealerOrderShipping extends RowAction
DB::beginTransaction();
(new OrderService())->shippingOrder($order);
DB::commit();
} catch (QueryException $e) {
DB::rollBack();
if (strpos($e->getMessage(), 'Numeric value out of range') !== false) {
$e = new BizException('当前可发货库存不足');
}
return $this->response()->error('操作失败,'.$e->getMessage())->refresh();
} catch (Throwable $th) {
DB::rollBack();
report($th);

View File

@ -29,12 +29,13 @@ class DealerController extends AdminController
*/
protected function grid()
{
$builder = Dealer::with(['user', 'userInfo', 'userInfo.inviterInfo.user']);
$builder = Dealer::with(['user', 'userInfo', 'userInfo.inviterInfo.user', 'userInfo.realInviterInfo.user']);
return Grid::make($builder, function (Grid $grid) {
// $grid->column('id')->sortable();
$grid->column('user.phone')->copyable();
$grid->column('userInfo.nickname');
$grid->column('userInfo.inviterInfo.user.phone')->copyable();
$grid->column('userInfo.realInviterInfo.user.phone')->copyable();
// $grid->column('user_id');
$grid->column('lvl')->display(function () {
return $this->lvl_text;

View File

@ -16,7 +16,6 @@ class Administrator extends DcatAdministrator
return true;
}
//判断是否有权限
dd($slug, $this->getCachePermissions());
return in_array($slug, $this->getCachePermissions());
}

View File

@ -22,6 +22,11 @@ return [
'phone' =>'推荐人手机',
],
],
'realInviterInfo'=>[
'user'=>[
'phone' =>'老直推手机',
],
],
],
'lvl' => '经销商等级',
'is_sale' => '是否可销售',