release
parent
3ca9b852d0
commit
fd0c7e11cf
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Repositories\Dealer;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
use Dcat\Admin\Http\Controllers\AdminController;
|
||||
use Dcat\Admin\Show;
|
||||
|
||||
class DealerController extends AdminController
|
||||
{
|
||||
/**
|
||||
* Make a grid builder.
|
||||
*
|
||||
* @return Grid
|
||||
*/
|
||||
protected function grid()
|
||||
{
|
||||
$builder = Dealer::with(['user', 'userInfo', 'userInfo.inviterInfo.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('user_id');
|
||||
$grid->column('lvl')->display(function () {
|
||||
return $this->lvl_text;
|
||||
});
|
||||
$grid->column('is_sale');
|
||||
$grid->column('is_manager');
|
||||
// $grid->column('pay_info');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->equal('id');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a show builder.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return Show
|
||||
*/
|
||||
protected function detail($id)
|
||||
{
|
||||
return Show::make($id, new Dealer(), function (Show $show) {
|
||||
$show->field('id');
|
||||
$show->field('user_id');
|
||||
$show->field('lvl');
|
||||
$show->field('is_sale');
|
||||
$show->field('is_manager');
|
||||
$show->field('pay_info');
|
||||
$show->field('created_at');
|
||||
$show->field('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
return Form::make(new Dealer(), function (Form $form) {
|
||||
$form->display('id');
|
||||
$form->text('user_id');
|
||||
$form->text('lvl');
|
||||
$form->text('is_sale');
|
||||
$form->text('is_manager');
|
||||
$form->text('pay_info');
|
||||
|
||||
$form->display('created_at');
|
||||
$form->display('updated_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Repositories;
|
||||
|
||||
use App\Models\Dealer as Model;
|
||||
use Dcat\Admin\Repositories\EloquentRepository;
|
||||
|
||||
class Dealer extends EloquentRepository
|
||||
{
|
||||
/**
|
||||
* Model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $eloquentClass = Model::class;
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@ class OrderPackageService
|
|||
$_orderProduct->decrement('remain_quantity', $product['quantity']);
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
|
||||
|
||||
if (!$package) {
|
||||
|
|
@ -98,6 +99,34 @@ class OrderPackageService
|
|||
'updated_at' => $package->created_at,
|
||||
]);
|
||||
}, $packageProducts));
|
||||
=======
|
||||
//创建发货单数据
|
||||
$package = new OrderPackage();
|
||||
$package->order_id = $order->id;
|
||||
$package->user_id = $order->user_id;
|
||||
$package->consignee_name = $order->consignee_name;
|
||||
$package->consignee_telephone = $order->consignee_telephone;
|
||||
$package->consignee_zone = $order->consignee_zone;
|
||||
$package->consignee_address = $order->consignee_address;
|
||||
|
||||
$package->shipping_company = $params['shipping_company'];
|
||||
$package->shipping_code = Arr::get(Kuaidi100Service::$codeArr, $package->shipping_company, '');
|
||||
$package->shipping_number = $params['shipping_number'];
|
||||
|
||||
//保存发货单
|
||||
$package->save();
|
||||
//保存发货单商品
|
||||
OrderPackageProduct::insert(array_map(function ($value) use ($package) {
|
||||
return array_merge($value, [
|
||||
'order_package_id' => $package->id,
|
||||
'created_at' => $package->created_at,
|
||||
'updated_at' => $package->created_at,
|
||||
]);
|
||||
}, $packageProducts));
|
||||
if (config('settings.kuaidi100_is_use')) {
|
||||
$kuaidi100Service = new Kuaidi100Service();
|
||||
$kuaidi100Service->poll($package->shipping_number, $package->shipping_code, $package->consignee_telephone);
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
//更新订单状态
|
||||
|
|
|
|||
|
|
@ -167,6 +167,9 @@ Route::group([
|
|||
$router->resource('dealer-orders', 'DealerOrderController')->only([
|
||||
'index', 'edit', 'update',
|
||||
])->names('dealer_orders');
|
||||
$router->resource('dealers', 'DealerController')->only([
|
||||
'index',
|
||||
])->names('dealers');
|
||||
|
||||
/** api接口 **/
|
||||
$router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories');
|
||||
|
|
|
|||
|
|
@ -117,7 +117,11 @@ class OrderController extends Controller
|
|||
{
|
||||
$order = $request->user()->orders()->findOrFail($id);
|
||||
$order->load('products');
|
||||
<<<<<<< Updated upstream
|
||||
$order->load('lastPackage');
|
||||
=======
|
||||
$order->load('packages');
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
return OrderResource::make($order);
|
||||
}
|
||||
|
|
@ -205,4 +209,26 @@ class OrderController extends Controller
|
|||
'shipping_info'=> KuaidiLog::where(['number'=>$package->shipping_number, 'code'=>$package->shipping_code])->first()?->info,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单包裹列表
|
||||
*/
|
||||
public function orderPackages($id, Request $request)
|
||||
{
|
||||
$order = $request->user()->orders()->findOrFail($id);
|
||||
return OrderPackageResource::collection($order->packages()->where('is_failed', false)->orderBy('updated_at', 'desc')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 物流包裹的明细
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function shippingInfo($id, Request $request)
|
||||
{
|
||||
$package = $request->user()->orderPackages()->where('is_failed', false)->findOrFail($id);
|
||||
return response()->json(array_merge(OrderPackageResource::make($package)->resolve(), [
|
||||
'shipping_info'=> KuaidiLog::where(['number'=>$package->shipping_number, 'code'=>$package->shipping_code])->first()?->info,
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ class OrderResource extends JsonResource
|
|||
'created_at' => $this->created_at->toDateTimeString(),
|
||||
'expires_at' => $this->expires_at,
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
'packages' => OrderPackageResource::make($this->whenLoaded('lastPackage')),
|
||||
=======
|
||||
'packages' => OrderPackageResource::make($this->whenloaded('packages')->where('is_failed', false)->sortBy('created_at')->first()),
|
||||
>>>>>>> Stashed changes
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ Route::group([
|
|||
Route::post('order/orders/{order}/cancel', [OrderController::class, 'cancel']);
|
||||
Route::get('order/orders/{order}/packages', [OrderController::class, 'orderPackages']);
|
||||
Route::get('order/orders/{package}/shipping-info', [OrderController::class, 'shippingInfo']);
|
||||
<<<<<<< Updated upstream
|
||||
});
|
||||
|
||||
Route::group([
|
||||
|
|
@ -249,5 +250,7 @@ Route::group([
|
|||
Route::post('orders/{order}/shippinged', [Dealer\OrderController::class, 'shippingedOrder']);
|
||||
//取消订单
|
||||
Route::post('orders/{order}/cancel', [Dealer\OrderController::class, 'cancelOrder']);
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ class Dealer extends Model
|
|||
'pay_info',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此经销商的用户信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1403,11 +1403,17 @@ class Kuaidi100Service
|
|||
$package->update([
|
||||
'last_news'=> empty($lastNews) ? '' : $lastNews['context'],
|
||||
]);
|
||||
<<<<<<< Updated upstream
|
||||
try {
|
||||
//更新包裹状态
|
||||
(new OrderPackageService())->updatePackageStatus($package, $status);
|
||||
} catch (OrderPackageAlreadyCheckedException $e) {
|
||||
}
|
||||
=======
|
||||
//更新包裹状态
|
||||
$orderService = new OrderService();
|
||||
$orderService->updatePackageStatus($package, $status);
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
//记录物流信息
|
||||
KuaidiLog::updateOrCreate([
|
||||
|
|
@ -1488,7 +1494,11 @@ class Kuaidi100Service
|
|||
*/
|
||||
public function unPollSign(string $sign, array $params)
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
return $sign === strtoupper(md5(json_encode($params, JSON_UNESCAPED_UNICODE).app_settings('kuaidi100.secret')));
|
||||
=======
|
||||
return $sign === strtoupper(md5(json_encode($params, JSON_UNESCAPED_UNICODE).config('settings.kuaidi100_secret')));
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
public function getStatusName($state = 0)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
// 应用名称
|
||||
'app_name' => '子春生',
|
||||
|
||||
// 订单支付过期时间(秒)
|
||||
'order_payment_expires_at' => 1800,
|
||||
|
||||
// 售后过期时间(天)
|
||||
'sale_after_expire_days' => 7,
|
||||
|
||||
// 签到配置,每次积分、连续N天、连续奖励积分
|
||||
'sign_click_points'=>5,
|
||||
'sign_click_continue'=>7,
|
||||
'sign_click_continue_points'=>10,
|
||||
|
||||
// 文章分类配置: 帮助、协议、健康
|
||||
'article_help'=>1,
|
||||
'article_agreement'=>2,
|
||||
'article_health'=>3,
|
||||
// 指定内容链接:关于我们,服务协议,隐私协议
|
||||
'article_about_us'=>env('APP_URL', '').'/h5/articles/1',
|
||||
'article_user_promotion_agreement'=>env('APP_URL', '').'/h5/articles/2',
|
||||
'article_user_hide_agreement'=>env('APP_URL', '').'/h5/articles/3',
|
||||
|
||||
// 快递100是否开启
|
||||
'kuaidi100_is_use' => true,
|
||||
'kuaidi100_callback'=> env('APP_URL', '').'/callback/kuaidi100',
|
||||
'kuaidi100_app_key'=> 'BTvgbjti4727',
|
||||
'kuaidi100_customer'=> '064109188EC4D85DA655DFC342144C6A',
|
||||
'kuaidi100_secret'=> '1bd287d1981749f2a30ea74cac0ab99c',
|
||||
'kuaidi100_userid'=> 'ec0b6ec7729d4f22824cfd3c519dd45b',
|
||||
|
||||
];
|
||||
|
|
@ -135,6 +135,8 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection manager_subsidy
|
||||
* @property Grid\Column|Collection sales_count
|
||||
* @property Grid\Column|Collection unit
|
||||
* @property Grid\Column|Collection path
|
||||
* @property Grid\Column|Collection remark
|
||||
* @property Grid\Column|Collection is_manager
|
||||
* @property Grid\Column|Collection failed_reason
|
||||
* @property Grid\Column|Collection jobable_id
|
||||
|
|
@ -195,7 +197,6 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection pay_sn
|
||||
* @property Grid\Column|Collection pay_way
|
||||
* @property Grid\Column|Collection products_total_amount
|
||||
* @property Grid\Column|Collection remark
|
||||
* @property Grid\Column|Collection shipping_fee
|
||||
* @property Grid\Column|Collection shipping_state
|
||||
* @property Grid\Column|Collection user_coupon_id
|
||||
|
|
@ -262,7 +263,6 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection group_sales_value
|
||||
* @property Grid\Column|Collection inviter_id
|
||||
* @property Grid\Column|Collection nickname
|
||||
* @property Grid\Column|Collection path
|
||||
* @property Grid\Column|Collection pre_growth_value
|
||||
* @property Grid\Column|Collection quota_v1
|
||||
* @property Grid\Column|Collection quota_v2
|
||||
|
|
@ -405,6 +405,8 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection manager_subsidy(string $label = null)
|
||||
* @method Grid\Column|Collection sales_count(string $label = null)
|
||||
* @method Grid\Column|Collection unit(string $label = null)
|
||||
* @method Grid\Column|Collection path(string $label = null)
|
||||
* @method Grid\Column|Collection remark(string $label = null)
|
||||
* @method Grid\Column|Collection is_manager(string $label = null)
|
||||
* @method Grid\Column|Collection failed_reason(string $label = null)
|
||||
* @method Grid\Column|Collection jobable_id(string $label = null)
|
||||
|
|
@ -465,7 +467,6 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection pay_sn(string $label = null)
|
||||
* @method Grid\Column|Collection pay_way(string $label = null)
|
||||
* @method Grid\Column|Collection products_total_amount(string $label = null)
|
||||
* @method Grid\Column|Collection remark(string $label = null)
|
||||
* @method Grid\Column|Collection shipping_fee(string $label = null)
|
||||
* @method Grid\Column|Collection shipping_state(string $label = null)
|
||||
* @method Grid\Column|Collection user_coupon_id(string $label = null)
|
||||
|
|
@ -532,7 +533,6 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection group_sales_value(string $label = null)
|
||||
* @method Grid\Column|Collection inviter_id(string $label = null)
|
||||
* @method Grid\Column|Collection nickname(string $label = null)
|
||||
* @method Grid\Column|Collection path(string $label = null)
|
||||
* @method Grid\Column|Collection pre_growth_value(string $label = null)
|
||||
* @method Grid\Column|Collection quota_v1(string $label = null)
|
||||
* @method Grid\Column|Collection quota_v2(string $label = null)
|
||||
|
|
@ -680,6 +680,8 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection manager_subsidy
|
||||
* @property Show\Field|Collection sales_count
|
||||
* @property Show\Field|Collection unit
|
||||
* @property Show\Field|Collection path
|
||||
* @property Show\Field|Collection remark
|
||||
* @property Show\Field|Collection is_manager
|
||||
* @property Show\Field|Collection failed_reason
|
||||
* @property Show\Field|Collection jobable_id
|
||||
|
|
@ -740,7 +742,6 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection pay_sn
|
||||
* @property Show\Field|Collection pay_way
|
||||
* @property Show\Field|Collection products_total_amount
|
||||
* @property Show\Field|Collection remark
|
||||
* @property Show\Field|Collection shipping_fee
|
||||
* @property Show\Field|Collection shipping_state
|
||||
* @property Show\Field|Collection user_coupon_id
|
||||
|
|
@ -807,7 +808,6 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection group_sales_value
|
||||
* @property Show\Field|Collection inviter_id
|
||||
* @property Show\Field|Collection nickname
|
||||
* @property Show\Field|Collection path
|
||||
* @property Show\Field|Collection pre_growth_value
|
||||
* @property Show\Field|Collection quota_v1
|
||||
* @property Show\Field|Collection quota_v2
|
||||
|
|
@ -950,6 +950,8 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection manager_subsidy(string $label = null)
|
||||
* @method Show\Field|Collection sales_count(string $label = null)
|
||||
* @method Show\Field|Collection unit(string $label = null)
|
||||
* @method Show\Field|Collection path(string $label = null)
|
||||
* @method Show\Field|Collection remark(string $label = null)
|
||||
* @method Show\Field|Collection is_manager(string $label = null)
|
||||
* @method Show\Field|Collection failed_reason(string $label = null)
|
||||
* @method Show\Field|Collection jobable_id(string $label = null)
|
||||
|
|
@ -1010,7 +1012,6 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection pay_sn(string $label = null)
|
||||
* @method Show\Field|Collection pay_way(string $label = null)
|
||||
* @method Show\Field|Collection products_total_amount(string $label = null)
|
||||
* @method Show\Field|Collection remark(string $label = null)
|
||||
* @method Show\Field|Collection shipping_fee(string $label = null)
|
||||
* @method Show\Field|Collection shipping_state(string $label = null)
|
||||
* @method Show\Field|Collection user_coupon_id(string $label = null)
|
||||
|
|
@ -1077,7 +1078,6 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection group_sales_value(string $label = null)
|
||||
* @method Show\Field|Collection inviter_id(string $label = null)
|
||||
* @method Show\Field|Collection nickname(string $label = null)
|
||||
* @method Show\Field|Collection path(string $label = null)
|
||||
* @method Show\Field|Collection pre_growth_value(string $label = null)
|
||||
* @method Show\Field|Collection quota_v1(string $label = null)
|
||||
* @method Show\Field|Collection quota_v2(string $label = null)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
return [
|
||||
'labels' => [
|
||||
'Dealer' => 'Dealer',
|
||||
'dealer' => 'Dealer',
|
||||
],
|
||||
'fields' => [
|
||||
'user_id' => '用户ID',
|
||||
'lvl' => '经销商等级',
|
||||
'is_sale' => '是否可销售',
|
||||
'is_manager' => '是否是管理者',
|
||||
'pay_info' => '用户保留的收款信息',
|
||||
],
|
||||
'options' => [
|
||||
],
|
||||
];
|
||||
Loading…
Reference in New Issue