6
0
Fork 0
Merge pull request !8 from 李静/1.x
release
李静 2022-03-03 05:43:26 +00:00 committed by Gitee
commit 24ffb90691
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
70 changed files with 2077 additions and 632 deletions

View File

@ -67,3 +67,6 @@ ALIYUN_OSS_STS_HOST =
ALIYUN_SMS_ACCESS_ID=
ALIYUN_SMS_ACCESS_KEY=
ALIYUN_SMS_SIGN_NAME=
WECHAT_MINI_PROGRAM_APPID=
WECHAT_MINI_PROGRAM_SECRET=

View File

@ -52,7 +52,7 @@ class AfterSaleController extends AdminController
$grid->column('tags', '标签')->display(function ($tags) {
$array = [];
foreach ($this->tags as $key => $tag) {
$array[] = $tag->name;
$array[] = $tag->name;
}
return $array;
})->label();
@ -136,56 +136,66 @@ class AfterSaleController extends AdminController
protected function detail($id)
{
return function (Row $row) use ($id) {
$row->column(4, function ($column) use ($id) {
$row->column(5, function ($column) use ($id) {
$builder = AfterSale::with(['user', 'user.userInfo', 'order', 'orderProduct', 'tags']);
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('sn');
$show->field('order.sn', '售后订单')->unescape()->as(function ($value) {
if (Admin::user()->can('dcat.admin.orders.show')) {
return '<a href="'.admin_route('orders.show', ['order'=>$this->order]).'" target="_blank">'.$value.'</a>';
}
return $value;
});
$show->field('order_product.name', '售后商品')->as(function ($value) {
return $value.'*'. $this->num;
});
// $show->field('num');
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND])) {
$show->field('amount', '售后金额')->as(function ($amount) {
return '¥'.bcdiv($amount, 100, 2);
// $show->field('id');
$type = $show->model()->type;
$show->row(function (Show\Row $show) use ($type) {
$show->width(6)->field('sn');
$show->field('order.sn', '关联订单编号')->unescape()->as(function ($value) {
if (Admin::user()->can('dcat.admin.orders.show')) {
return '<a href="'.admin_route('orders.show', ['order'=>$this->order]).'" target="_blank">'.$value.'</a>';
}
return $value;
});
}
$show->field('type')->using([
AfterSaleModel::TYPE_REFUND_AND_RETURN => '退款退货',
AfterSaleModel::TYPE_REFUND => '退款',
AfterSaleModel::TYPE_CHANGE => '换货',
AfterSaleModel::TYPE_FILL => '漏发',
])->label();
$show->field('state')->using(AfterSaleModel::$stateText)->dot([
AfterSaleModel::STATE_APPLY=>'warning',
AfterSaleModel::STATE_VERIFY=>'danger',
AfterSaleModel::STATE_AGREE=>'warning',
AfterSaleModel::STATE_SHIPPING=>'primary',
AfterSaleModel::STATE_FINANCE=>'primary',
AfterSaleModel::STATE_FINISH=>'success',
AfterSaleModel::STATE_CANCEL=>'#b3b9bf',
]);
$show->field('user.user_info.nickname', '下单用户');
$show->field('user.phone');
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_CHANGE])) {
$show->field('tracking_number');
}
$show->field('order_product.name', '售后商品')->as(function ($value) {
return $value.'*'. $this->num;
});
// $show->field('num');
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND])) {
$show->field('amount', '售后金额')->as(function ($amount) {
return '¥'.bcdiv($amount, 100, 2);
});
}
$show->width(6)->field('user.user_info.nickname', '下单用户');
$show->field('user.phone');
$show->field('type')->using([
AfterSaleModel::TYPE_REFUND_AND_RETURN => '退款退货',
AfterSaleModel::TYPE_REFUND => '退款',
AfterSaleModel::TYPE_CHANGE => '换货',
AfterSaleModel::TYPE_FILL => '漏发',
])->label();
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND, AfterSaleModel::TYPE_CHANGE])) {
$show->field('sales_value', '销售值');
}
});
$status = $stae = $show->model()->state;
$show->row(function (Show\Row $show) use ($type, $status) {
$show->width(6)->field('state')->using(AfterSaleModel::$stateText)->dot([
AfterSaleModel::STATE_APPLY=>'warning',
AfterSaleModel::STATE_VERIFY=>'danger',
AfterSaleModel::STATE_AGREE=>'warning',
AfterSaleModel::STATE_SHIPPING=>'primary',
AfterSaleModel::STATE_FINANCE=>'primary',
AfterSaleModel::STATE_FINISH=>'success',
AfterSaleModel::STATE_CANCEL=>'#b3b9bf',
]);
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_CHANGE]) && in_array($status, [
AfterSaleModel::STATE_SHIPPING, AfterSaleModel::STATE_FINANCE, AfterSaleModel::STATE_FINISH,
])) {
$show->field('tracking_number');
}
});
$show->row(function (Show\Row $show) use ($type, $status) {
$show->width(12)->field('tags')->width(10, 1)->as(function () {
return $this->tags->pluck('name');
})->label();
$show->width(6)->field('created_at');
$show->field('updated_at');
});
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND, AfterSaleModel::TYPE_CHANGE])) {
$show->field('sales_value', '销售值');
}
// $show->field('order_product.cover')->image();
$show->field('created_at');
$show->field('updated_at');
$show->panel()
->tools(function (Show\Tools $tools) use ($show) {
$tools->disableEdit();
@ -214,7 +224,7 @@ class AfterSaleController extends AdminController
});
}));
});
$row->column(8, function ($column) use ($id) {
$row->column(7, function ($column) use ($id) {
$afterSale = AfterSaleModel::findOrFail($id);
$builder = AfterSaleModel::with('orderProduct')->where('order_product_id', $afterSale?->order_product_id)->where('id', '<>', $id);
$column->row(Box::make('相关售后', Grid::make($builder, function (Grid $grid) {

View File

@ -6,6 +6,7 @@ use App\Admin\Actions\Grid\DealerBonds;
use App\Admin\Actions\Grid\DealerEditLvl;
use App\Admin\Actions\Grid\DealerEditProduct;
use App\Admin\Renderable\DealerEarningSimpleTable;
use App\Admin\Renderable\DealerSubordinateCard;
use App\Admin\Renderable\DealerUserProductLogSimpleTable;
use App\Admin\Renderable\DealerWalletLogSimpleTable;
use App\Admin\Repositories\Dealer;
@ -42,8 +43,11 @@ class DealerController extends AdminController
$lvlTexts = DealerLvl::texts();
$grid->column('lvl')->display(function () {
return $this->lvl_text;
})->filter(Grid\Column\Filter\In::make($lvlTexts));
return $this->lvl->text();
})->filter(Grid\Column\Filter\In::make($lvlTexts))->modal(function ($modal) {
// $modal->title('消费值');
return DealerSubordinateCard::make(['id'=>$this->user_id]);
})->setHeaderAttributes(['style' => 'color:#5b69bc']);
$grid->column('wallet.balance')->display(function ($value) {
return $value ?? 0;
})->prepend('¥');
@ -111,7 +115,7 @@ class DealerController extends AdminController
// $show->field('id');
$show->field('user.phone');
$show->field('lvl')->as(function () {
return $this->lvl_text;
return $this->lvl->text();
});
$show->field('is_sale')->as(function ($val) {
return $val ? '是' : '否';

View File

@ -35,6 +35,7 @@ class DealerEarningController extends AdminController
$earning = DealerEarning::with(['user', 'payer']);
return Grid::make($earning, function (Grid $grid) {
$grid->setResource('dealer-earnings');
$grid->model()->orderBy('id', 'desc');//默认ID倒叙
$grid->column('id')->sortable();
$grid->column('user.phone');
$grid->column('type_name')->display(function () {
@ -56,7 +57,6 @@ class DealerEarningController extends AdminController
// $grid->column('earningable_id');
$grid->column('lvl')->display(function () {
return $this->lvl->text();
// return $this->lvl_text;
});
$grid->column('is_manager')->bool();
$grid->column('total_amount')->prepend('¥');

View File

@ -20,6 +20,7 @@ class DealerManageSubsidyLogController extends AdminController
{
$builder = DealerManageSubsidyLog::with(['user', 'order', 'product']);
return Grid::make($builder, function (Grid $grid) {
$grid->model()->orderBy('id', 'desc');//默认ID倒叙
$grid->column('id')->sortable();
$grid->column('user.phone', '手机号')->copyable();
$grid->column('lvl', '等级')->display(function () {
@ -29,7 +30,7 @@ class DealerManageSubsidyLogController extends AdminController
$grid->column('product.name', '商品名称');
$grid->column('sales_volume', '销量');
$grid->column('total_amount', '金额');
$grid->column('order_completed_at', '结算时间');
$grid->column('order_completed_at', '结算时间')->sortable();
$grid->column('created_at')->sortable();
$grid->disableCreateButton();

View File

@ -21,6 +21,7 @@ class DealerManagerSalesLogController extends AdminController
{
$builder = DealerManagerSalesLog::with(['user', 'order', 'product']);
return Grid::make($builder, function (Grid $grid) {
$grid->model()->orderBy('id', 'desc');//默认ID倒叙
$grid->column('id')->sortable();
$grid->column('user.phone', '手机号')->copyable();
$grid->column('lvl', '等级')->display(function () {
@ -29,7 +30,7 @@ class DealerManagerSalesLogController extends AdminController
$grid->column('order.sn', '订单编号');
$grid->column('product.name', '商品名称');
$grid->column('sales_volume', '销量');
$grid->column('order_completed_at', '结算时间');
$grid->column('order_completed_at', '结算时间')->sortable();
$grid->column('created_at')->sortable();
$grid->disableCreateButton();

View File

@ -8,8 +8,10 @@ use App\Admin\Actions\Grid\DealerOrderPaid;
use App\Admin\Actions\Grid\DealerOrderRefuse;
use App\Admin\Actions\Grid\DealerOrderShipping;
use App\Admin\Actions\Show\DealerOrderRemark;
use App\Admin\Renderable\Grid\Filter\DealerOrderPayWayIn;
use App\Admin\Repositories\DealerOrder;
use App\Enums\DealerOrderStatus;
use App\Enums\PayWay;
use App\Models\DealerChannelSubsidyLog;
use App\Models\DealerOrderProduct;
use Dcat\Admin\Admin;
@ -54,7 +56,7 @@ class DealerOrderController extends AdminController
return '<i class="fa fa-circle" style="font-size: 13px;color: '.$v->color().'"></i>&nbsp;&nbsp;'.$v->getDealerOrderText();
}
return '';
});
})->filter(DealerOrderPayWayIn::make(PayWay::dealerOrderTexts()));
$grid->column('order_status')->display(function ($v) {
return $this->order_status;
@ -273,7 +275,6 @@ HTML;
$grid->column('user.phone', '手机号');
$grid->column('lvl', '等级')->display(function () {
return $this->lvl->text();
// return $this->lvl_text;
});
$grid->column('total_amount', '补贴金额');
$grid->column('remark', '备注');

View File

@ -26,8 +26,11 @@ class DealerPurchaseLogController extends AdminController
// dd($phone);
if ($phone) {
$user = User::where('phone', $phone)->first();
$grid->model()->where('path', 'like', '%-'.$user->id.'-%');
if ($user) {
$grid->model()->where('path', 'like', '%-'.$user->id.'-%');
}
}
$grid->model()->orderBy('id', 'desc');//默认ID倒叙
$grid->column('id')->sortable();
$grid->column('user.phone', '手机号')->copyable();
$grid->column('lvl', '等级')->display(function () {
@ -36,7 +39,7 @@ class DealerPurchaseLogController extends AdminController
$grid->column('order.sn', '订单编号');
$grid->column('total_amount');
$grid->column('remark');
$grid->column('order_completed_at');
$grid->column('order_completed_at', '结算时间')->sortable();
$grid->column('created_at')->sortable();
$grid->header(function ($collection) use ($grid) {

View File

@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
use App\Admin\Actions\Grid\CreateOrderPackage;
use App\Admin\Actions\Grid\Exports\ShippingOrder as ExportShippingOrder;
use App\Admin\Actions\Grid\KuaidiInfo;
use App\Admin\Actions\Grid\OrderSetTag;
use App\Admin\Actions\Show\OrderConsigneeInfo;
use App\Admin\Actions\Show\OrderCreatePackage;
@ -154,92 +155,85 @@ class OrderController extends AdminController
$builder = OrderModel::with(['user', 'userCoupon', 'tags'])->withCount('afterSales');
$column->row(Show::make($id, $builder, function (Show $show) {
// $show->field('id');
$show->field('sn');
$show->field('order_status')->as(function ($v) {
return $this->order_status;
})->using([
0=>'待付款',
1=>'待发货',
2=>'发货中',
3=>'已发货',
9=>'已完成',
10=>'已取消',
])->dot([
0=>'primary',
1=>'warning',
2=>'danger',
3=>'success',
9=>'success',
10=>'#b3b9bf',
]);
$show->field('total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('created_at');
$show->html(function () {
$content = '';
$show->row(function (Show\Row $show) {
$show->width(6)->field('sn');
$show->field('order_status')->as(function ($v) {
return $this->order_status;
})->using([
0=>'待付款',
1=>'待发货',
2=>'发货中',
3=>'已发货',
9=>'已完成',
10=>'已取消',
])->dot([
0=>'primary',
1=>'warning',
2=>'danger',
3=>'success',
9=>'success',
10=>'#b3b9bf',
]);
if ($this->pay_way) {
$content = '<i class="fa fa-circle" style="font-size: 13px;color: '.$this->pay_way->color().'"></i>&nbsp;&nbsp;'.$this->pay_way->getMallOrderText();
}
$show->field('created_at');
$show->width(6)->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
$show->field('pay_at');
$show->field('pay_way')->unescape()->as(function () {
$content = '';
return <<<HTML
<div class="show-field form-group row">
<div class="col-sm-2 control-label">
<span>支付方式</span>
</div>
if ($this->pay_way) {
$content = '<i class="fa fa-circle" style="font-size: 13px;color: '.$this->pay_way->color().'"></i>&nbsp;&nbsp;'.$this->pay_way->getMallOrderText();
}
<div class="col-sm-8">
<div class="box box-solid box-default no-margin box-show">
<div class="box-body">{$content}&nbsp;</div>
</div>
</div>
</div>
HTML;
return $content;
});
});
$show->field('pay_at');
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
$show->divider();
$show->field('consignee_name');
$show->field('consignee_telephone');
$show->field('consignee')->as(function () {
return $this->consignee_zone . ' '. $this->consignee_address;
$show->row(function (Show\Row $show) {
$show->width(6)->field('consignee_name');
$show->field('consignee_telephone');
$show->width(12)->field('consignee')->width(10, 1)->as(function () {
return $this->consignee_zone . ' '. $this->consignee_address;
});
});
// $show->field('user.phone');
$show->divider();
$show->field('products_total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('vip_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
if ($show->model()->user_coupon_id) {
$show->field('user_coupon.coupon_name', '优惠券')->label();
$show->field('coupon_discount_amount')->as(function ($v) {
$userCouponId = $show->model()->user_coupon_id;
$show->row(function (Show\Row $show) use ($userCouponId) {
$show->width(6)->field('products_total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('vip_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
}
$show->field('shipping_fee')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('+ ¥');
$show->field('reduced_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
$show->divider();
$show->field('sales_value', '总销售值');
$show->field('is_settle', '是否结算')->using([
0=>'未结算',
1=>'已结算',
])->dot([
0=>'danger',
1=>'success',
]);
$show->field('completed_at', '完成时间');
$show->divider();
$show->field('note');
$show->field('remark');
if ($userCouponId) {
$show->field('user_coupon.coupon_name', '优惠券')->label();
$show->field('coupon_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
}
$show->field('shipping_fee')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('+ ¥');
$show->field('reduced_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
$show->field('total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
});
$show->row(function (Show\Row $show) use ($userCouponId) {
$show->width(6)->field('sales_value', '总销售值');
$show->field('is_settle', '是否结算')->using([
0=>'未结算',
1=>'已结算',
])->dot([
0=>'danger',
1=>'success',
]);
$show->field('completed_at', '完成时间');
$show->width(12)->field('note')->width(10, 1);
$show->width(12)->field('remark')->width(10, 1);
});
$show->panel()
->tools(function (Show\Tools $tools) use ($show) {
@ -338,6 +332,10 @@ HTML;
OrderPackage::STATUS_DISTRIBUTE=>'primary',
OrderPackage::STATUS_QUESTION =>'warning',
]);
$grid->column('kuaidi_info', '物流详情')->display('详情')->modal(function ($modal) {
$modal->title('物流详情');
return KuaidiInfo::make();
});
$grid->column('is_failed', '正常')->bool([
0=>true,
1=>false,

View File

@ -3,6 +3,8 @@
namespace App\Admin\Controllers;
use App\Admin\Actions\Grid\QuotaV1SendJobStart;
use App\Admin\Extensions\Grid\Tools\QuotaV1\Deduction;
use App\Admin\Extensions\Grid\Tools\QuotaV1\Recharge;
use App\Admin\Renderable\QuotaV1SendLogTable;
use App\Admin\Repositories\QuotaV1SendJob;
use App\Models\QuotaV1SendJob as QuotaV1SendJobModel;
@ -25,6 +27,14 @@ class QuotaV1SendJobController extends AdminController
$builder = QuotaV1SendJob::with('administrator');
return Grid::make($builder, function (Grid $grid) {
$grid->column('id')->sortable();
$grid->tools(function (Grid\Tools $tools) {
if (Admin::user()->can('dcat.admin.quota_v1_send_jobs.recharge')) {
$tools->append(new Recharge());
}
if (Admin::user()->can('dcat.admin.quota_v1_send_jobs.deduction')) {
$tools->append(new Deduction());
}
});
$grid->column('amount')->display(function ($value) {
return bcdiv($value, 100, 2);
})->prepend('¥');

View File

@ -0,0 +1,86 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\SalesValueLog;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
class SalesValueLogController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$builder = SalesValueLog::with(['user', 'user.userInfo']);
return Grid::make($builder, function (Grid $grid) {
// $grid->column('id')->sortable();
$grid->column('user.phone');
$grid->column('user.userInfo.nickname');
// $grid->column('order_id');
// $grid->column('order_user_id');
$grid->column('type')->using([
1=>'个人',
2=>'团队',
]);
$grid->column('change_sales_value');
$grid->column('remarks');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel(false);
$filter->equal('user.phone')->width(3);
$filter->between('created_at')->dateTime()->width(7);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new SalesValueLog(), function (Show $show) {
$show->field('id');
$show->field('user_id');
$show->field('order_id');
$show->field('order_user_id');
$show->field('type');
$show->field('change_sales_value');
$show->field('remarks');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new SalesValueLog(), function (Form $form) {
$form->display('id');
$form->text('user_id');
$form->text('order_id');
$form->text('order_user_id');
$form->text('type');
$form->text('change_sales_value');
$form->text('remarks');
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@ -111,7 +111,7 @@ class SettingController extends AdminController
switch ($type) {
case 'app':
$tab->add('系统配置', new App(), true);
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
@ -131,7 +131,7 @@ class SettingController extends AdminController
break;
case 'dealer':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->add('经销商配置', new Dealer(), true);
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
@ -141,7 +141,7 @@ class SettingController extends AdminController
break;
case 'withdraw':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->add('提现配置', new Withdraw(), true);
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
@ -151,7 +151,7 @@ class SettingController extends AdminController
break;
case 'ios':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->add('Ios配置', new Ios(), true);
@ -161,7 +161,7 @@ class SettingController extends AdminController
break;
case 'android':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
@ -171,7 +171,7 @@ class SettingController extends AdminController
break;
case 'kuaidi100':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
@ -181,7 +181,7 @@ class SettingController extends AdminController
break;
case 'unipush':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
// $tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));

View File

@ -17,6 +17,7 @@ use App\Admin\Renderable\Grid\Filter\PriceBetween;
use App\Admin\Renderable\UserBalanceLogSimpleTable;
use App\Admin\Renderable\UserFansSimpleTable;
use App\Admin\Renderable\UserInviterSimpleTable;
use App\Admin\Renderable\UserSalesValueLogSimpleTable;
use App\Admin\Renderable\UserWalletLogSimpleTable;
use App\Admin\Repositories\User;
use App\Exceptions\BizException;
@ -60,29 +61,32 @@ class UserController extends AdminController
$grid->column('userInfo.code')->copyable();
$grid->column('userInfo.agent_level')->display(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
})->label();
return $this->userInfo?->agent_level_name ?? '未知';
})->label()->filter(Grid\Column\Filter\In::make(UserInfo::$agentLevelTexts));
$grid->column('userInfo.inviterInfo.user.phone')->copyable();
$grid->column('userInfo.growth_value')->filter(
Grid\Column\Filter\Between::make()
);
)->modal(function ($modal) {
$modal->title('消费值');
return UserSalesValueLogSimpleTable::make(['id'=>$this->id]);
})->setHeaderAttributes(['style' => 'color:#5b69bc']);
$grid->column('userInfo.group_sales_value')->filter(
Grid\Column\Filter\Between::make()
);
$grid->column('wallet.balance')->display(function ($value) {
$value = bcdiv($value, 100, 2);
$value = bcdiv($value, 100, 2);
if ($this->wallet?->is_frozen) {
$value.= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
$value .= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
}
return $value;
})->prepend('¥')->filter(
PriceBetween::make()
);
$grid->column('balance.balance')->display(function ($value) {
$value = bcdiv($value, 100, 2);
$value = bcdiv($value, 100, 2);
if ($this->balance?->is_frozen) {
$value.= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
$value .= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
}
return $value;
})->prepend('¥')->filter(
@ -145,7 +149,7 @@ class UserController extends AdminController
$filter->panel();
$filter->like('phone')->width(3);
$filter->like('userInfo.nickname')->width(3);
$filter->equal('userInfo.agent_level')->select(UserInfo::$agentLevelTexts)->width(3);
// $filter->equal('userInfo.agent_level')->select(UserInfo::$agentLevelTexts)->width(3);
$filter->between('created_at')->dateTime()->width(7);
// $filter->between('userInfo.growth_value')->width(6);
// $filter->between('userInfo.group_sales_value')->width(6);
@ -170,34 +174,39 @@ class UserController extends AdminController
$row->column(5, function ($column) use ($id) {
$builder = User::with(['userInfo', 'wallet', 'balance', 'userInfo.inviterInfo.user']);
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('phone');
$show->field('user_info.nickname');
$show->field('user_info.gender')->using(UserInfo::$genderTexts)->label();
$show->field('user_info.birthday');
$show->field('user_info.agent_level')->as(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
})->label();
$show->field('user_info.inviter_info.user.phone');
$show->field('user_info.growth_value');
$show->field('user_info.group_sales_value');
$show->row(function (Show\Row $show) {
$show->width(12)->field('id')->width(10, 1);
$show->width(6)->field('phone');
$show->field('user_info.inviter_info.user.phone');
$show->field('user_info.nickname');
$show->field('user_info.gender')->using(UserInfo::$genderTexts)->label();
$show->field('user_info.birthday');
$show->field('user_info.agent_level')->as(function ($value) {
return $this->userInfo?->agent_level_name ?? '未知';
})->label();
$show->field('wallet.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('balance.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('user_info.quota_v2');
$show->field('user_info.quota_v1');
$show->field('user_info.points');
$show->field('user_info.growth_value');
$show->field('user_info.group_sales_value');
$show->field('wallet.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('balance.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('user_info.quota_v2');
$show->field('user_info.quota_v1');
$show->field('user_info.points');
});
$show->row(function (Show\Row $show) {
$show->width(6)->field('last_login_ip');
$show->field('last_login_at');
$show->field('register_ip');
$show->field('created_at');
});
$show->field('last_login_ip');
$show->field('last_login_at');
$show->field('register_ip');
$show->field('created_at');
$show->panel()
->tools(function ($tools) use ($show) {
$tools->disableEdit();

View File

@ -0,0 +1,54 @@
<?php
namespace App\Admin\Extensions\Grid\Tools\QuotaV1;
use App\Admin\Forms\QuotaV1Deduction;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Dcat\Admin\Widgets\Modal;
class Deduction extends AbstractTool
{
protected function authorize($user): bool
{
return $user->can('dcat.admin.quota_v1_send_jobs.deduction');
}
/**
* 按钮样式定义,默认 btn btn-white waves-effect
*
* @var string
*/
protected $style = 'btn btn btn-danger';
/**
* 按钮文本
*
* @return string|void
*/
public function title()
{
return '扣减';
}
public function render()
{
$form = QuotaV1Deduction::make();
return Modal::make()
->lg()
->title($this->title())
->body($form)
->button($this->html());
}
/**
* 设置请求参数
*
* @return array|void
*/
public function parameters()
{
return [
];
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Admin\Extensions\Grid\Tools\QuotaV1;
use App\Admin\Forms\QuotaV1Recharge;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Dcat\Admin\Widgets\Modal;
class Recharge extends AbstractTool
{
protected function authorize($user): bool
{
return $user->can('dcat.admin.quota_v1_send_jobs.recharge');
}
/**
* 按钮样式定义,默认 btn btn-white waves-effect
*
* @var string
*/
protected $style = 'btn btn btn-warning';
/**
* 按钮文本
*
* @return string|void
*/
public function title()
{
return '增加';
}
public function render()
{
$form = QuotaV1Recharge::make();
return Modal::make()
->lg()
->title($this->title())
->body($form)
->button($this->html());
}
/**
* 设置请求参数
*
* @return array|void
*/
public function parameters()
{
return [
];
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace App\Admin\Forms;
use App\Models\QuotaV1Log;
use App\Models\User;
use App\Services\QuotaV1Service;
use Dcat\Admin\Admin;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Facades\DB;
use Throwable;
class QuotaV1Deduction extends Form implements LazyRenderable
{
use LazyWidget;
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return $user->can('dcat.admin.quota_v1_send_jobs.deduction');
}
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
if (($input['change_balance'] ?? 0) <= 0) {
return $this->response()->error('扣减配额必须大于0');
}
try {
DB::beginTransaction();
//获取当前操作人;
$adminUser = Admin::user();
$user = User::findOrFail($input['user_id'] ?? 0);
$quotaV1Service = new QuotaV1Service();
$quotaV1Service->changeBalance($user, -($input['change_balance'] ?? 0), QuotaV1Log::ACTION_ADMIN_DEDUCTION, '后台扣减', $adminUser);
DB::commit();
} catch (Throwable $th) {
DB::rollBack();
report($th);
return $this->response()->error('操作失败:'.$th->getMessage());
}
return $this->response()
->success(__('admin.update_succeeded'))
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
$this->currency('change_balance', '扣减配额')->symbol('¥')->required();
$this->confirm('是否确认扣减?', '提交后该动作无法逆转');
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace App\Admin\Forms;
use App\Models\QuotaV1Log;
use App\Models\User;
use App\Services\QuotaV1Service;
use Dcat\Admin\Admin;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Facades\DB;
use Throwable;
class QuotaV1Recharge extends Form implements LazyRenderable
{
use LazyWidget;
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return $user->can('dcat.admin.quota_v1_send_jobs.recharge');
}
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
if (($input['change_balance'] ?? 0) <= 0) {
return $this->response()->error('增加配额必须大于0');
}
try {
DB::beginTransaction();
//获取当前操作人;
$adminUser = Admin::user();
$user = User::findOrFail($input['user_id'] ?? 0);
$quotaV1Service = new QuotaV1Service();
$quotaV1Service->changeBalance($user, $input['change_balance'] ?? 0, QuotaV1Log::ACTION_ADMIN_RECHARGE, '后台增加', $adminUser);
DB::commit();
} catch (Throwable $th) {
DB::rollBack();
report($th);
return $this->response()->error('操作失败:'.$th->getMessage());
}
return $this->response()
->success(__('admin.update_succeeded'))
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
$this->currency('change_balance', '增加配额')->symbol('¥')->required();
$this->confirm('是否确认增加老配额?', '提交后该动作无法逆转');
}
}

View File

@ -73,7 +73,7 @@ class UserEditAgent extends Form implements LazyRenderable
public function form()
{
// dd(UserInfo::$agentLevelTexts);
$this->select('agent_level', '管理级别')->options(UserInfo::$agentLevelTexts)->required();
$this->select('agent_level', '身份')->options(UserInfo::$agentLevelTexts)->required();
}
public function default()

View File

@ -140,7 +140,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
<span class="text-bold-600 ml-50">店铺</span>
<span class="text-bold-600 ml-50">会员</span>
</div>
<div class="product-result">
<span>{$vip}</span>
@ -149,7 +149,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
<span class="text-bold-600 ml-50">社区</span>
<span class="text-bold-600 ml-50">铁牌会员</span>
</div>
<div class="product-result">
<span>{$community}</span>
@ -158,7 +158,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1" >
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-info"></i>
<span class="text-bold-600 ml-50">区级</span>
<span class="text-bold-600 ml-50">铜牌会员</span>
</div>
<div class="product-result">
<span>{$district}</span>
@ -168,7 +168,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
<span class="text-bold-600 ml-50">市级</span>
<span class="text-bold-600 ml-50">银牌会员</span>
</div>
<div class="product-result">
<span>{$city}</span>
@ -178,7 +178,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
<span class="text-bold-600 ml-50">省级</span>
<span class="text-bold-600 ml-50">金牌会员</span>
</div>
<div class="product-result">
<span>{$province}</span>
@ -187,7 +187,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
<span class="text-bold-600 ml-50">分公司</span>
<span class="text-bold-600 ml-50">钻石会员</span>
</div>
<div class="product-result">
<span>{$branch}</span>
@ -196,7 +196,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-info"></i>
<span class="text-bold-600 ml-50">董事</span>
<span class="text-bold-600 ml-50">默认用户</span>
</div>
<div class="product-result">
<span>{$director}</span>

View File

@ -0,0 +1,59 @@
<?php
namespace App\Admin\Renderable;
use App\Models\UserInfo;
use Dcat\Admin\Support\LazyRenderable;
use Illuminate\Support\Facades\DB;
class DealerSubordinateCard extends LazyRenderable
{
public function render()
{
// 获取外部传递的参数
$id = $this->id;
// dd($id);
$query = DB::table('users')
->join('user_infos', 'users.id', '=', 'user_infos.user_id')
->join('dealers', 'users.id', '=', 'dealers.user_id');
$userInfo = UserInfo::where('user_id', $id)->first();
// 查询数据逻辑
$data = [
'top'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 6)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(),
'secondary'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 5)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(),
'contracted'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 4)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(),
'special'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 3)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(),
'gold'=> (clone $query)->whereNotNull('users.phone')->where('dealers.lvl', 2)->where('user_infos.path', 'like', $userInfo->full_path.'%')->count(),
];
// 这里可以返回内置组件也可以返回视图文件或HTML字符串
return
<<<HTML
<div class="d-flex row text-center align-items-center justify-content-center" >
<div class="col-sm-4">
<h1 class="font-lg-1 mt-2 mb-0">{$data['top']}</h1>
一级经销商
</div>
<div class="col-sm-4">
<h1 class="font-lg-1 mt-2 mb-0">{$data['secondary']}</h1>
二级经销商
</div>
<div class="col-sm-4">
<h1 class="font-lg-1 mt-2 mb-0">{$data['contracted']}</h1>
签约经销商
</div>
</div>
<div class="d-flex row text-center align-items-center justify-content-center" >
<div class="col-sm-4">
<h1 class="font-lg-1 mt-2 mb-0">{$data['special']}</h1>
特邀经销商
</div>
<div class="col-sm-4">
<h1 class="font-lg-1 mt-2 mb-0">{$data['gold']}</h1>
金牌经销商
</div>
</div>
HTML;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Admin\Renderable\Grid\Filter;
use App\Enums\PayWay;
use Dcat\Admin\Grid\Column\Filter;
use Dcat\Admin\Grid\Column\Filter\Checkbox;
use Dcat\Admin\Grid\Model;
class DealerOrderPayWayIn extends Filter
{
use Checkbox;
/**
* @var array
*/
protected $options = [];
/**
* CheckFilter constructor.
*
* @param array $options
*/
public function __construct(array $options)
{
$this->options = $options;
$this->class = [
'all' => uniqid('column-filter-all-'),
'item' => uniqid('column-filter-item-'),
];
}
/**
* Add a binding to the query.
*
* @param array $value
* @param Model $model
*/
public function addBinding($value, Model $model)
{
if (empty($value)) {
return;
}
$all = [
PayWay::Offline->value => '线下打款',
PayWay::Wallet->value => '余额支付',
PayWay::WxpayH5->value => '微信支付',
''=>'Unknown',
];
if (array_diff($all, $value)) {//无差别则直接跳过
//判断查询的状态有哪些;
$model->where(function ($query) use ($value) {
foreach ($value as $payWay) {
switch ($payWay) {
case '':
$query->orWhereNull('pay_way');
break;
default:
$query->orWhere('pay_way', $payWay);
}
}
});
}
}
/**
* Render this filter.
*
* @return string
*/
public function render()
{
return $this->renderCheckbox();
}
}

View File

@ -17,7 +17,7 @@ class UserFansSimpleTable extends LazyRenderable
$grid->column('user.phone', '手机号')->link(function ($value) {
return admin_url('users/'.$this->user_id);
});
$grid->column('agent_level', '管理级别')->display(function ($value) {
$grid->column('agent_level', '身份')->display(function ($value) {
return $this->agent_level_name??'未知';
})->label();

View File

@ -18,7 +18,7 @@ class UserInviterSimpleTable extends LazyRenderable
$grid->column('user.phone', '手机号')->link(function ($value) {
return admin_url('users/'.$this->user_id);
});
$grid->column('agent_level', '管理级别')->display(function ($value) {
$grid->column('agent_level', '身份')->display(function ($value) {
return $this->agent_level_name??'未知';
})->label();

View File

@ -0,0 +1,56 @@
<?php
namespace App\Admin\Renderable;
use App\Models\SalesValueLog;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class UserSalesValueLogSimpleTable extends LazyRenderable
{
public function grid(): Grid
{
$userId = $this->payload['id'] ?? 0;
$builder = SalesValueLog::query();
return Grid::make($builder, function (Grid $grid) use ($userId) {
$grid->model()->where('user_id', $userId);
$grid->column('type')->using([
1=>'个人',
2=>'团队',
]);
$grid->column('change_sales_value', '变动');
$grid->column('remarks', '备注');
$grid->column('created_at', '创建时间')->sortable();
// $grid->column('updated_at')
// $grid->withBorder();
$grid->model()->orderBy('created_at', 'desc');
// $grid->disableRefreshButton();
$grid->disableActions();
$grid->disableCreateButton();
$grid->header(function ($collection) use ($grid) {
$query = SalesValueLog::query();
// 拿到表格筛选 where 条件数组进行遍历
$grid->model()->getQueries()->unique()->each(function ($value) use (&$query) {
// dd($value);
if (in_array($value['method'], ['paginate', 'get', 'orderBy', 'orderByDesc'], true)) {
return;
}
$query = call_user_func_array([$query, $value['method']], $value['arguments'] ?? []);
});
// 查出统计数据
$salesValue1 = (clone $query)->where('type', '1')->sum('change_sales_value');
$salesValue2 = (clone $query)->where('type', '2')->sum('change_sales_value');
// 自定义组件
return "<div style='padding: 10px;'>个人消费值:".$salesValue1.' <br> 团队消费值:'.$salesValue2.'</div>';
});
$grid->filter(function (Grid\Filter $filter) {
$filter->between('created_at', '时间')->date()->default([
'start'=>now()->subDays(30)->toDateString(),
'end'=>now()->toDateString(),
]);
});
});
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\SalesValueLog as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class SalesValueLog extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@ -161,6 +161,10 @@ Route::group([
$router->get('import-job-logs', 'ImportJobLogController@index')->name('import_job_logs.index');
$router->resource('sales-value-logs', 'SalesValueLogController')->only(
['index']
)->names('sales_value_logs');
//经销商
$router->resource('dealer-products', 'DealerProductController')->names('dealer_products');

View File

@ -55,20 +55,22 @@ class PreIncomeJobCommand extends Command
//发送商家端预收益进帐消息
try {
DB::beginTransaction();
switch (get_class($job->jobable)) {
case Order::class://如果是订单类型,则发送预收益消息
$order = $job->jobable;
$incomesLogs = DistributionPreIncome::where('order_id', $order->id)->get();
foreach ($incomesLogs as $log) {
MerchantMessage::createDistributionMessage($log->user_id, [
'title'=>'恭喜收入'.$log->total_revenue.'元',
'content'=>'您有新的预收益产生,共'.$log->total_revenue.'元。',
]);
}
break;
default:
break;
}
case Order::class://如果是订单类型,则发送预收益消息
$order = $job->jobable;
$incomesLogs = DistributionPreIncome::where('order_id', $order->id)->get();
foreach ($incomesLogs as $log) {
MerchantMessage::createDistributionMessage($log->user_id, [
'title'=>'恭喜收入'.$log->total_revenue.'元',
'content'=>'您有新的预收益产生,共'.$log->total_revenue.'元。',
]);
}
break;
default:
break;
}
DB::commit();
} catch (Throwable $e) {
DB::rollBack();

View File

@ -44,33 +44,33 @@ class PreIncomeSettleCommand extends Command
DB::beginTransaction();
$walletService->changeBalance(
$preIncome->user,
bcmul($preIncome->total_revenue, 100),
WalletLog::ACTION_DISTRIBUTION_PRE_INCOME,
$preIncome->remarks,
$preIncome
);
$preIncome->user,
bcmul($preIncome->total_revenue, 100),
WalletLog::ACTION_DISTRIBUTION_PRE_INCOME,
$preIncome->remarks,
$preIncome
);
// 计算配额
$changeQuota = bcmul($preIncome->total_revenue, app_settings('distribution.quota_v2_rate', 0), 4);
$changeQuota = round($changeQuota, 3);
$preIncome->user->userInfo()->update([
'quota_v2' => DB::raw("quota_v2+{$changeQuota}"),
]);
'quota_v2' => DB::raw("quota_v2+{$changeQuota}"),
]);
$preIncome->user->quotaLogs()->create([
'loggable_id' => $preIncome->id,
'loggable_type' => $preIncome->getMorphClass(),
'change_quota' => $changeQuota,
'remarks' => $preIncome->type_text.'得配额',
]);
'loggable_id' => $preIncome->id,
'loggable_type' => $preIncome->getMorphClass(),
'change_quota' => $changeQuota,
'remarks' => $preIncome->type_text.'得配额',
]);
// 将预收益标记为已结算
$preIncome->update([
'completed_at' => now(),
'status' => DistributionPreIncome::STATUS_PROCESSED,
]);
'completed_at' => now(),
'status' => DistributionPreIncome::STATUS_PROCESSED,
]);
DB::commit();
} catch (Throwable $e) {

View File

@ -2,14 +2,15 @@
namespace App\Console\Commands;
use App\Enums\PayWay;
use App\Exceptions\BizException;
use App\Models\BalanceLog;
use App\Models\OrderRefundLog;
use App\Models\WalletLog;
use App\Services\AlipayService;
use App\Services\BalanceService;
use App\Services\Payment\WxpayService;
use App\Services\WalletService;
use App\Services\WeChatPayService;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Throwable;
@ -43,7 +44,11 @@ class OrderRefundCommand extends Command
OrderRefundLog::pending()->chunkById(200, function ($logs) use (&$page) {
foreach ($logs as $log) {
try {
$method = 'refundBy'.Str::studly($log->order->pay_way->value);
$method = match ($log->order->pay_way) {
PayWay::WxpayApp, PayWay::WxpayH5, PayWay::WxpayJsApi, PayWay::WxpayMiniProgram => 'refundByWxpay',
PayWay::AlipayApp => 'refundByAlipay',
default => 'refundBy'.Str::studly($log->order->pay_way->value),
};
if (! method_exists($this, $method)) {
throw new BizException('退款方式暂不支持');
@ -79,20 +84,22 @@ class OrderRefundCommand extends Command
* @param \App\Models\OrderRefundLog $log
* @return void
*/
protected function refundByWxpayApp(OrderRefundLog $log)
protected function refundByWxpay(OrderRefundLog $log)
{
$order = $log->order;
(new WeChatPayService())->refundByOutTradeNumber(
$order->pay_sn,
$log->sn,
$order->total_amount,
$log->amount,
[
(new WxpayService())->refundByOutTradeNumber([
'number' => $order->pay_sn,
'refund_number' => $log->sn,
'total_fee' => $order->total_amount,
'refund_fee' => $log->amount,
'optional' => [
'refund_desc' => $log->reason,
'notify_url' => url(route('wxpay.order_refund_notify', [], false), [], true),
]
);
],
], match ($order->pay_way) {
PayWay::WxpayMiniProgram => 'mini_program',
default => 'default',
});
$log->update([
'status' => OrderRefundLog::STATUS_SUCCESS,
@ -106,7 +113,7 @@ class OrderRefundCommand extends Command
* @param \App\Models\OrderRefundLog $log
* @return void
*/
protected function refundByAlipayApp(OrderRefundLog $log)
protected function refundByAlipay(OrderRefundLog $log)
{
$order = $log->order;

View File

@ -0,0 +1,338 @@
<?php
namespace App\Endpoint\Api\Http\Controllers\Auth;
use App\Constants\Device;
use App\Endpoint\Api\Http\Controllers\Controller;
use App\Enums\SocialiteType;
use App\Exceptions\BizException;
use App\Helpers\PhoneNumber;
use App\Models\SmsCode;
use App\Models\SocialiteUser;
use App\Models\User;
use App\Models\UserInfo;
use App\Rules\PhoneNumber as PhoneNumberRule;
use App\Services\SmsCodeService;
use EasyWeChat\Factory as EasyWeChatFactory;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Overtrue\Socialite\SocialiteManager;
use Throwable;
class SocialiteAuthController extends Controller
{
/**
* 三方code登录
*/
public function codeAuth($provider, Request $request)
{
$input = $request->validate([
'code' => ['bail', 'required', 'string'],
]);
$code = $input['code'];
//获取第三方用户信息
$socialite = $this->getSocialiteUserByCode($provider, $code);
//通过第三方用户信息登录已绑定账号
$token = null;
$socialiteUser = SocialiteUser::firstOrCreate([
'socialite_type' => $provider,
'socialite_id' => $socialite?->id,
]);
$user = $socialiteUser->user;
if ($user) {
$token = $this->loginUser($user, $request);
}
return response()->json([
'token' => $token?->plainTextToken,
]);
}
public function codeBindUser($provider, Request $request)
{
$type = $request->input('type', 'default');
$rules = [
'code' => ['bail', 'required', 'string'],
'inviter_code' => ['bail', 'nullable', 'string'],
];
switch ($type) {
case 'default'://手机号+密码
$rules = array_merge($rules, [
'phone' => ['bail', 'required', 'string'],
'password' => ['bail', 'required', 'string'],
]);
break;
case 'sms-code'://手机号+验证码
$rules = array_merge($rules, [
'phone' => ['bail', 'required', new PhoneNumberRule()],
'verify_code' => ['bail', 'required', 'string'],
]);
break;
case 'wechat-mini'://微信小程序解密手机号
$rules = array_merge($rules, [
'data' => ['bail', 'required', 'string'],
'iv' => ['bail', 'required', 'string'],
]);
break;
default://默认手机号+密码
$rules = array_merge($rules, [
'phone' => ['bail', 'required', 'string'],
'password' => ['bail', 'required', 'string'],
]);
break;
}
$input = $request->validate($rules);
$code = $input['code'];
//获取第三方用户信息
$socialite = $this->getSocialiteUserByCode($provider, $code);
//绑定用户并返回token
$token = $this->bindUser([
'socialite_type'=>$provider,
'socialite_id'=>$socialite?->id,
], $type ?? 'default', $request);
return response()->json([
'token' => $token?->plainTextToken,
]);
}
/**
* 第三方登录的解绑
*
* @param [type] $provider
* @param Request $request
*/
public function unbindUser($provider, Request $request)
{
if ($user = $request->user()) {
//解绑三方的关系
SocialiteUser::where([
'user_id' => $user->id,
'socialite_type' => $provider,
])->update([
'user_id' => null,
]);
}
return response()->noContent();
}
/**
* [目前支持:微信小程序]
*/
protected function getSocialiteUserByCode($provider, $code)
{
//获取第三方用户信息
$user = null;
$config = config('socialite', []);
$socialite = new SocialiteManager($config);
switch ($provider) {
case SocialiteType::WechatMiniProgram->value: //微信小程序
$user = $socialite->create(SocialiteType::WechatMiniProgram->value)->userFromCode($code);
break;
default:
throw new BizException(404);
}
return $user;
}
/**
* 第三方绑定用户
*
* @param [array] $socialite
* @param [Request] $request
*/
protected function bindUser(array $socialite, string $type, Request $request)
{
$token = null;
$socialiteUser = SocialiteUser::firstOrCreate($socialite);
$user = null;
$input = $request->input();
$phone = $input['phone'] ?? '';
switch ($type) {
case 'default'://手机号+密码
$user = User::where('phone', $phone)->first();
//手机号不存在,或者密码错误
if (! $user?->verifyPassword($input['password'])) {
throw new BizException(__('Incorrect account or password'));
}
break;
case 'sms-code'://手机号+验证码
app(SmsCodeService::class)->validate(
$input['phone'],
SmsCode::TYPE_REGISTER,
$input['verify_code']
);
$user = User::where('phone', $phone)->first();
break;
case 'wechat-mini'://微信小程序解密手机号
//解密失败
$app = EasyWeChatFactory::miniProgram([
'app_id' => config('wechat.mini_program.default.app_id', ''),
'secret' => config('wechat.mini_program.default.secret', ''),
// 下面为可选项
// 指定 API 调用返回结果的类型array(default)/collection/object/raw/自定义类名
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => storage_path('logs/wechat-mini.log'),
],
]);
$session = Cache::get($socialite['socialite_id']);
try {
$decryptedData = $app->encryptor->decryptData($session, $input['iv'], $input['data']);
} catch (\EasyWeChat\Kernel\Exceptions\DecryptException $e) {
return $this->error('系统错误, 请重新进入小程序');
}
$phone = data_get($decryptedData, 'phoneNumber');
//解密成功,$user
$user = User::where('phone', $phone)->first();
break;
}
if (empty($phone)) {
throw new BizException('系统错误,未找到手机号');
}
//走登录逻辑
if ($user) {
$token = $this->loginUser($user, $request);
} else {//走注册逻辑
$time = now();
$ip = $request->realIp();
$inviter = $this->findUserByCode((string) Arr::get($input, 'inviter_code'));
try {
DB::beginTransaction();
$user = User::create([
'phone' => $phone,
'password' => Str::random(6), //先随机一个密码
'phone_verified_at' => $time,
'register_ip' => $ip,
'last_login_at' => $time,
'last_login_ip' => $ip,
],
$inviter
);
DB::commit();
} catch (Throwable $e) {
DB::rollBack();
report($e);
throw new BizException(__('Registration failed, please try again'));
}
// 获取登录设备
$device = $request->header('client-app', Device::UNIAPP);
switch ($device) {
case Device::DEALER:
$token = $user->createToken(Device::DEALER);
break;
default:
$token = $user->createToken(Device::UNIAPP, ['mall']);
break;
}
}
//解绑对应三方以前的关系
SocialiteUser::where([
'user_id' => $user->id,
'socialite_type' => $socialite['socialite_type'],
])->update([
'user_id' => null,
]);
//绑定用户和三方信息关系
$socialiteUser->update([
'user_id' => $user->id,
]);
return $token;
}
/**
* 第三方登录现有绑定的用户
*
* @param [User] $user
* @param [Request] $request
*/
protected function loginUser(User $user, Request $request)
{
$token = null;
$user->last_login_at = now();
$user->last_login_ip = $request->realIp();
$user->save();
// 获取登录设备
$device = $request->header('client-app', Device::UNIAPP);
switch ($device) {
case Device::MERCHANT:
if ($user->userInfo?->agent_level < UserInfo::AGENT_LEVEL_VIP) {
throw new BizException('账户没有权限');
}
// 清理此用户的商户端令牌
$user->tokens()->where('name', $device)->delete();
// 颁发新的商户端令牌
$token = $user->createToken($device);
break;
case Device::DEALER:
if (!$user->isDealer()) {
throw new BizException('账户没有权限');
}
// 清理此用户的商户端令牌
$user->tokens()->where('name', $device)->delete();
// 颁发新的商户端令牌
$token = $user->createToken($device);
break;
default:
$device = Device::UNIAPP;
// 清理此用户的商城端令牌
$user->tokens()->where('name', $device)->delete();
// 颁发新的商城端令牌
$token = $user->createToken($device, ['mall']);
break;
}
return $token;
}
/**
* 通过邀请码搜索用户
*
* @param string $code
* @return \App\Models\User|null
*
* @throws \App\Exceptions\BizException
*/
protected function findUserByCode(string $code): ?User
{
if ($code === '') {
return null;
}
$user = User::when(PhoneNumber::validate($code), function ($query) use ($code) {
$query->where('phone', $code);
}, function ($query) use ($code) {
$query->whereRelation('userInfo', 'code', $code);
})->first();
if ($user === null) {
throw new BizException(__('Inviter does not exist'));
}
return $user;
}
}

View File

@ -34,7 +34,7 @@ class AgentController extends Controller
],
// 代理
'agents_count' => [
'label' => '店铺',
'label' => '会员',
'current_agents_count' => $userInfo->getVipAgentsCount(),
'upgrade_agents_count' => $rules['community']['vips_agents_count'],
],
@ -50,7 +50,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['district']['team_sales_value'],
],
'agents_count' => [
'label' => '店铺',
'label' => '会员',
'current_agents_count' => $userInfo->getVipAgentsCount(),
'upgrade_agents_count' => $rules['district']['vips_agents_count'],
],
@ -66,7 +66,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['city']['team_sales_value'],
],
'agents_count' => [
'label' => '区代',
'label' => '铜牌会员',
'current_agents_count' => $userInfo->getDistrictAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['city']['district_agents_count'],
],
@ -82,7 +82,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['province']['team_sales_value'],
],
'agents_count' => [
'label' => '市代',
'label' => '银牌会员',
'current_agents_count' => $userInfo->getCityAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['province']['city_agents_count'],
],
@ -98,7 +98,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['branch']['team_sales_value'],
],
'agents_count' => [
'label' => '省代',
'label' => '金牌会员',
'current_agents_count' => $userInfo->getProvinceAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['branch']['province_agents_count'],
],

View File

@ -27,7 +27,7 @@ class DealerFansResource extends JsonResource
return $this->dealer->team_sales_value;
}, 0),
'lvl_name' => (string) $this->whenLoaded('dealer', function () {
return $this->dealer->lvl_text;
return $this->dealer->lvl->text();
}, '未知'),
];
}

View File

@ -16,7 +16,8 @@ class DealerResource extends JsonResource
{
return [
'lvl' => $this->lvl,
'lvl_name'=> $this->lvl_text,
'lvl_icon' => $this->lvl->icon(),
'lvl_name'=> $this->lvl->text(),
'is_sale' => $this->is_sale,
'guanli_values'=> bcdiv($this->calculate_total_amount, '1', 2), //预计管理津贴
'team_sales_value' => $this->team_sales_value, // 团队业绩

View File

@ -23,6 +23,8 @@ class UserInfoResource extends JsonResource
'points' => (int) $this->points,
'quota_v2' => $this->quota_v2,
'quota_v1' => $this->quota_v1,
'agent_level' => $this->agent_level,
'agent_level_icon' => $this->agent_level_icon,
'agent_level_name' => $this->agent_level_name,
];
}

View File

@ -10,6 +10,7 @@ use App\Endpoint\Api\Http\Controllers\AfterSaleController;
use App\Endpoint\Api\Http\Controllers\AliOssController;
use App\Endpoint\Api\Http\Controllers\AppVersionController;
use App\Endpoint\Api\Http\Controllers\ArticleController;
use App\Endpoint\Api\Http\Controllers\Auth;
use App\Endpoint\Api\Http\Controllers\Auth\LoginController;
use App\Endpoint\Api\Http\Controllers\Auth\LogoutController;
use App\Endpoint\Api\Http\Controllers\Auth\RegisterController;
@ -85,6 +86,15 @@ Route::group([
//获取配置
Route::get('configs', [SettingController::class, 'index']);
//三方登录聚合
Route::group([
'prefix' =>'socialite',
], function () {
Route::post('code-auth/{provider}', [Auth\SocialiteAuthController::class, 'codeAuth']);
Route::post('code-bind-user/{provider}', [Auth\SocialiteAuthController::class, 'codeBindUser']);
Route::post('unbind-user/{provider}', [Auth\SocialiteAuthController::class, 'unbindUser']);
});
Route::middleware(['auth:api'])->group(function () {
// 我的信息
Route::get('me', [UserController::class, 'show']);

View File

@ -6,25 +6,26 @@ use App\Events\OrderPaid;
use App\Exceptions\BizException;
use App\Models\Order;
use App\Models\OrderRefundLog;
use App\Services\Payment\WxpayService;
use App\Services\PayService;
use App\Services\WeChatPayService;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Throwable;
class WeChatPayController extends Controller
class WxpayController extends Controller
{
/**
* 支付结果通知
*
* @param \App\Services\WeChatPayService $weChatPayService
* @param string $payment
* @param \App\Services\Payment\WxpayService $wxpayService
* @return \Illuminate\Http\Response
*/
public function paidNotify(WeChatPayService $weChatPayService)
public function paidNotify($payment, WxpayService $wxpayService)
{
return $weChatPayService->handlePaidNotify(function ($message, $fail) {
return $wxpayService->payment($payment)->handlePaidNotify(function ($message, $fail) {
$this->log('paid notify', $message);
// 通信失败
@ -66,12 +67,13 @@ class WeChatPayController extends Controller
/**
* 订单退款结果通知
*
* @param \App\Services\WeChatPayService $weChatPayService
* @param string $payment
* @param \App\Services\Payment\WxpayService $wxpayService
* @return \Illuminate\Http\Response
*/
public function orderRefundedNotify(WeChatPayService $weChatPayService)
public function orderRefundedNotify($payment, WxpayService $wxpayService)
{
return $weChatPayService->handleRefundedNotify(function ($message, $reqInfo, $fail) {
return $wxpayService->payment($payment)->handleRefundedNotify(function ($message, $reqInfo, $fail) {
$this->log('refund notify', $reqInfo);
// 通信失败

View File

@ -1,73 +0,0 @@
<?php
namespace App\Endpoint\Callback\Http\Controllers;
use App\Exceptions\BizException;
use App\Services\PayService;
use App\Services\WeChatPayService;
use EasyWeChat\Factory;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Throwable;
class YzkWeChatPayController extends Controller
{
/**
* 支付结果通知
*
* @return \Illuminate\Http\Response
*/
public function paidNotify()
{
$weChatPayService = new WeChatPayService(Factory::payment(config('wechat.payment.yzk')));
return $weChatPayService->handlePaidNotify(function ($message, $fail) {
$this->log('paid notify', $message);
// 通信失败
if (data_get($message, 'return_code') !== 'SUCCESS') {
return $fail('通信失败');
}
try {
DB::transaction(function () use ($message) {
$payService = new PayService();
if (data_get($message, 'result_code') === 'SUCCESS') {
return $payService->handleSuccessByPaySerialNumber($message['out_trade_no'], [
'out_trade_no' => $message['transaction_id'],
'pay_at' => Carbon::parse($message['time_end']),
]);
} elseif (data_get($message, 'result_code') === 'FAIL') {
return $payService->handleFailedByPaySerialNumber($message['out_trade_no'], [
'out_trade_no' => $message['transaction_id'] ?? null,
'failed_reason' => '['.$message['err_code'].']'.$message['err_code_des'],
]);
}
});
} catch (ModelNotFoundException | BizException $e) {
} catch (Throwable $e) {
throw $e;
}
return true;
});
}
/**
* 微信回调日志
*
* @param string $message
* @param array $context
* @return void
*/
protected function log(string $message, array $context = [])
{
return Log::build([
'driver' => 'daily',
'path' => storage_path('logs/yzk-wxpay-notify.log'),
])->info($message, $context);
}
}

View File

@ -2,16 +2,14 @@
use App\Endpoint\Callback\Http\Controllers\AlipayController;
use App\Endpoint\Callback\Http\Controllers\Kuaidi100Controller;
use App\Endpoint\Callback\Http\Controllers\WeChatPayController;
use App\Endpoint\Callback\Http\Controllers\YzkWeChatPayController;
use App\Endpoint\Callback\Http\Controllers\WxpayController;
use Illuminate\Support\Facades\Route;
//快递100物流推送
Route::post('kuaidi100', [Kuaidi100Controller::class, 'notify']);
// 微信支付通知
Route::post('wxpay/paid-notify', [WeChatPayController::class, 'paidNotify'])->name('wxpay.paid_notify');
Route::post('wxpay/order-refund-notify', [WeChatPayController::class, 'orderRefundedNotify'])->name('wxpay.order_refund_notify');
Route::post('wxpay/{payment}/paid-notify', [WxpayController::class, 'paidNotify'])->name('wxpay.paid_notify');
Route::post('wxpay/{payment}/order-refund-notify', [WxpayController::class, 'orderRefundedNotify'])->name('wxpay.order_refund_notify');
Route::post('alipay', AlipayController::class)->name('alipay.notify');
Route::post('yzk-wxpay/paid-notify', [YzkWeChatPayController::class, 'paidNotify'])->name('yzk_wxpay.paid_notify');

View File

@ -5,3 +5,6 @@ use Illuminate\Support\Facades\Route;
//快递100物流推送
Route::get('articles/{id}', [ArticleController::class, 'show']);
// 53 客服
Route::view('53kf', 'endpoint.kf.index');

View File

@ -25,6 +25,18 @@ enum DealerLvl: int {
};
}
/**
* @return string
*/
public function icon()
{
return match ($this) {
static::Secondary => 'https://cdn.zichunsheng.cn/statics/icons/dealer_lvl_5.png',
static::Top => 'https://cdn.zichunsheng.cn/statics/icons/dealer_lvl_6.png',
default => '',
};
}
/**
* @return string
*/
@ -35,8 +47,8 @@ enum DealerLvl: int {
static::Gold => '金牌经销商',
static::Special => '特邀经销商',
static::Contracted => '签约经销商',
static::Secondary => '二级经销商',
static::Top => '一级经销商',
static::Secondary => '签约经销商II',
static::Top => '签约经销商I',
};
}
@ -50,8 +62,8 @@ enum DealerLvl: int {
static::Gold->value => '金牌经销商',
static::Special->value => '特邀经销商',
static::Contracted->value => '签约经销商',
static::Secondary->value => '二级经销商',
static::Top->value => '一级经销商',
static::Secondary->value => '签约经销商II',
static::Top->value => '签约经销商I',
];
}
}

View File

@ -9,8 +9,8 @@ enum PayWay: string {
// 微信支付
case WxpayApp = 'wxpay_app';
case WxpayH5 = 'wxpay_h5';
case WxpayJs = 'wxpay_jsapi';
case WxpayMp = 'wxpay_mini_program';
case WxpayJsApi = 'wxpay_jsapi';
case WxpayMiniProgram = 'wxpay_mp';
// 阿里支付
case AlipayApp = 'alipay_app';
@ -20,7 +20,7 @@ enum PayWay: string {
static::Offline => '#5b69bc',
static::Balance => '#dda451',
static::Wallet => '#ff8acc',
static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => '#21b978',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => '#21b978',
static::AlipayApp => '#3085d6',
default => '#ea5455',
};
@ -32,7 +32,7 @@ enum PayWay: string {
static::Offline => 'offline',
static::Balance => 'balance',
static::Wallet => 'wallet',
static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => 'wxpay',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => 'wxpay',
static::AlipayApp => 'alipay',
};
}
@ -43,7 +43,7 @@ enum PayWay: string {
static::Offline => '线下',
static::Balance => '余额',
static::Wallet => '可提',
static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => '微信支付',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => '微信支付',
static::AlipayApp => '支付宝',
default => 'Unknown',
};
@ -58,4 +58,16 @@ enum PayWay: string {
default => 'Unknown',
};
}
/**
* @return string
*/
public static function dealerOrderTexts(): array
{
return [
static::Offline->value => '线下打款',
static::Wallet->value => '余额支付',
static::WxpayH5->value => '微信支付',
];
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace App\Enums;
enum SocialiteType: string {
case WechatMiniProgram = 'wechat-mini';
}

View File

@ -18,7 +18,7 @@ enum WxpayTradeType: string {
return match ($payWay) {
PayWay::WxpayApp => static::App,
PayWay::WxpayH5 => static::H5,
PayWay::WxpayJs, PayWay::WxpayMp => static::JSAPI,
PayWay::WxpayJsApi, PayWay::WxpayMiniProgram => static::JSAPI,
default => null,
};
}

View File

@ -66,9 +66,9 @@ class PayLog extends Model
{
return in_array($this->pay_way, [
PayWay::WxpayApp,
PayWay::WxpayJs,
PayWay::WxpayJsApi,
PayWay::WxpayH5,
PayWay::WxpayMp,
PayWay::WxpayMiniProgram,
]);
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class QuotaV1Log extends Model
{
use HasFactory;
public const ACTION_ADMIN_RECHARGE = 7;
public const ACTION_ADMIN_DEDUCTION = 8;
}

View File

@ -2,10 +2,13 @@
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class SalesValueLog extends Model
{
use HasDateTimeFormatter;
public const TYPE_INDIVIDUAL = 1;
public const TYPE_TEAM = 2;
@ -27,4 +30,9 @@ class SalesValueLog extends Model
'change_sales_value',
'remarks',
];
public function user()
{
return $this->belongsTo(User::class);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SocialiteUser extends Model
{
use HasFactory;
protected $fillable = [
'socialite_type',
'socialite_id',
'user_id',
];
public function user()
{
return $this->belongsTo(User::class);
}
}

View File

@ -224,6 +224,11 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac
return $this->hasMany(DealerUserProductLog::class, 'user_id');
}
public function socialites()
{
return $this->hasMany(SocialiteUser::class, 'user_id');
}
/**
* 确认此用户是否是 VIP
*

View File

@ -116,13 +116,26 @@ class UserInfo extends Model
*/
public static $agentLevelTexts = [
self::AGENT_LEVEL_CIVILIAN => '粉丝',
self::AGENT_LEVEL_VIP => '店铺',
self::AGENT_LEVEL_COMMUNITY => '社区',
self::AGENT_LEVEL_DISTRICT => '区级',
self::AGENT_LEVEL_CITY => '市级',
self::AGENT_LEVEL_PROVINCE => '省级',
self::AGENT_LEVEL_BRANCH => '分公司',
self::AGENT_LEVEL_DIRECTOR => '董事',
self::AGENT_LEVEL_VIP => '会员',
self::AGENT_LEVEL_COMMUNITY => '铁牌会员',
self::AGENT_LEVEL_DISTRICT => '铜牌会员',
self::AGENT_LEVEL_CITY => '银牌会员',
self::AGENT_LEVEL_PROVINCE => '金牌会员',
self::AGENT_LEVEL_BRANCH => '钻石会员',
self::AGENT_LEVEL_DIRECTOR => '默认用户',
];
/**
* 代理等级图标
*
* @var array
*/
public static $agentLevelIcons = [
self::AGENT_LEVEL_COMMUNITY => 'https://cdn.zichunsheng.cn/statics/icons/lvl_2.png',
self::AGENT_LEVEL_DISTRICT => 'https://cdn.zichunsheng.cn/statics/icons/lvl_3.png',
self::AGENT_LEVEL_CITY => 'https://cdn.zichunsheng.cn/statics/icons/lvl_4.png',
self::AGENT_LEVEL_PROVINCE => 'https://cdn.zichunsheng.cn/statics/icons/lvl_5.png',
self::AGENT_LEVEL_BRANCH => 'https://cdn.zichunsheng.cn/statics/icons/lvl_6.png',
];
/**
@ -458,6 +471,11 @@ class UserInfo extends Model
return static::$agentLevelTexts[$this->agent_level] ?? '未知';
}
public function getAgentLevelIconAttribute(): string
{
return static::$agentLevelIcons[$this->agent_level] ?? '';
}
/**
* 获取完整的邀请路径
*

View File

@ -9,6 +9,7 @@ use EasyWeChat\Payment\Application as EasyWeChatPaymentApplication;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Overtrue\EasySms\EasySms;
use Symfony\Component\HttpFoundation\HeaderUtils;

View File

@ -0,0 +1,76 @@
<?php
namespace App\Providers\Socialite;
use App\Exceptions\BizException;
use EasyWeChat\Factory as EasyWeChatFactory;
use Illuminate\Support\Facades\Cache;
use Overtrue\Socialite\Providers\Base;
use Overtrue\Socialite\User;
class WechatMini extends Base
{
/**
* Undocumented function
*
* @param string $code
* @return \Overtrue\Socialite\User
*/
public function userFromCode(string $code): User
{
$app = EasyWeChatFactory::miniProgram([
'app_id' => $this->config->get('client_id'),
'secret' => $this->config->get('client_secret'),
// 下面为可选项
// 指定 API 调用返回结果的类型array(default)/collection/object/raw/自定义类名
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => storage_path('logs/wechat-mini.log'),
],
]);
$result = $app->auth->session($code);
if ($result) {
if (data_get($result, 'errcode')) {
throw new BizException(data_get($result, 'errmsg'));
}
//缓存微信小程序会话密钥48小时
Cache::put($result['openid'], $result['session_key'], 48 * 60 * 60);
return $this->mapUserToObject([
'openid'=>$result['openid'],
// 'unionid'=>$result['unionid'],
]);
} else {
throw new BizException('解析失败');
}
}
protected function getAuthUrl(): string
{
return '';
}
protected function getTokenUrl(): string
{
return '';
}
protected function getUserByToken(string $token): array
{
return [];
}
protected function mapUserToObject(array $user): User
{
return new User([
'id' => $user['openid'] ?? null,
'name' => $user['nickname'] ?? null,
'nickname' => $user['nickname'] ?? null,
'avatar' => $user['headimgurl'] ?? null,
'email' => null,
]);
}
}

View File

@ -15,9 +15,8 @@ use App\Models\DealerProduct;
use App\Models\DealerUserProductLog;
use App\Models\ShippingAddress;
use App\Models\User;
use App\Services\Payment\WxpayService;
use App\Services\PayService;
use App\Services\WeChatPayService;
use EasyWeChat\Factory as EasyWeChatFactory;
use Illuminate\Database\QueryException;
class OrderService
@ -351,15 +350,15 @@ class OrderService
throw new BizException('支付方式 非法');
}
$app = EasyWeChatFactory::payment(config('wechat.payment.yzk'));
$data = (new WeChatPayService($app))->pay([
$params = [
'body' => app_settings('app.app_name').'-批零订单',
'out_trade_no' => $payLog->pay_sn,
'total_fee' => bcmul($order->total_amount, '100'),
'trade_type' => $tradeType->value,
'notify_url' => url(route('yzk_wxpay.paid_notify', [], false), [], true),
]);
];
$data = (new WxpayService())->pay($params, 'yzk_h5');
break;
default:

View File

@ -6,6 +6,7 @@ use App\Endpoint\Api\Http\Resources\ProductSkuSimpleResource;
use App\Endpoint\Api\Http\Resources\ShippingAddressResource;
use App\Endpoint\Api\Http\Resources\UserCouponResource;
use App\Enums\PayWay;
use App\Enums\SocialiteType;
use App\Enums\WxpayTradeType;
use App\Exceptions\BizException;
use App\Exceptions\ShippingNotSupportedException;
@ -15,8 +16,10 @@ use App\Models\OrderProduct;
use App\Models\ProductGift;
use App\Models\ProductSku;
use App\Models\ShippingAddress;
use App\Models\SocialiteUser;
use App\Models\User;
use App\Models\UserCoupon;
use App\Services\Payment\WxpayService;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
@ -796,18 +799,40 @@ class OrderService
throw new BizException('支付方式 非法');
}
$data = (new WeChatPayService())->pay([
$params = [
'body' => app_settings('app.app_name').'-商城订单',
'out_trade_no' => $payLog->pay_sn,
'total_fee' => $order->total_amount,
'trade_type' => $tradeType->value,
]);
];
if ($tradeType === WxpayTradeType::JSAPI) {
$socialite = match ($payLog->pay_way) {
PayWay::WxpayMiniProgram => SocialiteUser::where([
'user_id' => $order->user_id,
'socialite_type' => SocialiteType::WechatMiniProgram,
])->first(),
};
if ($socialite === null) {
throw new BizException('未绑定微信小程序');
}
$params['openid'] = $socialite->socialite_id;
}
$data = (new WxpayService())->pay($params, match ($payLog->pay_way) {
PayWay::WxpayMiniProgram => 'mini_program',
default => 'default',
});
} elseif ($payLog->isAlipay()) {
$data = app(AlipayService::class)->pay([
$params = [
'subject' => app_settings('app.app_name').'-商城订单',
'out_trade_no' => $payLog->pay_sn,
'total_amount' => bcdiv($order->total_amount, 100, 2),
]);
];
$data = app(AlipayService::class)->pay($params);
}
return [

View File

@ -0,0 +1,149 @@
<?php
namespace App\Services\Payment;
use App\Enums\WxpayTradeType;
use App\Exceptions\WeChatPayException;
use EasyWeChat\Factory;
use EasyWeChat\Payment\Application;
use Illuminate\Support\Arr;
class WxpayService
{
/**
* @var array<string, \EasyWeChat\Payment\Application>
*/
protected $payments = [];
/**
* 支付
*
* @param array $params
* @param string|null $payment
* @return array
*/
public function pay(array $params, ?string $payment = null): array
{
if (! isset($params['notify_url'])) {
$path = route('wxpay.paid_notify', ['payment' => $payment ?: 'default'], false);
$params['notify_url'] = url($path, [], true);
}
if (! isset($params['trade_type'])) {
$params['trade_type'] = WxpayTradeType::App->value;
}
$app = $this->payment($payment);
$result = $app->order->unify($params);
$this->validateResult($result, $params);
return match ($params['trade_type']) {
WxpayTradeType::App->value => $app->jssdk->appConfig($result['prepay_id']),
WxpayTradeType::H5->value => Arr::only($result, ['mweb_url']),
default => $app->jssdk->bridgeConfig($result['prepay_id'], false),
};
}
/**
* 根据商户订单号退款
*
* @param string $number
* @param string $refundNumber
* @param int $totalFee
* @param int $refundFee
* @param array $optional
* @return array
*/
public function refundByOutTradeNumber(array $params, ?string $payment = null)
{
$optional = Arr::get($params, 'optional', []);
if (! is_array($optional)) {
$optional = [];
}
if (! isset($optional['notify_url'])) {
$path = route('wxpay.order_refund_notify', [
'payment' => $payment ?: 'default',
], false);
$optional['notify_url'] = url($path, [], true);
}
$result = $this->payment($payment)->refund->byOutTradeNumber(
$params['number'],
$params['refund_number'],
$params['total_fee'],
$params['refund_fee'],
$optional,
);
$this->validateResult($result, $params);
return $result;
}
/**
* @param string|null $name
* @return \EasyWeChat\Payment\Application
*/
public function payment(?string $name = null): Application
{
$name = $name ?: 'default';
return $this->payments[$name] = $this->get($name);
}
/**
* @param string $name
* @return \EasyWeChat\Payment\Application
*/
protected function get(string $name): Application
{
return $this->payments[$name] ?? $this->resolve($name);
}
/**
* @param string $name
* @return \EasyWeChat\Payment\Application
*
* @throws \App\Exceptions\WeChatPayException
*/
protected function resolve(string $name): Application
{
$config = config("wechat.payment.{$name}");
if (empty($config)) {
throw new WeChatPayException("支付 [{$name}] 配置未找到");
}
return Factory::payment($config);
}
/**
* 校验响应结果
*
* @param array $result
* @param array $raw
* @return void
*
* @throws \App\Exceptions\WeChatPayException
*/
protected function validateResult(array $result, array $raw = [])
{
if (Arr::get($result, 'return_code') !== 'SUCCESS') {
throw new WeChatPayException(Arr::get($result, 'return_msg', '请求失败'), $raw);
}
if (Arr::get($result, 'result_code') !== 'SUCCESS') {
throw new WeChatPayException(sprintf(
'[%s] %s',
Arr::get($result, 'err_code', '-1'),
Arr::get($result, 'err_code_des', '交易失败')
), $raw);
}
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Services;
use App\Exceptions\BizException;
use App\Models\User;
class QuotaV1Service
{
/**
* 变老配额余额
*
* @param \App\Models\User $user
* @param int $changeBalance
* @param int $action
* @param string|null $remarks
* @param mixed $loggable
* @return void
*/
public function changeBalance(User $user, int $changeBalance, int $action, ?string $remarks = null, $loggable = null)
{
if ($changeBalance === 0) {
return;
}
$userInfo = $user->userInfo()->lockForUpdate()->first();
if ($userInfo === null) {
throw new BizException('系统错误');
}
// 变更前余额
$beforeBalance = $userInfo->quota_v1;
$_changeBalance = abs($changeBalance);
if ($changeBalance > 0) {
// 收入
$user->userInfo()->increment('quota_v1', $_changeBalance);
} else {
// 支出
if ($userInfo->quota_v1 < $_changeBalance) {
throw new BizException('老配额不足');
}
$user->userInfo()->decrement('quota_v1', $_changeBalance);
}
$user->walletLogs()->create([
'loggable_id' => $loggable?->id,
'loggable_type' => $loggable?->getMorphClass(),
'before_balance' => $beforeBalance,
'change_balance' => $changeBalance,
'action' => $action,
'remarks' => $remarks,
]);
}
}

View File

@ -1,172 +0,0 @@
<?php
namespace App\Services;
use App\Exceptions\WeChatPayException;
use Closure;
use EasyWeChat\Factory;
use EasyWeChat\Payment\Application;
use Illuminate\Support\Arr;
class WeChatPayService
{
/**
* 小程序交易类型
* https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2
*/
public const TRADE_TYPE_JSAPI = 'JSAPI'; // JSAPI支付
public const TRADE_TYPE_APP = 'APP'; // App支付
public const TRADE_TYPE_NATIVE = 'NATIVE'; // Native支付
public const TRADE_TYPE_H5 = 'MWEB'; // H5支付
/**
* @var \EasyWeChat\Payment\Application
*/
protected $app;
/**
* @param \EasyWeChat\Payment\Application|null $app
*/
public function __construct(?Application $app = null)
{
if ($app === null) {
$app = Factory::payment(config('wechat.payment.default'));
}
$this->app = $app;
}
/**
* 支付
*
* @param array $params
* @return array
*
* @throws \App\Exceptions\WeChatPayException
*/
public function pay(array $params)
{
if (! isset($params['notify_url'])) {
$params['notify_url'] = url(route('wxpay.paid_notify', [], false), [], true);
}
// 如果交易类型不存在,则使用 App 支付
if (! isset($params['trade_type'])) {
$params['trade_type'] = static::TRADE_TYPE_APP;
}
$result = $this->app->order->unify($params);
if (data_get($result, 'return_code') !== 'SUCCESS') {
throw new WeChatPayException(
data_get($result, 'return_msg', '请求失败'),
$params
);
}
if (data_get($result, 'result_code') !== 'SUCCESS') {
throw new WeChatPayException(
sprintf(
'[%s] %s',
data_get($result, 'err_code', '-1'),
data_get($result, 'err_code_des', '交易失败')
),
$params
);
}
return match ($params['trade_type']) {
static::TRADE_TYPE_APP => $this->app->jssdk->appConfig($result['prepay_id']),
static::TRADE_TYPE_H5 => Arr::only($result, ['mweb_url']),
default => $this->app->jssdk->bridgeConfig($result['prepay_id'], false),
};
}
/**
* 支付结果通知
*
* @param \Closure $closure
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handlePaidNotify(Closure $closure)
{
return $this->app->handlePaidNotify($closure);
}
/**
* 根据微信订单号退款
*
* @param string $transactionId
* @param string $refundNumber
* @param int $totalFee
* @param int $refundFee
* @param array $optional
* @return array
*/
public function refundByTransactionId(string $transactionId, string $refundNumber, int $totalFee, int $refundFee, array $optional = [])
{
$result = $this->app->refund->byTransactionId($transactionId, $refundNumber, $totalFee, $refundFee, $optional);
if (data_get($result, 'return_code') !== 'SUCCESS') {
throw new WeChatPayException(
data_get($result, 'return_msg', '请求失败')
);
}
if (data_get($result, 'result_code') !== 'SUCCESS') {
throw new WeChatPayException(
sprintf(
'[%s] %s',
data_get($result, 'err_code', '-1'),
data_get($result, 'err_code_des', '退款失败')
)
);
}
return $result;
}
/**
* 根据商户订单号退款
*
* @param string $number
* @param string $refundNumber
* @param int $totalFee
* @param int $refundFee
* @param array $optional
* @return array
*/
public function refundByOutTradeNumber(string $number, string $refundNumber, int $totalFee, int $refundFee, array $optional = [])
{
$result = $this->app->refund->byOutTradeNumber($number, $refundNumber, $totalFee, $refundFee, $optional);
if (data_get($result, 'return_code') !== 'SUCCESS') {
throw new WeChatPayException(
data_get($result, 'return_msg', '请求失败')
);
}
if (data_get($result, 'result_code') !== 'SUCCESS') {
throw new WeChatPayException(
sprintf(
'[%s] %s',
data_get($result, 'err_code', '-1'),
data_get($result, 'err_code_des', '退款失败')
)
);
}
return $result;
}
/**
* 退款结果通知
*
* @param \Closure $closure
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handleRefundedNotify(Closure $closure)
{
return $this->app->handleRefundedNotify($closure);
}
}

View File

@ -26,6 +26,7 @@
"laravel/sanctum": "^2.12",
"laravel/tinker": "^2.5",
"overtrue/easy-sms": "^2.0",
"overtrue/socialite": "*",
"simplesoftwareio/simple-qrcode": "^4.2",
"tucker-eric/eloquentfilter": "^3.0",
"w7corp/easywechat": "^5.10"

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f53d3bea81e27c131da9f29019c886a1",
"content-hash": "5ea856539b7c9cb2093859052437846e",
"packages": [
{
"name": "adbario/php-dot-notation",

View File

@ -0,0 +1,12 @@
<?php
use App\Providers\Socialite\WechatMini;
return [
'wechat-mini'=>[
'provider' => WechatMini::class,
'client_id' => env('WECHAT_MINI_PROGRAM_APPID', ''),
'client_secret' => env('WECHAT_MINI_PROGRAM_SECRET', ''),
'redirect' =>'',
],
];

View File

@ -1,7 +1,56 @@
<?php
return [
/*
* 公众号
*/
'official_account' => [
'default' => [
'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', 'your-app-id'), // AppID
'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', 'your-app-secret'), // AppSecret
'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', 'your-token'), // Token
'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', ''), // EncodingAESKey
/*
* OAuth 配置
*
* scopes公众平台snsapi_userinfo / snsapi_base开放平台snsapi_login
* callbackOAuth授权完成后的回调页地址(如果使用中间件,则随便填写。。。)
* enforce_https是否强制使用 HTTPS 跳转
*/
'oauth' => [
'scopes' => array_map('trim', explode(',', env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_SCOPES', 'snsapi_userinfo'))),
'callback' => env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/examples/oauth_callback.php'),
'enforce_https' => true,
],
],
],
/*
* 开放平台第三方平台
*/
// 'open_platform' => [
// 'default' => [
// 'app_id' => env('WECHAT_OPEN_PLATFORM_APPID', ''),
// 'secret' => env('WECHAT_OPEN_PLATFORM_SECRET', ''),
// 'token' => env('WECHAT_OPEN_PLATFORM_TOKEN', ''),
// 'aes_key' => env('WECHAT_OPEN_PLATFORM_AES_KEY', ''),
// ],
// ],
/*
* 小程序
*/
'mini_program' => [
'default' => [
'app_id' => env('WECHAT_MINI_PROGRAM_APPID', ''),
'secret' => env('WECHAT_MINI_PROGRAM_SECRET', ''),
'token' => env('WECHAT_MINI_PROGRAM_TOKEN', ''),
'aes_key' => env('WECHAT_MINI_PROGRAM_AES_KEY', ''),
],
],
'payment' => [
// 商城 - 微信 App支付
'default' => [
'sandbox' => env('WECHAT_PAYMENT_SANDBOX', false),
'app_id' => env('WECHAT_PAYMENT_APPID'),
@ -23,7 +72,29 @@ return [
],
],
],
'yzk' => [
// 商城 - 微信小程序支付
'mini_program' => [
'sandbox' => env('WECHAT_PAYMENT_SANDBOX', false),
'app_id' => env('WECHAT_MINI_PROGRAM_APPID'),
'mch_id' => env('WECHAT_PAYMENT_MCH_ID'),
'key' => env('WECHAT_PAYMENT_KEY'),
'cert_path' => env('WECHAT_PAYMENT_CERT_PATH'), // 绝对地址
'key_path' => env('WECHAT_PAYMENT_KEY_PATH'), // 绝对地址
'notify_url' => env('WECHAT_PAYMENT_NOTIFY_URL'),
// 日志
'log' => [
'default' => 'daily',
'channels' => [
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/wxpay-mini-program.log'),
'level' => 'info',
],
],
],
],
'yzk_h5' => [
'sandbox' => env('WECHAT_PAYMENT_SANDBOX_YZK', false),
'app_id' => env('WECHAT_PAYMENT_APPID_YZK'),
'mch_id' => env('WECHAT_PAYMENT_MCH_ID_YZK'),

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSocialiteUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('socialite_users', function (Blueprint $table) {
$table->id();
$table->string('socialite_type')->comment('平台');
$table->string('socialite_id')->comment('三方唯一ID');
$table->unsignedBigInteger('user_id')->nullable()->comment('绑定的用户ID');
$table->timestamps();
$table->index(['socialite_type', 'socialite_id']);
$table->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('socialite_users');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateQuotaV1LogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('quota_v1_logs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->comment('用户ID');
$table->nullableMorphs('loggable');
$table->tinyInteger('action')->comment('操作类型');
$table->unsignedDecimal('before_balance')->default(0)->comment('变更前的余额');
$table->unsignedDecimal('change_balance', 12, 3)->default(0)->comment('变动余额');
$table->string('remarks')->nullable()->comment('备注');
$table->timestamps();
$table->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('quota_v1_logs');
}
}

View File

@ -60,11 +60,6 @@ class AdAddressSeeder extends Seeder
'dimensions'=> '',
'is_show' => true,
],
'app_start_page_banner'=>[
'name' => 'APP启动页广告位',
'dimensions'=> '',
'is_show' => true,
],
'vip_will_cheap_banner'=> [
'name' => '会员就是省',
'dimensions'=> '710*382',
@ -90,11 +85,6 @@ class AdAddressSeeder extends Seeder
'dimensions'=> '600*700',
'is_show' => true,
],
'merchant_notice'=>[
'name' =>'商户公告弹窗',
'dimensions'=> '600*700',
'is_show'=> true,
],
'article_banner'=>[
'name' =>'文章广告位',
'dimensions'=> '',
@ -105,36 +95,136 @@ class AdAddressSeeder extends Seeder
'dimensions'=> '750*524',
'is_show'=> true,
],
'mall_notice'=>[
'name' =>'商城公告广告位',
'dimensions'=> '600*700',
'is_show'=> true,
],
'merchant_notice'=>[
'name' =>'商户公告广告位',
'dimensions'=> '600*700',
'is_show'=> true,
],
'homepage_popup'=>[
'name' =>'首页弹窗广告位',
'dimensions'=> '608*735',
'is_show'=> true,
],
'wholesale_homepage_banner'=>[
'name' =>'批零首页广告位',
'dimensions'=> '750*550',
'is_show'=> true,
],
'vip_coupon_bottom_banner'=>[
'name' =>'VIP优惠券底部广告位',
'dimensions'=> '213*246',
'is_show'=> true,
],
/** 商城小程序广告位 start **/
'wechat_mini_top_navigation_banner' => [
'name' => '【小程序】首页顶部导航',
'dimensions'=> '50*50',
'is_show' => true,
],
'wechat_mini_floor_banner' => [
'name' => '【小程序】首页楼层广告位',
'dimensions'=> '710*220',
'is_show' => true,
],
'wechat_mini_recommend_banner' => [
'name' => '【小程序】首页精品推荐广告位',
'dimensions'=> '670*260',
'is_show' => true,
],
'wechat_mini_top_banner' => [
'name' => '【小程序】首页顶部广告位',
'dimensions'=> '750*450',
'is_show' => true,
],
'wechat_mini_vip_banner' => [
'name' => '【小程序】VIP会员积分权益',
'dimensions'=> '710*196',
'is_show' => true,
],
'wechat_mini_vip_award_banner' => [
'name' => '【小程序】VIP会员推广奖励',
'dimensions'=> '226*289',
'is_show' => true,
],
'wechat_mini_vip_car_banner' => [
'name' => '【小程序】VIP直通车广告位',
'dimensions'=> '375*200',
'is_show' => true,
],
'wechat_mini_share_register_banner' => [
'name' => '【小程序】分享注册位',
'dimensions'=> '',
'is_show' => true,
],
'wechat_mini_share_download_banner' => [
'name' => '【小程序】分享下载位',
'dimensions'=> '',
'is_show' => true,
],
'wechat_mini_vip_will_cheap_banner'=> [
'name' => '【小程序】会员就是省',
'dimensions'=> '710*382',
'is_show' => true,
],
'wechat_mini_vip_award_bottom_banner'=> [
'name' => '【小程序】会员推广奖励底部广告位',
'dimensions'=> '470*202',
'is_show' => true,
],
'wechat_mini_show_vip_banner'=> [
'name' => '【小程序】查看会员权益广告位',
'dimensions'=> '710*382',
'is_show' => true,
],
'wechat_mini_become_vip_banner'=> [
'name' => '【小程序】成为会员广告位',
'dimensions'=> '710*382',
'is_show' => true,
],
'wechat_mini_mall_notice'=>[
'name' => '【小程序】商城公告弹窗',
'dimensions'=> '600*700',
'is_show' => true,
],
'wechat_mini_article_banner'=>[
'name' =>'【小程序】文章广告位',
'dimensions'=> '',
'is_show'=> true,
],
'wechat_mini_vip_coupon_banner'=>[
'name' =>'【小程序】会员优惠券广告位',
'dimensions'=> '750*524',
'is_show'=> true,
],
'wechat_mini_homepage_popup'=>[
'name' =>'【小程序】首页弹窗广告位',
'dimensions'=> '608*735',
'is_show'=> true,
],
'wechat_mini_vip_coupon_bottom_banner'=>[
'name' =>'【小程序】VIP优惠券底部广告位',
'dimensions'=> '213*246',
'is_show'=> true,
],
/** 商城小程序广告位 end **/
//商城APP端广告位
'app_start_page_banner'=>[
'name' => 'APP启动页广告位',
'dimensions'=> '',
'is_show' => true,
],
/** 商户特殊广告位 start **/
'merchant_notice'=>[
'name' =>'商户公告广告位',
'dimensions'=> '600*700',
'is_show'=> true,
],
'merchant_top_navigation_banner'=>[
'name' =>'商户端首页顶部导航',
'dimensions'=> '58*58',
'is_show' =>true,
],
/** 商户特殊广告位 end **/
/** 批零特殊广告位 start **/
'wholesale_homepage_banner'=>[
'name' =>'批零首页广告位',
'dimensions'=> '750*550',
'is_show'=> true,
],
/** 批零特殊广告位 end **/
] as $key => $values) {
AdAddress::firstOrCreate(['key' => $key], $values);
}

View File

@ -305,6 +305,8 @@ class AdminPermissionSeeder extends Seeder
'curd' => ['index', 'create', 'store', 'edit', 'update', 'destroy'],
'children' => [
'log_list'=>['name' =>'分红记录'],
'recharge'=>['name' =>'增加配额'],
'deduction'=>['name' =>'扣减配额'],
],
],
'dealers' =>[

View File

@ -11,6 +11,7 @@ namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection width
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection dimensions
* @property Grid\Column|Collection id
@ -18,13 +19,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection key
* @property Grid\Column|Collection name
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection address
* @property Grid\Column|Collection consignee
* @property Grid\Column|Collection is_default
* @property Grid\Column|Collection telephone
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection zone
* @property Grid\Column|Collection zone_id
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection type
* @property Grid\Column|Collection version
@ -40,6 +34,7 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection value
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection password
@ -64,6 +59,7 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection tracking_number
* @property Grid\Column|Collection before_agent_level
* @property Grid\Column|Collection change_agent_level
* @property Grid\Column|Collection remark
* @property Grid\Column|Collection apk_link
* @property Grid\Column|Collection cate
* @property Grid\Column|Collection context
@ -96,9 +92,10 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection continue_click_times
* @property Grid\Column|Collection last_click_at
* @property Grid\Column|Collection coupon_id
* @property Grid\Column|Collection is_enable
* @property Grid\Column|Collection ranges
* @property Grid\Column|Collection status
* @property Grid\Column|Collection administrator_id
* @property Grid\Column|Collection status
* @property Grid\Column|Collection task_id
* @property Grid\Column|Collection limit
* @property Grid\Column|Collection sent
@ -109,20 +106,20 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection use_start_at
* @property Grid\Column|Collection lvl
* @property Grid\Column|Collection order_completed_at
* @property Grid\Column|Collection remark
* @property Grid\Column|Collection total_amount
* @property Grid\Column|Collection earningable_id
* @property Grid\Column|Collection earningable_type
* @property Grid\Column|Collection fee
* @property Grid\Column|Collection fee_rate
* @property Grid\Column|Collection is_manager
* @property Grid\Column|Collection pay_at
* @property Grid\Column|Collection pay_image
* @property Grid\Column|Collection pay_info
* @property Grid\Column|Collection pay_way
* @property Grid\Column|Collection payer_id
* @property Grid\Column|Collection settle_at
* @property Grid\Column|Collection total_earnings
* @property Grid\Column|Collection end_at
* @property Grid\Column|Collection is_manager
* @property Grid\Column|Collection is_settle
* @property Grid\Column|Collection real_amount
* @property Grid\Column|Collection start_at
@ -133,13 +130,16 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection price
* @property Grid\Column|Collection qty
* @property Grid\Column|Collection sale_price
* @property Grid\Column|Collection reason
* @property Grid\Column|Collection allocated_at
* @property Grid\Column|Collection consignee_address
* @property Grid\Column|Collection consignee_name
* @property Grid\Column|Collection consignee_telephone
* @property Grid\Column|Collection consignee_zone
* @property Grid\Column|Collection consignor_id
* @property Grid\Column|Collection out_trade_no
* @property Grid\Column|Collection paied_time
* @property Grid\Column|Collection pay_sn
* @property Grid\Column|Collection pay_time
* @property Grid\Column|Collection settle_state
* @property Grid\Column|Collection shipping_time
@ -160,8 +160,12 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection change_from_purchase_subsidy_id
* @property Grid\Column|Collection purchase_subsidy_id
* @property Grid\Column|Collection change_sales_value
* @property Grid\Column|Collection dealer_price
* @property Grid\Column|Collection quantity
* @property Grid\Column|Collection sell_price
* @property Grid\Column|Collection before_lvl
* @property Grid\Column|Collection change_lvl
* @property Grid\Column|Collection revoke_id
* @property Grid\Column|Collection account_amount
* @property Grid\Column|Collection rate
* @property Grid\Column|Collection service_amount
@ -187,7 +191,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection job_id
* @property Grid\Column|Collection reason
* @property Grid\Column|Collection fails
* @property Grid\Column|Collection file
* @property Grid\Column|Collection success
@ -197,7 +200,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection is_push
* @property Grid\Column|Collection message_id
* @property Grid\Column|Collection order_package_id
* @property Grid\Column|Collection quantity
* @property Grid\Column|Collection checked_at
* @property Grid\Column|Collection is_failed
* @property Grid\Column|Collection last_news
@ -210,7 +212,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection gift_for_sku_id
* @property Grid\Column|Collection reduced_amount
* @property Grid\Column|Collection remain_quantity
* @property Grid\Column|Collection sell_price
* @property Grid\Column|Collection sku_id
* @property Grid\Column|Collection specs
* @property Grid\Column|Collection spu_id
@ -220,10 +221,8 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection max
* @property Grid\Column|Collection auto_complete_at
* @property Grid\Column|Collection is_change
* @property Grid\Column|Collection is_settlable
* @property Grid\Column|Collection note
* @property Grid\Column|Collection out_trade_no
* @property Grid\Column|Collection pay_sn
* @property Grid\Column|Collection pay_way
* @property Grid\Column|Collection products_total_amount
* @property Grid\Column|Collection shipping_fee
* @property Grid\Column|Collection shipping_state
@ -244,7 +243,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection reviewer_id
* @property Grid\Column|Collection buynote_id
* @property Grid\Column|Collection cost_price
* @property Grid\Column|Collection growth_value
* @property Grid\Column|Collection market_price
* @property Grid\Column|Collection media
* @property Grid\Column|Collection release_at
@ -262,14 +260,20 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection size
* @property Grid\Column|Collection x
* @property Grid\Column|Collection y
* @property Grid\Column|Collection address
* @property Grid\Column|Collection consignee
* @property Grid\Column|Collection is_default
* @property Grid\Column|Collection telephone
* @property Grid\Column|Collection zone
* @property Grid\Column|Collection zone_id
* @property Grid\Column|Collection rule_id
* @property Grid\Column|Collection template_id
* @property Grid\Column|Collection zones
* @property Grid\Column|Collection expires_at
* @property Grid\Column|Collection phone
* @property Grid\Column|Collection socialite_id
* @property Grid\Column|Collection socialite_type
* @property Grid\Column|Collection tag_id
* @property Grid\Column|Collection tag_log_id
* @property Grid\Column|Collection tag_log_type
* @property Grid\Column|Collection taggable_id
* @property Grid\Column|Collection taggable_type
* @property Grid\Column|Collection bank_description
@ -289,6 +293,7 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection depth
* @property Grid\Column|Collection gender
* @property Grid\Column|Collection group_sales_value
* @property Grid\Column|Collection growth_value
* @property Grid\Column|Collection inviter_id
* @property Grid\Column|Collection nickname
* @property Grid\Column|Collection pre_growth_value
@ -305,6 +310,7 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection register_ip
* @property Grid\Column|Collection status_remark
*
* @method Grid\Column|Collection width(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection dimensions(string $label = null)
* @method Grid\Column|Collection id(string $label = null)
@ -312,13 +318,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection key(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection consignee(string $label = null)
* @method Grid\Column|Collection is_default(string $label = null)
* @method Grid\Column|Collection telephone(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection zone(string $label = null)
* @method Grid\Column|Collection zone_id(string $label = null)
* @method Grid\Column|Collection detail(string $label = null)
* @method Grid\Column|Collection type(string $label = null)
* @method Grid\Column|Collection version(string $label = null)
@ -334,6 +333,7 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection http_path(string $label = null)
* @method Grid\Column|Collection slug(string $label = null)
* @method Grid\Column|Collection role_id(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection value(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
@ -358,6 +358,7 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection tracking_number(string $label = null)
* @method Grid\Column|Collection before_agent_level(string $label = null)
* @method Grid\Column|Collection change_agent_level(string $label = null)
* @method Grid\Column|Collection remark(string $label = null)
* @method Grid\Column|Collection apk_link(string $label = null)
* @method Grid\Column|Collection cate(string $label = null)
* @method Grid\Column|Collection context(string $label = null)
@ -390,9 +391,10 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection continue_click_times(string $label = null)
* @method Grid\Column|Collection last_click_at(string $label = null)
* @method Grid\Column|Collection coupon_id(string $label = null)
* @method Grid\Column|Collection is_enable(string $label = null)
* @method Grid\Column|Collection ranges(string $label = null)
* @method Grid\Column|Collection status(string $label = null)
* @method Grid\Column|Collection administrator_id(string $label = null)
* @method Grid\Column|Collection status(string $label = null)
* @method Grid\Column|Collection task_id(string $label = null)
* @method Grid\Column|Collection limit(string $label = null)
* @method Grid\Column|Collection sent(string $label = null)
@ -403,20 +405,20 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection use_start_at(string $label = null)
* @method Grid\Column|Collection lvl(string $label = null)
* @method Grid\Column|Collection order_completed_at(string $label = null)
* @method Grid\Column|Collection remark(string $label = null)
* @method Grid\Column|Collection total_amount(string $label = null)
* @method Grid\Column|Collection earningable_id(string $label = null)
* @method Grid\Column|Collection earningable_type(string $label = null)
* @method Grid\Column|Collection fee(string $label = null)
* @method Grid\Column|Collection fee_rate(string $label = null)
* @method Grid\Column|Collection is_manager(string $label = null)
* @method Grid\Column|Collection pay_at(string $label = null)
* @method Grid\Column|Collection pay_image(string $label = null)
* @method Grid\Column|Collection pay_info(string $label = null)
* @method Grid\Column|Collection pay_way(string $label = null)
* @method Grid\Column|Collection payer_id(string $label = null)
* @method Grid\Column|Collection settle_at(string $label = null)
* @method Grid\Column|Collection total_earnings(string $label = null)
* @method Grid\Column|Collection end_at(string $label = null)
* @method Grid\Column|Collection is_manager(string $label = null)
* @method Grid\Column|Collection is_settle(string $label = null)
* @method Grid\Column|Collection real_amount(string $label = null)
* @method Grid\Column|Collection start_at(string $label = null)
@ -427,13 +429,16 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection price(string $label = null)
* @method Grid\Column|Collection qty(string $label = null)
* @method Grid\Column|Collection sale_price(string $label = null)
* @method Grid\Column|Collection reason(string $label = null)
* @method Grid\Column|Collection allocated_at(string $label = null)
* @method Grid\Column|Collection consignee_address(string $label = null)
* @method Grid\Column|Collection consignee_name(string $label = null)
* @method Grid\Column|Collection consignee_telephone(string $label = null)
* @method Grid\Column|Collection consignee_zone(string $label = null)
* @method Grid\Column|Collection consignor_id(string $label = null)
* @method Grid\Column|Collection out_trade_no(string $label = null)
* @method Grid\Column|Collection paied_time(string $label = null)
* @method Grid\Column|Collection pay_sn(string $label = null)
* @method Grid\Column|Collection pay_time(string $label = null)
* @method Grid\Column|Collection settle_state(string $label = null)
* @method Grid\Column|Collection shipping_time(string $label = null)
@ -454,8 +459,12 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection change_from_purchase_subsidy_id(string $label = null)
* @method Grid\Column|Collection purchase_subsidy_id(string $label = null)
* @method Grid\Column|Collection change_sales_value(string $label = null)
* @method Grid\Column|Collection dealer_price(string $label = null)
* @method Grid\Column|Collection quantity(string $label = null)
* @method Grid\Column|Collection sell_price(string $label = null)
* @method Grid\Column|Collection before_lvl(string $label = null)
* @method Grid\Column|Collection change_lvl(string $label = null)
* @method Grid\Column|Collection revoke_id(string $label = null)
* @method Grid\Column|Collection account_amount(string $label = null)
* @method Grid\Column|Collection rate(string $label = null)
* @method Grid\Column|Collection service_amount(string $label = null)
@ -481,7 +490,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection job_id(string $label = null)
* @method Grid\Column|Collection reason(string $label = null)
* @method Grid\Column|Collection fails(string $label = null)
* @method Grid\Column|Collection file(string $label = null)
* @method Grid\Column|Collection success(string $label = null)
@ -491,7 +499,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection is_push(string $label = null)
* @method Grid\Column|Collection message_id(string $label = null)
* @method Grid\Column|Collection order_package_id(string $label = null)
* @method Grid\Column|Collection quantity(string $label = null)
* @method Grid\Column|Collection checked_at(string $label = null)
* @method Grid\Column|Collection is_failed(string $label = null)
* @method Grid\Column|Collection last_news(string $label = null)
@ -504,7 +511,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection gift_for_sku_id(string $label = null)
* @method Grid\Column|Collection reduced_amount(string $label = null)
* @method Grid\Column|Collection remain_quantity(string $label = null)
* @method Grid\Column|Collection sell_price(string $label = null)
* @method Grid\Column|Collection sku_id(string $label = null)
* @method Grid\Column|Collection specs(string $label = null)
* @method Grid\Column|Collection spu_id(string $label = null)
@ -514,10 +520,8 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection max(string $label = null)
* @method Grid\Column|Collection auto_complete_at(string $label = null)
* @method Grid\Column|Collection is_change(string $label = null)
* @method Grid\Column|Collection is_settlable(string $label = null)
* @method Grid\Column|Collection note(string $label = null)
* @method Grid\Column|Collection out_trade_no(string $label = null)
* @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 shipping_fee(string $label = null)
* @method Grid\Column|Collection shipping_state(string $label = null)
@ -538,7 +542,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection reviewer_id(string $label = null)
* @method Grid\Column|Collection buynote_id(string $label = null)
* @method Grid\Column|Collection cost_price(string $label = null)
* @method Grid\Column|Collection growth_value(string $label = null)
* @method Grid\Column|Collection market_price(string $label = null)
* @method Grid\Column|Collection media(string $label = null)
* @method Grid\Column|Collection release_at(string $label = null)
@ -556,14 +559,20 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection size(string $label = null)
* @method Grid\Column|Collection x(string $label = null)
* @method Grid\Column|Collection y(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection consignee(string $label = null)
* @method Grid\Column|Collection is_default(string $label = null)
* @method Grid\Column|Collection telephone(string $label = null)
* @method Grid\Column|Collection zone(string $label = null)
* @method Grid\Column|Collection zone_id(string $label = null)
* @method Grid\Column|Collection rule_id(string $label = null)
* @method Grid\Column|Collection template_id(string $label = null)
* @method Grid\Column|Collection zones(string $label = null)
* @method Grid\Column|Collection expires_at(string $label = null)
* @method Grid\Column|Collection phone(string $label = null)
* @method Grid\Column|Collection socialite_id(string $label = null)
* @method Grid\Column|Collection socialite_type(string $label = null)
* @method Grid\Column|Collection tag_id(string $label = null)
* @method Grid\Column|Collection tag_log_id(string $label = null)
* @method Grid\Column|Collection tag_log_type(string $label = null)
* @method Grid\Column|Collection taggable_id(string $label = null)
* @method Grid\Column|Collection taggable_type(string $label = null)
* @method Grid\Column|Collection bank_description(string $label = null)
@ -583,6 +592,7 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection depth(string $label = null)
* @method Grid\Column|Collection gender(string $label = null)
* @method Grid\Column|Collection group_sales_value(string $label = null)
* @method Grid\Column|Collection growth_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 pre_growth_value(string $label = null)
@ -604,6 +614,7 @@ namespace Dcat\Admin {
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection width
* @property Show\Field|Collection created_at
* @property Show\Field|Collection dimensions
* @property Show\Field|Collection id
@ -611,13 +622,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection key
* @property Show\Field|Collection name
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection address
* @property Show\Field|Collection consignee
* @property Show\Field|Collection is_default
* @property Show\Field|Collection telephone
* @property Show\Field|Collection user_id
* @property Show\Field|Collection zone
* @property Show\Field|Collection zone_id
* @property Show\Field|Collection detail
* @property Show\Field|Collection type
* @property Show\Field|Collection version
@ -633,6 +637,7 @@ namespace Dcat\Admin {
* @property Show\Field|Collection http_path
* @property Show\Field|Collection slug
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection value
* @property Show\Field|Collection avatar
* @property Show\Field|Collection password
@ -657,6 +662,7 @@ namespace Dcat\Admin {
* @property Show\Field|Collection tracking_number
* @property Show\Field|Collection before_agent_level
* @property Show\Field|Collection change_agent_level
* @property Show\Field|Collection remark
* @property Show\Field|Collection apk_link
* @property Show\Field|Collection cate
* @property Show\Field|Collection context
@ -689,9 +695,10 @@ namespace Dcat\Admin {
* @property Show\Field|Collection continue_click_times
* @property Show\Field|Collection last_click_at
* @property Show\Field|Collection coupon_id
* @property Show\Field|Collection is_enable
* @property Show\Field|Collection ranges
* @property Show\Field|Collection status
* @property Show\Field|Collection administrator_id
* @property Show\Field|Collection status
* @property Show\Field|Collection task_id
* @property Show\Field|Collection limit
* @property Show\Field|Collection sent
@ -702,20 +709,20 @@ namespace Dcat\Admin {
* @property Show\Field|Collection use_start_at
* @property Show\Field|Collection lvl
* @property Show\Field|Collection order_completed_at
* @property Show\Field|Collection remark
* @property Show\Field|Collection total_amount
* @property Show\Field|Collection earningable_id
* @property Show\Field|Collection earningable_type
* @property Show\Field|Collection fee
* @property Show\Field|Collection fee_rate
* @property Show\Field|Collection is_manager
* @property Show\Field|Collection pay_at
* @property Show\Field|Collection pay_image
* @property Show\Field|Collection pay_info
* @property Show\Field|Collection pay_way
* @property Show\Field|Collection payer_id
* @property Show\Field|Collection settle_at
* @property Show\Field|Collection total_earnings
* @property Show\Field|Collection end_at
* @property Show\Field|Collection is_manager
* @property Show\Field|Collection is_settle
* @property Show\Field|Collection real_amount
* @property Show\Field|Collection start_at
@ -726,13 +733,16 @@ namespace Dcat\Admin {
* @property Show\Field|Collection price
* @property Show\Field|Collection qty
* @property Show\Field|Collection sale_price
* @property Show\Field|Collection reason
* @property Show\Field|Collection allocated_at
* @property Show\Field|Collection consignee_address
* @property Show\Field|Collection consignee_name
* @property Show\Field|Collection consignee_telephone
* @property Show\Field|Collection consignee_zone
* @property Show\Field|Collection consignor_id
* @property Show\Field|Collection out_trade_no
* @property Show\Field|Collection paied_time
* @property Show\Field|Collection pay_sn
* @property Show\Field|Collection pay_time
* @property Show\Field|Collection settle_state
* @property Show\Field|Collection shipping_time
@ -753,8 +763,12 @@ namespace Dcat\Admin {
* @property Show\Field|Collection change_from_purchase_subsidy_id
* @property Show\Field|Collection purchase_subsidy_id
* @property Show\Field|Collection change_sales_value
* @property Show\Field|Collection dealer_price
* @property Show\Field|Collection quantity
* @property Show\Field|Collection sell_price
* @property Show\Field|Collection before_lvl
* @property Show\Field|Collection change_lvl
* @property Show\Field|Collection revoke_id
* @property Show\Field|Collection account_amount
* @property Show\Field|Collection rate
* @property Show\Field|Collection service_amount
@ -780,7 +794,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection queue
* @property Show\Field|Collection uuid
* @property Show\Field|Collection job_id
* @property Show\Field|Collection reason
* @property Show\Field|Collection fails
* @property Show\Field|Collection file
* @property Show\Field|Collection success
@ -790,7 +803,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection is_push
* @property Show\Field|Collection message_id
* @property Show\Field|Collection order_package_id
* @property Show\Field|Collection quantity
* @property Show\Field|Collection checked_at
* @property Show\Field|Collection is_failed
* @property Show\Field|Collection last_news
@ -803,7 +815,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection gift_for_sku_id
* @property Show\Field|Collection reduced_amount
* @property Show\Field|Collection remain_quantity
* @property Show\Field|Collection sell_price
* @property Show\Field|Collection sku_id
* @property Show\Field|Collection specs
* @property Show\Field|Collection spu_id
@ -813,10 +824,8 @@ namespace Dcat\Admin {
* @property Show\Field|Collection max
* @property Show\Field|Collection auto_complete_at
* @property Show\Field|Collection is_change
* @property Show\Field|Collection is_settlable
* @property Show\Field|Collection note
* @property Show\Field|Collection out_trade_no
* @property Show\Field|Collection pay_sn
* @property Show\Field|Collection pay_way
* @property Show\Field|Collection products_total_amount
* @property Show\Field|Collection shipping_fee
* @property Show\Field|Collection shipping_state
@ -837,7 +846,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection reviewer_id
* @property Show\Field|Collection buynote_id
* @property Show\Field|Collection cost_price
* @property Show\Field|Collection growth_value
* @property Show\Field|Collection market_price
* @property Show\Field|Collection media
* @property Show\Field|Collection release_at
@ -855,14 +863,20 @@ namespace Dcat\Admin {
* @property Show\Field|Collection size
* @property Show\Field|Collection x
* @property Show\Field|Collection y
* @property Show\Field|Collection address
* @property Show\Field|Collection consignee
* @property Show\Field|Collection is_default
* @property Show\Field|Collection telephone
* @property Show\Field|Collection zone
* @property Show\Field|Collection zone_id
* @property Show\Field|Collection rule_id
* @property Show\Field|Collection template_id
* @property Show\Field|Collection zones
* @property Show\Field|Collection expires_at
* @property Show\Field|Collection phone
* @property Show\Field|Collection socialite_id
* @property Show\Field|Collection socialite_type
* @property Show\Field|Collection tag_id
* @property Show\Field|Collection tag_log_id
* @property Show\Field|Collection tag_log_type
* @property Show\Field|Collection taggable_id
* @property Show\Field|Collection taggable_type
* @property Show\Field|Collection bank_description
@ -882,6 +896,7 @@ namespace Dcat\Admin {
* @property Show\Field|Collection depth
* @property Show\Field|Collection gender
* @property Show\Field|Collection group_sales_value
* @property Show\Field|Collection growth_value
* @property Show\Field|Collection inviter_id
* @property Show\Field|Collection nickname
* @property Show\Field|Collection pre_growth_value
@ -898,6 +913,7 @@ namespace Dcat\Admin {
* @property Show\Field|Collection register_ip
* @property Show\Field|Collection status_remark
*
* @method Show\Field|Collection width(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection dimensions(string $label = null)
* @method Show\Field|Collection id(string $label = null)
@ -905,13 +921,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection key(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection consignee(string $label = null)
* @method Show\Field|Collection is_default(string $label = null)
* @method Show\Field|Collection telephone(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection zone(string $label = null)
* @method Show\Field|Collection zone_id(string $label = null)
* @method Show\Field|Collection detail(string $label = null)
* @method Show\Field|Collection type(string $label = null)
* @method Show\Field|Collection version(string $label = null)
@ -927,6 +936,7 @@ namespace Dcat\Admin {
* @method Show\Field|Collection http_path(string $label = null)
* @method Show\Field|Collection slug(string $label = null)
* @method Show\Field|Collection role_id(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection value(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection password(string $label = null)
@ -951,6 +961,7 @@ namespace Dcat\Admin {
* @method Show\Field|Collection tracking_number(string $label = null)
* @method Show\Field|Collection before_agent_level(string $label = null)
* @method Show\Field|Collection change_agent_level(string $label = null)
* @method Show\Field|Collection remark(string $label = null)
* @method Show\Field|Collection apk_link(string $label = null)
* @method Show\Field|Collection cate(string $label = null)
* @method Show\Field|Collection context(string $label = null)
@ -983,9 +994,10 @@ namespace Dcat\Admin {
* @method Show\Field|Collection continue_click_times(string $label = null)
* @method Show\Field|Collection last_click_at(string $label = null)
* @method Show\Field|Collection coupon_id(string $label = null)
* @method Show\Field|Collection is_enable(string $label = null)
* @method Show\Field|Collection ranges(string $label = null)
* @method Show\Field|Collection status(string $label = null)
* @method Show\Field|Collection administrator_id(string $label = null)
* @method Show\Field|Collection status(string $label = null)
* @method Show\Field|Collection task_id(string $label = null)
* @method Show\Field|Collection limit(string $label = null)
* @method Show\Field|Collection sent(string $label = null)
@ -996,20 +1008,20 @@ namespace Dcat\Admin {
* @method Show\Field|Collection use_start_at(string $label = null)
* @method Show\Field|Collection lvl(string $label = null)
* @method Show\Field|Collection order_completed_at(string $label = null)
* @method Show\Field|Collection remark(string $label = null)
* @method Show\Field|Collection total_amount(string $label = null)
* @method Show\Field|Collection earningable_id(string $label = null)
* @method Show\Field|Collection earningable_type(string $label = null)
* @method Show\Field|Collection fee(string $label = null)
* @method Show\Field|Collection fee_rate(string $label = null)
* @method Show\Field|Collection is_manager(string $label = null)
* @method Show\Field|Collection pay_at(string $label = null)
* @method Show\Field|Collection pay_image(string $label = null)
* @method Show\Field|Collection pay_info(string $label = null)
* @method Show\Field|Collection pay_way(string $label = null)
* @method Show\Field|Collection payer_id(string $label = null)
* @method Show\Field|Collection settle_at(string $label = null)
* @method Show\Field|Collection total_earnings(string $label = null)
* @method Show\Field|Collection end_at(string $label = null)
* @method Show\Field|Collection is_manager(string $label = null)
* @method Show\Field|Collection is_settle(string $label = null)
* @method Show\Field|Collection real_amount(string $label = null)
* @method Show\Field|Collection start_at(string $label = null)
@ -1020,13 +1032,16 @@ namespace Dcat\Admin {
* @method Show\Field|Collection price(string $label = null)
* @method Show\Field|Collection qty(string $label = null)
* @method Show\Field|Collection sale_price(string $label = null)
* @method Show\Field|Collection reason(string $label = null)
* @method Show\Field|Collection allocated_at(string $label = null)
* @method Show\Field|Collection consignee_address(string $label = null)
* @method Show\Field|Collection consignee_name(string $label = null)
* @method Show\Field|Collection consignee_telephone(string $label = null)
* @method Show\Field|Collection consignee_zone(string $label = null)
* @method Show\Field|Collection consignor_id(string $label = null)
* @method Show\Field|Collection out_trade_no(string $label = null)
* @method Show\Field|Collection paied_time(string $label = null)
* @method Show\Field|Collection pay_sn(string $label = null)
* @method Show\Field|Collection pay_time(string $label = null)
* @method Show\Field|Collection settle_state(string $label = null)
* @method Show\Field|Collection shipping_time(string $label = null)
@ -1047,8 +1062,12 @@ namespace Dcat\Admin {
* @method Show\Field|Collection change_from_purchase_subsidy_id(string $label = null)
* @method Show\Field|Collection purchase_subsidy_id(string $label = null)
* @method Show\Field|Collection change_sales_value(string $label = null)
* @method Show\Field|Collection dealer_price(string $label = null)
* @method Show\Field|Collection quantity(string $label = null)
* @method Show\Field|Collection sell_price(string $label = null)
* @method Show\Field|Collection before_lvl(string $label = null)
* @method Show\Field|Collection change_lvl(string $label = null)
* @method Show\Field|Collection revoke_id(string $label = null)
* @method Show\Field|Collection account_amount(string $label = null)
* @method Show\Field|Collection rate(string $label = null)
* @method Show\Field|Collection service_amount(string $label = null)
@ -1074,7 +1093,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection job_id(string $label = null)
* @method Show\Field|Collection reason(string $label = null)
* @method Show\Field|Collection fails(string $label = null)
* @method Show\Field|Collection file(string $label = null)
* @method Show\Field|Collection success(string $label = null)
@ -1084,7 +1102,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection is_push(string $label = null)
* @method Show\Field|Collection message_id(string $label = null)
* @method Show\Field|Collection order_package_id(string $label = null)
* @method Show\Field|Collection quantity(string $label = null)
* @method Show\Field|Collection checked_at(string $label = null)
* @method Show\Field|Collection is_failed(string $label = null)
* @method Show\Field|Collection last_news(string $label = null)
@ -1097,7 +1114,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection gift_for_sku_id(string $label = null)
* @method Show\Field|Collection reduced_amount(string $label = null)
* @method Show\Field|Collection remain_quantity(string $label = null)
* @method Show\Field|Collection sell_price(string $label = null)
* @method Show\Field|Collection sku_id(string $label = null)
* @method Show\Field|Collection specs(string $label = null)
* @method Show\Field|Collection spu_id(string $label = null)
@ -1107,10 +1123,8 @@ namespace Dcat\Admin {
* @method Show\Field|Collection max(string $label = null)
* @method Show\Field|Collection auto_complete_at(string $label = null)
* @method Show\Field|Collection is_change(string $label = null)
* @method Show\Field|Collection is_settlable(string $label = null)
* @method Show\Field|Collection note(string $label = null)
* @method Show\Field|Collection out_trade_no(string $label = null)
* @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 shipping_fee(string $label = null)
* @method Show\Field|Collection shipping_state(string $label = null)
@ -1131,7 +1145,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection reviewer_id(string $label = null)
* @method Show\Field|Collection buynote_id(string $label = null)
* @method Show\Field|Collection cost_price(string $label = null)
* @method Show\Field|Collection growth_value(string $label = null)
* @method Show\Field|Collection market_price(string $label = null)
* @method Show\Field|Collection media(string $label = null)
* @method Show\Field|Collection release_at(string $label = null)
@ -1149,14 +1162,20 @@ namespace Dcat\Admin {
* @method Show\Field|Collection size(string $label = null)
* @method Show\Field|Collection x(string $label = null)
* @method Show\Field|Collection y(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection consignee(string $label = null)
* @method Show\Field|Collection is_default(string $label = null)
* @method Show\Field|Collection telephone(string $label = null)
* @method Show\Field|Collection zone(string $label = null)
* @method Show\Field|Collection zone_id(string $label = null)
* @method Show\Field|Collection rule_id(string $label = null)
* @method Show\Field|Collection template_id(string $label = null)
* @method Show\Field|Collection zones(string $label = null)
* @method Show\Field|Collection expires_at(string $label = null)
* @method Show\Field|Collection phone(string $label = null)
* @method Show\Field|Collection socialite_id(string $label = null)
* @method Show\Field|Collection socialite_type(string $label = null)
* @method Show\Field|Collection tag_id(string $label = null)
* @method Show\Field|Collection tag_log_id(string $label = null)
* @method Show\Field|Collection tag_log_type(string $label = null)
* @method Show\Field|Collection taggable_id(string $label = null)
* @method Show\Field|Collection taggable_type(string $label = null)
* @method Show\Field|Collection bank_description(string $label = null)
@ -1176,6 +1195,7 @@ namespace Dcat\Admin {
* @method Show\Field|Collection depth(string $label = null)
* @method Show\Field|Collection gender(string $label = null)
* @method Show\Field|Collection group_sales_value(string $label = null)
* @method Show\Field|Collection growth_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 pre_growth_value(string $label = null)

View File

@ -32,7 +32,7 @@ server "47.108.227.246", user: "deployer", roles: %w{admin supervisor}
# http://capistranorb.com/documentation/getting-started/configuration/
# Feel free to add new variables to customise your setup.
set :branch, "develop"
set :branch, "1.x"
set :deploy_to, "/www/wwwroot/test.zichunsheng.cn"

View File

@ -14,7 +14,7 @@ return [
'userInfo'=>[
'avatar' => '头像',
'nickname' => '昵称',
'agent_level'=>'管理级别',
'agent_level'=>'身份',
'growth_value'=>'消费值',
'group_sales_value'=>'业绩',
'inviterInfo'=>[

View File

@ -0,0 +1,17 @@
<?php
return [
'labels' => [
'SalesValueLog' => 'SalesValueLog',
'sales-value-log' => 'SalesValueLog',
],
'fields' => [
'user_id' => '用户',
'order_id' => '订单',
'order_user_id' => '下单用户',
'type' => '类型',
'change_sales_value' => '变更销售值',
'remarks' => '备注',
],
'options' => [
],
];

View File

@ -25,7 +25,7 @@ return [
'avatar' => '头像',
'nickname' => '昵称',
'code' => '邀请码',
'agent_level'=>'管理级别',
'agent_level'=>'身份',
'growth_value'=>'消费值',
'group_sales_value'=>'业绩',
'inviterInfo'=>[
@ -37,7 +37,7 @@ return [
'user_info'=>[
'avatar' => '头像',
'nickname' => '昵称',
'agent_level'=>'管理级别',
'agent_level'=>'身份',
'growth_value'=>'消费值',
'group_sales_value'=>'业绩',
'points'=>'积分',

View File

@ -0,0 +1,49 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title></title>
<script>
var arr = location.href.split("?");
arr.push("");
window.addEventListener("message", function (event) {
if (event.data.split(":")[0] == "tel_new") {
window.location.href = 'tel:' + event.data.split(":")[1];
} else {
window.top.postMessage(event.data, '*');
}
}, false);
</script>
</head>
<script>
var _53code = document.createElement("script");
_53code.src = "https://tb.53kf.com/code/code/bba10e62b32391cdefb75e35d59943237/1";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(_53code, s);
_53code.onload = _53code.onreadystatechange = function () {
if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
var api = $53.createApi();
api.push('cmd', 'member');
api.push('id', '11');
api.push('name', 'rrrrrss');
api.push('phone', '15633333333');
api.query();
document.write("<frameset rows=\"*\" cols=\"*\" frameborder=\"no\" border=\"0\" framespacing=\"0\">");
var http_pro = (document.location.protocol == 'https:') ? 'https://' : 'http://';
document.write("<frame id='frame_a' src=\"" + http_pro + "tb.53kf.com/code/client/bba10e62b32391cdefb75e35d59943237/1?" + "\" title=\"mainFrame\" />");
document.write("</frameset>");
}
}
</script>
<noframes>
<body>
</body>
</noframes>
</html>