Commit 5d0b0dd8 by jack

更新

parent 4e61fb66
<?php
namespace App\Admin\Controllers;
use App\Models\Merchant;
use App\Models\OrderDivideRecord;
use App\Models\User;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class OrderDivideRecordController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(OrderDivideRecord::with(['order', 'users']), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('order.order_sn', '订单号');
$grid->column('users.phone', '下单会员手机号');
//$grid->column('og_id', '订单商品ID');
$grid->column('order_price', '订单商品价格');
$grid->column('divide_price', '佣金');
//$grid->column('proportion', '分佣比例%');
$grid->column('sh_type', '推荐类型')->display(function ($val) {
$arr = ['平台', '直推', '间推', '商家'];
return $arr[$val];
});
$grid->column('is_div', '是否分账')->display(function ($val) {
return $val == 1 ? '是' : '否';
});
$grid->column('um_id', '推荐信息')->display(function ($val) {
$stype = $this->sh_type;
$name = '';
if ($stype == 3) {
$name = Merchant::where('id', $val)->value('name');
} else {
$name = $stype ? User::where('id', $val)->value('phone') : '';
}
return $name;
});
$grid->column('remark', '备注')->width(80);
$grid->column('created_at');
//$grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->disableRowSelector();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('order.order_sn', '订单号')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new OrderDivideRecord(), function (Show $show) {
$show->field('id');
$show->field('order_id');
$show->field('user_id');
$show->field('og_id');
$show->field('order_price');
$show->field('divide_price');
$show->field('proportion');
$show->field('sh_type');
$show->field('is_div');
$show->field('remark');
$show->field('um_id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new OrderDivideRecord(), function (Form $form) {
$form->display('id');
$form->text('order_id');
$form->text('user_id');
$form->text('og_id');
$form->text('order_price');
$form->text('divide_price');
$form->text('proportion');
$form->text('sh_type');
$form->text('is_div');
$form->text('remark');
$form->text('um_id');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\OrderDivideRecord as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class OrderDivideRecord extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
$router->resource('orderInfo', 'OrderInfoController'); //订单管理 $router->resource('orderInfo', 'OrderInfoController'); //订单管理
$router->resource('order-divide-record', 'OrderDivideRecordController'); //订单分佣记录
$router->resource('user', 'UserController'); //用户管理 $router->resource('user', 'UserController'); //用户管理
$router->resource('user-share', 'ShareController'); //查看下级 $router->resource('user-share', 'ShareController'); //查看下级
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api; namespace App\Http\Controllers\Api;
use App\Models\OrderDivideRecord;
use App\Command\Log; use App\Command\Log;
use App\Handlers\QqCos; use App\Handlers\QqCos;
use App\Handlers\FileUploadHandler; use App\Handlers\FileUploadHandler;
...@@ -26,4 +27,14 @@ public function getList() ...@@ -26,4 +27,14 @@ public function getList()
return $this->JsonResponse($list); return $this->JsonResponse($list);
} }
//测试订单分佣
public function orderDiv(Request $request)
{
$order_id = $request->order_id ?? 0;
//分账列表
$payment_params = OrderDivideRecord::divide($order_id); //返回分账参数列表
echo "<pre>";
print_r($payment_params);
}
} }
...@@ -54,8 +54,9 @@ public function paymentConfirm(Request $request) ...@@ -54,8 +54,9 @@ public function paymentConfirm(Request $request)
"div_members" => "" //分账参数列表 默认是数组List "div_members" => "" //分账参数列表 默认是数组List
); );
//分账列表 //分账列表
$payment_params['div_members'] = OrderDivideRecord::divide($orderObj->id); //返回分账参数列表 $divResult = OrderDivideRecord::divide($orderObj->id); //返回分账参数列表
$payment_params['div_members'] = $divResult['div_members'];
$payment_params['confirm_amt'] = $divResult['confirm_amt'];
Log::add('发起支付确认', $payment_params); Log::add('发起支付确认', $payment_params);
DB::beginTransaction(); DB::beginTransaction();
try { try {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use App\Models\Adapay; use App\Models\Adapay;
use App\Models\HfCompanyMember; use App\Models\HfCompanyMember;
use App\Models\HfSettleAccount; use App\Models\HfSettleAccount;
use App\Jobs\AutoOrderDivide;
use Exception; use Exception;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -60,6 +61,8 @@ public function createMemberAccount(Request $request) ...@@ -60,6 +61,8 @@ public function createMemberAccount(Request $request)
$local_params['account_id'] = $result['id']; $local_params['account_id'] = $result['id'];
$local_params['created_at'] = date("Y-m-d H:i:s", $result['create_time']); $local_params['created_at'] = date("Y-m-d H:i:s", $result['create_time']);
DB::table('hf_settle_account')->insert($local_params); DB::table('hf_settle_account')->insert($local_params);
//发起分账
$this->dispatch(new AutoOrderDivide($user_id, 10));
} else { } else {
throw new Exception($result['error_msg']); throw new Exception($result['error_msg']);
} }
......
...@@ -500,6 +500,11 @@ public function scanCodeVerifi(Request $request) ...@@ -500,6 +500,11 @@ public function scanCodeVerifi(Request $request)
if (!$orderObj) { if (!$orderObj) {
return $this->JsonResponse('', '参数错误', 201); return $this->JsonResponse('', '参数错误', 201);
} }
//核销员所属门店
$hx_store = $useObj->store_id ?? 0;
if ($verObj->role_id != 2 || $orderObj->store_id != $hx_store) {
return $this->JsonResponse('', '核销码不匹配门店', 500);
}
Log::add('核销操作', [$orderObj->verification_at]); Log::add('核销操作', [$orderObj->verification_at]);
if (!$orderObj->verification_at) { if (!$orderObj->verification_at) {
...@@ -568,12 +573,18 @@ public function scanCodeVerifi(Request $request) ...@@ -568,12 +573,18 @@ public function scanCodeVerifi(Request $request)
//扫码核销展示详情 //扫码核销展示详情
public function scanCodeDetail(Request $request) public function scanCodeDetail(Request $request)
{ {
$useObj = $request->user();
$code = $request->code ?? ''; $code = $request->code ?? '';
$orderObj = OrderInfoModel::where('verification_code', $code)->first(); $orderObj = OrderInfoModel::where('verification_code', $code)->first();
if (!$orderObj) { if (!$orderObj) {
Log::add('核销码', $code); Log::add('核销码', $code);
return $this->JsonResponse('', '参数错误', 201); return $this->JsonResponse('', '参数错误', 201);
} }
//核销员所属门店
$hx_store = $useObj->store_id ?? 0;
if ($useObj->role_id != 2 || $orderObj->store_id != $hx_store) {
return $this->JsonResponse('', '核销码不匹配门店', 500);
}
$order_id = $orderObj->id; $order_id = $orderObj->id;
//商品信息 //商品信息
$order_goods = $this->getOrderGoods($order_id); $order_goods = $this->getOrderGoods($order_id);
......
...@@ -54,30 +54,4 @@ public function autoChangeReceiveStatus() ...@@ -54,30 +54,4 @@ public function autoChangeReceiveStatus()
return '--ok--'; return '--ok--';
} }
//定时任务--订单分佣(废弃) -- 分佣已采用汇付分账模式
public function autoOrderCommission()
{
$chunkSize = 50; // 每次处理的订单数量
$orders = OrderInfoModel::where(["order_status" => 4, 'is_commission' => 1])->orderBy('id')->take($chunkSize);
while ($orders->count() > 0) {
$orders->chunk($chunkSize, function ($batch) {
foreach ($batch as $order) {
//佣金分配
$res = OrderDivideRecord::divide($order->id);
if ($res) {
$order->is_commission = 2;
$order->save();
}
}
});
// 移动游标到下一批
$orders->skip($chunkSize);
$orders = $orders->getQuery();
sleep(3);
}
return '--ok--';
}
} }
...@@ -47,8 +47,7 @@ public function handle() ...@@ -47,8 +47,7 @@ public function handle()
$this->order->order_status = 4; //已完成 $this->order->order_status = 4; //已完成
$this->order->save(); $this->order->save();
//佣金分配
OrderDivideRecord::divide($this->order->id);
DB::commit(); DB::commit();
Log::add('订单自动完成', $this->order->toArray()); Log::add('订单自动完成', $this->order->toArray());
......
<?php
namespace App\Jobs;
use App\Command\Log;
use App\Models\OrderDivideRecord;
use App\Models\OrderInfo;
use App\Models\PaymentRecord;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Exception;
class AutoOrderDivide implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $um_id; //推广人员ID
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($um_id, $delay)
{
$this->um_id = $um_id;
// 设置延迟的时间,delay() 方法的参数代表多少秒之后执行
$this->delay($delay);
}
/**
* * 定义这个任务类具体的执行逻辑
* 当队列处理器从队列中取出任务时,会调用 handle() 方法
* Execute the job.
*
* @return void
*/
public function handle()
{
$payment_confirm = new \NwVVVS\AdapaySdk\PaymentConfirm(); //支付确认
$spObj = User::find($this->um_id);
$member_id = $spObj->member_id;
$chunkSize = 10; // 每次处理数量
$orders = OrderDivideRecord::where(['um_id' => $this->um_id, 'is_div' => 0])->whereIn('um_id', [1, 2])->orderBy('id')->take($chunkSize);
while ($orders->count() > 0) {
$orders->chunk($chunkSize, function ($batch) use ($member_id, $payment_confirm) {
foreach ($batch as $item) {
//交易记录
$order_sn = OrderInfo::where('id', $item->order_id)->value('order_sn');
$prObj = PaymentRecord::where('order_sn', $order_sn)->first();
# 支付确认参数设置
$payment_params = array(
"payment_id" => $prObj->payment_id,
"order_no" => 'payconfirm_' . date("YmdHis") . rand(100000, 999999),
"confirm_amt" => $item->divide_price,
"description" => "",
"div_members" => "" //分账参数列表 默认是数组List
);
// 分账列表
$payment_params['div_members'] = [
'member_id' => $member_id,
'amount' => $item->divide_price,
'fee_flag' => 'Y'
];
# 发起支付确认创建
$payment_confirm->create($payment_params);
# 对支付确认创建结果进行处理
if ($payment_confirm->isError()) {
//失败处理
Log::add('支付确认失败', $payment_confirm->result);
$result = $payment_confirm->result;
//throw new Exception($result['error_msg']);
} else {
//成功处理
Log::add('支付确认成功', $payment_confirm->result);
$result = $payment_confirm->result;
if ($result['status'] == 'succeeded') {
$item->is_div = 1;
$item->save();
Log::add('分账成功', ['order_sn' => $order_sn, 'member_id' => $member_id]);
}
}
}
});
// 移动游标到下一批
$orders->skip($chunkSize);
$orders = $orders->getQuery();
sleep(2);
}
}
}
...@@ -173,7 +173,9 @@ public function payNotify($params = []) ...@@ -173,7 +173,9 @@ public function payNotify($params = [])
DB::beginTransaction(); DB::beginTransaction();
try { try {
//分账列表 //分账列表
$payment_params['div_members'] = OrderDivideRecord::divide($orderObj->id); //返回分账参数列表 $divResult = OrderDivideRecord::divide($orderObj->id); //返回分账参数列表
$payment_params['div_members'] = $divResult['div_members'];
$payment_params['confirm_amt'] = $divResult['confirm_amt'];
Log::add('发起支付确认' . $order_no, $payment_params); Log::add('发起支付确认' . $order_no, $payment_params);
# 发起支付确认创建 # 发起支付确认创建
...@@ -189,7 +191,7 @@ public function payNotify($params = []) ...@@ -189,7 +191,7 @@ public function payNotify($params = [])
Log::add('支付确认成功', $payment_confirm->result); Log::add('支付确认成功', $payment_confirm->result);
$result = $payment_confirm->result; $result = $payment_confirm->result;
if ($result['status'] == 'succeeded') { if ($result['status'] == 'succeeded') {
DB::table('li_order_info')->where('order_sn', $order_no)->update(['div_status' => 1]); //DB::table('li_order_info')->where('order_sn', $order_no)->update(['div_status' => 1]);
Log::add('分账成功', ['order_sn' => $order_no]); Log::add('分账成功', ['order_sn' => $order_no]);
} }
} }
......
...@@ -26,11 +26,13 @@ public static function divide($order_id) ...@@ -26,11 +26,13 @@ public static function divide($order_id)
$div_members = []; //汇付 分账对象 $div_members = []; //汇付 分账对象
$orderObj = OrderInfo::find($order_id); $orderObj = OrderInfo::find($order_id);
$merchant_id = $orderObj->merchant_id; //绑定的商户 $merchant_id = $orderObj->merchant_id; //绑定的商户
$user_id = $orderObj->user_id; //下单用户ID $buyer_id = $orderObj->user_id; //下单用户ID
$userObj = User::find($user_id); $userObj = User::find($buyer_id);
$spuid = $userObj->spuid; //直推分享人 $spuid = $userObj->spuid; //直推分享人
$second_spuid = $userObj->second_spuid; //间推分享人 $second_spuid = $userObj->second_spuid; //间推分享人
$total_amount = 0; //订单商品总价 $total_amount = 0; //订单商品总价
$first_proportion = $second_proportion = $merchant_proportion = ''; //佣金比例
$sp_ogid = ''; //参与分佣商品ID
$commissionPreData = [ $commissionPreData = [
'first_member_id' => '', 'first_member_id' => '',
'first_amount' => 0, 'first_amount' => 0,
...@@ -39,6 +41,23 @@ public static function divide($order_id) ...@@ -39,6 +41,23 @@ public static function divide($order_id)
'merchant_member_id' => '', 'merchant_member_id' => '',
'merchant_amount' => 0, 'merchant_amount' => 0,
]; ];
//直推是否实名
$isFirstRealName = 0;
if ($spuid) {
$isFirstRealName = HfSettleAccount::where(['member_type' => 0, 'mid' => $spuid])->count();
}
//间推是否实名
$isSecondRealName = 0;
if ($second_spuid) {
$isSecondRealName = HfSettleAccount::where(['member_type' => 0, 'mid' => $second_spuid])->count();
}
//商户是否实名
$isMerchantRealName = 0;
if ($merchant_id) {
$hfCompanyMObj = HfCompanyMember::where('merchant_id', $merchant_id)->first();
$isMerchantRealName = ($hfCompanyMObj->status == 'succeeded') ? 1 : 0;
}
$ogList = OrderGoods::where("order_id", $order_id)->get(); //订单商品 $ogList = OrderGoods::where("order_id", $order_id)->get(); //订单商品
foreach ($ogList as $kk => $item) { foreach ($ogList as $kk => $item) {
$goods_amount = $item->goods_price * $item->goods_number; $goods_amount = $item->goods_price * $item->goods_number;
...@@ -48,6 +67,10 @@ public static function divide($order_id) ...@@ -48,6 +67,10 @@ public static function divide($order_id)
$merchant_commission = $goodObj->merchant_commission; $merchant_commission = $goodObj->merchant_commission;
$first_commission = $goodObj->first_commission; $first_commission = $goodObj->first_commission;
$second_commission = $goodObj->second_commission; $second_commission = $goodObj->second_commission;
$first_proportion .= $goodObj->first_commission . ",";
$second_proportion .= $goodObj->second_commission . ",";
$merchant_proportion .= $goodObj->merchant_commission . ",";
$sp_ogid = $item->id . ",";
//直推佣金 //直推佣金
if ($spuid && $first_commission >= 1 && $first_commission < 100) { if ($spuid && $first_commission >= 1 && $first_commission < 100) {
$divide_price = number_format($goods_amount * ($first_commission / 100), 2); $divide_price = number_format($goods_amount * ($first_commission / 100), 2);
...@@ -55,9 +78,8 @@ public static function divide($order_id) ...@@ -55,9 +78,8 @@ public static function divide($order_id)
//汇付参数 //汇付参数
if ($spObj->member_id) { if ($spObj->member_id) {
$spObj->total_revenue += $divide_price; //总余额记录 $spObj->total_revenue += $divide_price; //总余额记录
//$spObj->balance += $divide_price; //自动分账打款 字段未使用
$spObj->save(); $spObj->save();
self::addRecord($item->id, $order_id, $goods_amount, $divide_price, $first_commission, $spuid, $user_id, 1); //self::addRecord($item->id, $order_id, $goods_amount, $divide_price, $first_commission, $spuid, $user_id, 1, $isExistAccount);
$commissionPreData['first_member_id'] = $spObj->member_id; $commissionPreData['first_member_id'] = $spObj->member_id;
$commissionPreData['first_amount'] += $divide_price; $commissionPreData['first_amount'] += $divide_price;
...@@ -70,9 +92,7 @@ public static function divide($order_id) ...@@ -70,9 +92,7 @@ public static function divide($order_id)
//汇付参数 //汇付参数
if ($spObj->member_id) { if ($spObj->member_id) {
$spObj->total_revenue += $divide_price; $spObj->total_revenue += $divide_price;
//$spObj->balance += $divide_price;
$spObj->save(); $spObj->save();
self::addRecord($item->id, $order_id, $goods_amount, $divide_price, $second_commission, $second_spuid, $user_id, 2);
$commissionPreData['second_member_id'] = $spObj->member_id; $commissionPreData['second_member_id'] = $spObj->member_id;
$commissionPreData['second_amount'] += $divide_price; $commissionPreData['second_amount'] += $divide_price;
...@@ -84,48 +104,67 @@ public static function divide($order_id) ...@@ -84,48 +104,67 @@ public static function divide($order_id)
//收益直接到商户账户 //收益直接到商户账户
$merObj = Merchant::find($merchant_id); $merObj = Merchant::find($merchant_id);
//汇付参数 //汇付参数
$member_id = HfCompanyMember::where('merchant_id', $merchant_id)->value('member_id'); $member_id = $hfCompanyMObj->member_id;
if ($member_id) { if ($member_id) {
$merObj->total_revenue += $divide_price; $merObj->total_revenue += $divide_price;
//$merObj->balance += $divide_price;
$merObj->save(); $merObj->save();
//记录
self::addRecord($item->id, $order_id, $goods_amount, $divide_price, $merchant_commission, $merchant_id, $user_id, 3);
$commissionPreData['merchant_member_id'] = $member_id; $commissionPreData['merchant_member_id'] = $member_id;
$commissionPreData['merchant_amount'] += $divide_price; $commissionPreData['merchant_amount'] += $divide_price;
} }
} }
} }
//组合分账参数 //组合分账参数
if ($commissionPreData['first_member_id']) { if ($spuid && $first_commission >= 1 && $first_commission < 100 && $commissionPreData['first_amount'] > 0) {
array_push($div_members, ['member_id' => $commissionPreData['first_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['first_amount']), 'fee_flag' => 'Y']); self::addRecord($sp_ogid, $order_id, $orderObj->goods_amount, $commissionPreData['first_amount'], $first_proportion, $spuid, $buyer_id, 1, $isFirstRealName);
if ($isFirstRealName) {
array_push($div_members, ['member_id' => $commissionPreData['first_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['first_amount']), 'fee_flag' => 'Y']);
}
} }
if ($commissionPreData['second_member_id']) { if ($second_spuid && $second_commission >= 1 && $second_commission < 100 && $commissionPreData['second_amount'] > 0) {
array_push($div_members, ['member_id' => $commissionPreData['second_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['second_amount']), 'fee_flag' => 'Y']); self::addRecord($sp_ogid, $order_id, $orderObj->goods_amount, $commissionPreData['second_amount'], $second_proportion, $second_spuid, $buyer_id, 2, $isSecondRealName);
if ($isSecondRealName) {
array_push($div_members, ['member_id' => $commissionPreData['second_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['second_amount']), 'fee_flag' => 'Y']);
}
} }
if ($commissionPreData['merchant_member_id']) { if ($merchant_id && $merchant_commission >= 1 && $merchant_commission < 100 && $commissionPreData['merchant_amount'] > 0) {
array_push($div_members, ['member_id' => $commissionPreData['merchant_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['merchant_amount']), 'fee_flag' => 'Y']); self::addRecord($sp_ogid, $order_id, $orderObj->goods_amount, $commissionPreData['merchant_amount'], $merchant_proportion, $merchant_id, $buyer_id, 3, $isMerchantRealName);
if ($isMerchantRealName) {
array_push($div_members, ['member_id' => $commissionPreData['merchant_member_id'], 'amount' => sprintf("%.2f", $commissionPreData['merchant_amount']), 'fee_flag' => 'Y']);
}
} }
//商户本身 //商户本身
$aimeiyuePrice = $total_amount - $commissionPreData['first_amount'] - $commissionPreData['second_amount'] - $commissionPreData['merchant_amount']; $aimeiyuePrice = $total_amount - $commissionPreData['first_amount'] - $commissionPreData['second_amount'] - $commissionPreData['merchant_amount'];
self::addRecord($sp_ogid, $order_id, $orderObj->goods_amount, $aimeiyuePrice, '', 0, $buyer_id, 0, 1);
array_push($div_members, ['member_id' => 0, 'amount' => sprintf("%.2f", $aimeiyuePrice), 'fee_flag' => 'Y']); array_push($div_members, ['member_id' => 0, 'amount' => sprintf("%.2f", $aimeiyuePrice), 'fee_flag' => 'Y']);
//确认分佣金额
return $div_members; $confirm_amt = $aimeiyuePrice + $commissionPreData['first_amount'] + $commissionPreData['second_amount'] + $commissionPreData['merchant_amount'];
return ['div_members' => $div_members, 'confirm_amt' => sprintf("%.2f", $confirm_amt)];
} }
public static function addRecord($og_id, $order_id, $goods_amount, $divide_price, $commission, $um_id, $user_id, $sh_type) public static function addRecord($og_id, $order_id, $goods_amount, $divide_price, $commission = '', $um_id = 0, $buyer_id, $sh_type = 0, $isExistAccount)
{ {
$recordObj = new self(); $recordObj = new self();
$recordObj->order_id = $order_id; $recordObj->order_id = $order_id;
$recordObj->user_id = $user_id; //下单userId $recordObj->user_id = $buyer_id;
$recordObj->og_id = $og_id; $recordObj->og_id = trim($og_id, ',');
$recordObj->order_price = $goods_amount; $recordObj->order_price = $goods_amount;
$recordObj->divide_price = $divide_price; $recordObj->divide_price = $divide_price;
$recordObj->proportion = $commission; $recordObj->proportion = trim($commission, ',');
$recordObj->um_id = $um_id; $recordObj->um_id = $um_id;
$recordObj->sh_type = $sh_type; $recordObj->sh_type = $sh_type;
$recordObj->is_div = $isExistAccount ? 1 : 0; //是否分账
$recordObj->save(); $recordObj->save();
Log::add('订单分佣记录', $recordObj->toArray()); Log::add('订单分佣记录', $recordObj->toArray());
} }
public function order()
{
return $this->belongsTo(OrderInfo::class, 'order_id', 'id');
}
public function users()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
} }
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'helpers' => [ 'helpers' => [
'enable' => false, 'enable' => true,
], ],
/* /*
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
* @property Grid\Column|Collection cont_phone * @property Grid\Column|Collection cont_phone
* @property Grid\Column|Collection email * @property Grid\Column|Collection email
* @property Grid\Column|Collection entry_mer_type * @property Grid\Column|Collection entry_mer_type
* @property Grid\Column|Collection social_credit_code
* @property Grid\Column|Collection social_credit_code_begin * @property Grid\Column|Collection social_credit_code_begin
* @property Grid\Column|Collection social_credit_code_expires * @property Grid\Column|Collection social_credit_code_expires
* @property Grid\Column|Collection address * @property Grid\Column|Collection address
...@@ -86,6 +87,8 @@ ...@@ -86,6 +87,8 @@
* @property Grid\Column|Collection legal_cert_id_expires * @property Grid\Column|Collection legal_cert_id_expires
* @property Grid\Column|Collection legal_mp * @property Grid\Column|Collection legal_mp
* @property Grid\Column|Collection attach_file * @property Grid\Column|Collection attach_file
* @property Grid\Column|Collection audit_state
* @property Grid\Column|Collection audit_desc
* @property Grid\Column|Collection member_type * @property Grid\Column|Collection member_type
* @property Grid\Column|Collection mid * @property Grid\Column|Collection mid
* @property Grid\Column|Collection card_id * @property Grid\Column|Collection card_id
...@@ -96,6 +99,8 @@ ...@@ -96,6 +99,8 @@
* @property Grid\Column|Collection bank_code * @property Grid\Column|Collection bank_code
* @property Grid\Column|Collection bank_name * @property Grid\Column|Collection bank_name
* @property Grid\Column|Collection bank_acct_type * @property Grid\Column|Collection bank_acct_type
* @property Grid\Column|Collection account_id
* @property Grid\Column|Collection prov_code
* @property Grid\Column|Collection user_type * @property Grid\Column|Collection user_type
* @property Grid\Column|Collection um_id * @property Grid\Column|Collection um_id
* @property Grid\Column|Collection openid * @property Grid\Column|Collection openid
...@@ -159,6 +164,7 @@ ...@@ -159,6 +164,7 @@
* @property Grid\Column|Collection delivery_type * @property Grid\Column|Collection delivery_type
* @property Grid\Column|Collection is_commission * @property Grid\Column|Collection is_commission
* @property Grid\Column|Collection freeze_stat * @property Grid\Column|Collection freeze_stat
* @property Grid\Column|Collection div_status
* @property Grid\Column|Collection shipping_name * @property Grid\Column|Collection shipping_name
* @property Grid\Column|Collection shipping_goods * @property Grid\Column|Collection shipping_goods
* @property Grid\Column|Collection shipping_code * @property Grid\Column|Collection shipping_code
...@@ -183,6 +189,7 @@ ...@@ -183,6 +189,7 @@
* @property Grid\Column|Collection divide_price * @property Grid\Column|Collection divide_price
* @property Grid\Column|Collection proportion * @property Grid\Column|Collection proportion
* @property Grid\Column|Collection sh_type * @property Grid\Column|Collection sh_type
* @property Grid\Column|Collection is_div
* @property Grid\Column|Collection other_order * @property Grid\Column|Collection other_order
* @property Grid\Column|Collection payment_id * @property Grid\Column|Collection payment_id
* @property Grid\Column|Collection party_order_id * @property Grid\Column|Collection party_order_id
...@@ -270,6 +277,7 @@ ...@@ -270,6 +277,7 @@
* @method Grid\Column|Collection cont_phone(string $label = null) * @method Grid\Column|Collection cont_phone(string $label = null)
* @method Grid\Column|Collection email(string $label = null) * @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection entry_mer_type(string $label = null) * @method Grid\Column|Collection entry_mer_type(string $label = null)
* @method Grid\Column|Collection social_credit_code(string $label = null)
* @method Grid\Column|Collection social_credit_code_begin(string $label = null) * @method Grid\Column|Collection social_credit_code_begin(string $label = null)
* @method Grid\Column|Collection social_credit_code_expires(string $label = null) * @method Grid\Column|Collection social_credit_code_expires(string $label = null)
* @method Grid\Column|Collection address(string $label = null) * @method Grid\Column|Collection address(string $label = null)
...@@ -281,6 +289,8 @@ ...@@ -281,6 +289,8 @@
* @method Grid\Column|Collection legal_cert_id_expires(string $label = null) * @method Grid\Column|Collection legal_cert_id_expires(string $label = null)
* @method Grid\Column|Collection legal_mp(string $label = null) * @method Grid\Column|Collection legal_mp(string $label = null)
* @method Grid\Column|Collection attach_file(string $label = null) * @method Grid\Column|Collection attach_file(string $label = null)
* @method Grid\Column|Collection audit_state(string $label = null)
* @method Grid\Column|Collection audit_desc(string $label = null)
* @method Grid\Column|Collection member_type(string $label = null) * @method Grid\Column|Collection member_type(string $label = null)
* @method Grid\Column|Collection mid(string $label = null) * @method Grid\Column|Collection mid(string $label = null)
* @method Grid\Column|Collection card_id(string $label = null) * @method Grid\Column|Collection card_id(string $label = null)
...@@ -291,6 +301,8 @@ ...@@ -291,6 +301,8 @@
* @method Grid\Column|Collection bank_code(string $label = null) * @method Grid\Column|Collection bank_code(string $label = null)
* @method Grid\Column|Collection bank_name(string $label = null) * @method Grid\Column|Collection bank_name(string $label = null)
* @method Grid\Column|Collection bank_acct_type(string $label = null) * @method Grid\Column|Collection bank_acct_type(string $label = null)
* @method Grid\Column|Collection account_id(string $label = null)
* @method Grid\Column|Collection prov_code(string $label = null)
* @method Grid\Column|Collection user_type(string $label = null) * @method Grid\Column|Collection user_type(string $label = null)
* @method Grid\Column|Collection um_id(string $label = null) * @method Grid\Column|Collection um_id(string $label = null)
* @method Grid\Column|Collection openid(string $label = null) * @method Grid\Column|Collection openid(string $label = null)
...@@ -354,6 +366,7 @@ ...@@ -354,6 +366,7 @@
* @method Grid\Column|Collection delivery_type(string $label = null) * @method Grid\Column|Collection delivery_type(string $label = null)
* @method Grid\Column|Collection is_commission(string $label = null) * @method Grid\Column|Collection is_commission(string $label = null)
* @method Grid\Column|Collection freeze_stat(string $label = null) * @method Grid\Column|Collection freeze_stat(string $label = null)
* @method Grid\Column|Collection div_status(string $label = null)
* @method Grid\Column|Collection shipping_name(string $label = null) * @method Grid\Column|Collection shipping_name(string $label = null)
* @method Grid\Column|Collection shipping_goods(string $label = null) * @method Grid\Column|Collection shipping_goods(string $label = null)
* @method Grid\Column|Collection shipping_code(string $label = null) * @method Grid\Column|Collection shipping_code(string $label = null)
...@@ -378,6 +391,7 @@ ...@@ -378,6 +391,7 @@
* @method Grid\Column|Collection divide_price(string $label = null) * @method Grid\Column|Collection divide_price(string $label = null)
* @method Grid\Column|Collection proportion(string $label = null) * @method Grid\Column|Collection proportion(string $label = null)
* @method Grid\Column|Collection sh_type(string $label = null) * @method Grid\Column|Collection sh_type(string $label = null)
* @method Grid\Column|Collection is_div(string $label = null)
* @method Grid\Column|Collection other_order(string $label = null) * @method Grid\Column|Collection other_order(string $label = null)
* @method Grid\Column|Collection payment_id(string $label = null) * @method Grid\Column|Collection payment_id(string $label = null)
* @method Grid\Column|Collection party_order_id(string $label = null) * @method Grid\Column|Collection party_order_id(string $label = null)
...@@ -470,6 +484,7 @@ class MiniGrid extends Grid {} ...@@ -470,6 +484,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection cont_phone * @property Show\Field|Collection cont_phone
* @property Show\Field|Collection email * @property Show\Field|Collection email
* @property Show\Field|Collection entry_mer_type * @property Show\Field|Collection entry_mer_type
* @property Show\Field|Collection social_credit_code
* @property Show\Field|Collection social_credit_code_begin * @property Show\Field|Collection social_credit_code_begin
* @property Show\Field|Collection social_credit_code_expires * @property Show\Field|Collection social_credit_code_expires
* @property Show\Field|Collection address * @property Show\Field|Collection address
...@@ -481,6 +496,8 @@ class MiniGrid extends Grid {} ...@@ -481,6 +496,8 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection legal_cert_id_expires * @property Show\Field|Collection legal_cert_id_expires
* @property Show\Field|Collection legal_mp * @property Show\Field|Collection legal_mp
* @property Show\Field|Collection attach_file * @property Show\Field|Collection attach_file
* @property Show\Field|Collection audit_state
* @property Show\Field|Collection audit_desc
* @property Show\Field|Collection member_type * @property Show\Field|Collection member_type
* @property Show\Field|Collection mid * @property Show\Field|Collection mid
* @property Show\Field|Collection card_id * @property Show\Field|Collection card_id
...@@ -491,6 +508,8 @@ class MiniGrid extends Grid {} ...@@ -491,6 +508,8 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection bank_code * @property Show\Field|Collection bank_code
* @property Show\Field|Collection bank_name * @property Show\Field|Collection bank_name
* @property Show\Field|Collection bank_acct_type * @property Show\Field|Collection bank_acct_type
* @property Show\Field|Collection account_id
* @property Show\Field|Collection prov_code
* @property Show\Field|Collection user_type * @property Show\Field|Collection user_type
* @property Show\Field|Collection um_id * @property Show\Field|Collection um_id
* @property Show\Field|Collection openid * @property Show\Field|Collection openid
...@@ -554,6 +573,7 @@ class MiniGrid extends Grid {} ...@@ -554,6 +573,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection delivery_type * @property Show\Field|Collection delivery_type
* @property Show\Field|Collection is_commission * @property Show\Field|Collection is_commission
* @property Show\Field|Collection freeze_stat * @property Show\Field|Collection freeze_stat
* @property Show\Field|Collection div_status
* @property Show\Field|Collection shipping_name * @property Show\Field|Collection shipping_name
* @property Show\Field|Collection shipping_goods * @property Show\Field|Collection shipping_goods
* @property Show\Field|Collection shipping_code * @property Show\Field|Collection shipping_code
...@@ -578,6 +598,7 @@ class MiniGrid extends Grid {} ...@@ -578,6 +598,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection divide_price * @property Show\Field|Collection divide_price
* @property Show\Field|Collection proportion * @property Show\Field|Collection proportion
* @property Show\Field|Collection sh_type * @property Show\Field|Collection sh_type
* @property Show\Field|Collection is_div
* @property Show\Field|Collection other_order * @property Show\Field|Collection other_order
* @property Show\Field|Collection payment_id * @property Show\Field|Collection payment_id
* @property Show\Field|Collection party_order_id * @property Show\Field|Collection party_order_id
...@@ -665,6 +686,7 @@ class MiniGrid extends Grid {} ...@@ -665,6 +686,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection cont_phone(string $label = null) * @method Show\Field|Collection cont_phone(string $label = null)
* @method Show\Field|Collection email(string $label = null) * @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection entry_mer_type(string $label = null) * @method Show\Field|Collection entry_mer_type(string $label = null)
* @method Show\Field|Collection social_credit_code(string $label = null)
* @method Show\Field|Collection social_credit_code_begin(string $label = null) * @method Show\Field|Collection social_credit_code_begin(string $label = null)
* @method Show\Field|Collection social_credit_code_expires(string $label = null) * @method Show\Field|Collection social_credit_code_expires(string $label = null)
* @method Show\Field|Collection address(string $label = null) * @method Show\Field|Collection address(string $label = null)
...@@ -676,6 +698,8 @@ class MiniGrid extends Grid {} ...@@ -676,6 +698,8 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection legal_cert_id_expires(string $label = null) * @method Show\Field|Collection legal_cert_id_expires(string $label = null)
* @method Show\Field|Collection legal_mp(string $label = null) * @method Show\Field|Collection legal_mp(string $label = null)
* @method Show\Field|Collection attach_file(string $label = null) * @method Show\Field|Collection attach_file(string $label = null)
* @method Show\Field|Collection audit_state(string $label = null)
* @method Show\Field|Collection audit_desc(string $label = null)
* @method Show\Field|Collection member_type(string $label = null) * @method Show\Field|Collection member_type(string $label = null)
* @method Show\Field|Collection mid(string $label = null) * @method Show\Field|Collection mid(string $label = null)
* @method Show\Field|Collection card_id(string $label = null) * @method Show\Field|Collection card_id(string $label = null)
...@@ -686,6 +710,8 @@ class MiniGrid extends Grid {} ...@@ -686,6 +710,8 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection bank_code(string $label = null) * @method Show\Field|Collection bank_code(string $label = null)
* @method Show\Field|Collection bank_name(string $label = null) * @method Show\Field|Collection bank_name(string $label = null)
* @method Show\Field|Collection bank_acct_type(string $label = null) * @method Show\Field|Collection bank_acct_type(string $label = null)
* @method Show\Field|Collection account_id(string $label = null)
* @method Show\Field|Collection prov_code(string $label = null)
* @method Show\Field|Collection user_type(string $label = null) * @method Show\Field|Collection user_type(string $label = null)
* @method Show\Field|Collection um_id(string $label = null) * @method Show\Field|Collection um_id(string $label = null)
* @method Show\Field|Collection openid(string $label = null) * @method Show\Field|Collection openid(string $label = null)
...@@ -749,6 +775,7 @@ class MiniGrid extends Grid {} ...@@ -749,6 +775,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection delivery_type(string $label = null) * @method Show\Field|Collection delivery_type(string $label = null)
* @method Show\Field|Collection is_commission(string $label = null) * @method Show\Field|Collection is_commission(string $label = null)
* @method Show\Field|Collection freeze_stat(string $label = null) * @method Show\Field|Collection freeze_stat(string $label = null)
* @method Show\Field|Collection div_status(string $label = null)
* @method Show\Field|Collection shipping_name(string $label = null) * @method Show\Field|Collection shipping_name(string $label = null)
* @method Show\Field|Collection shipping_goods(string $label = null) * @method Show\Field|Collection shipping_goods(string $label = null)
* @method Show\Field|Collection shipping_code(string $label = null) * @method Show\Field|Collection shipping_code(string $label = null)
...@@ -773,6 +800,7 @@ class MiniGrid extends Grid {} ...@@ -773,6 +800,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection divide_price(string $label = null) * @method Show\Field|Collection divide_price(string $label = null)
* @method Show\Field|Collection proportion(string $label = null) * @method Show\Field|Collection proportion(string $label = null)
* @method Show\Field|Collection sh_type(string $label = null) * @method Show\Field|Collection sh_type(string $label = null)
* @method Show\Field|Collection is_div(string $label = null)
* @method Show\Field|Collection other_order(string $label = null) * @method Show\Field|Collection other_order(string $label = null)
* @method Show\Field|Collection payment_id(string $label = null) * @method Show\Field|Collection payment_id(string $label = null)
* @method Show\Field|Collection party_order_id(string $label = null) * @method Show\Field|Collection party_order_id(string $label = null)
......
<?php <?php
return [ return [
'labels' => [ 'labels' => [
'OrderDivideRecord' => '余额明细', 'OrderDivideRecord' => '分佣记录',
'OrderDivideRecord' => '余额明细', 'OrderDivideRecord' => '分佣记录',
], ],
'fields' => [ 'fields' => [
'user_id' => '用户ID', 'user_id' => '用户ID',
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
Route::post('update-pwd', 'UserController@updatePwd'); //修改密码 Route::post('update-pwd', 'UserController@updatePwd'); //修改密码
Route::get('carousel', 'CarouselController@getList'); //轮播列表 Route::get('carousel', 'CarouselController@getList'); //轮播列表
Route::get('test-order-div', 'CarouselController@orderDiv'); //测试订单分佣
Route::get('comment-tpl', 'CommentTplController@getList'); //评价模板 Route::get('comment-tpl', 'CommentTplController@getList'); //评价模板
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment