Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
5d0b0dd8
Commit
5d0b0dd8
authored
5 months ago
by
jack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
4e61fb66
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
355 additions
and
58 deletions
+355
-58
app/Admin/Controllers/OrderDivideRecordController.php
+113
-0
app/Admin/Repositories/OrderDivideRecord.php
+16
-0
app/Admin/routes.php
+2
-0
app/Http/Controllers/Api/CarouselController.php
+11
-0
app/Http/Controllers/Api/HfOrderController.php
+3
-2
app/Http/Controllers/Api/HfSettleAccountController.php
+3
-0
app/Http/Controllers/Api/OrderController.php
+11
-0
app/Http/Controllers/Api/SystemController.php
+0
-26
app/Jobs/AutoCompleteOrder.php
+1
-2
app/Jobs/AutoOrderDivide.php
+97
-0
app/Models/Adapay.php
+4
-2
app/Models/OrderDivideRecord.php
+62
-23
config/admin.php
+1
-1
dcat_admin_ide_helper.php
+28
-0
lang/zh_CN/order-divide-record.php
+2
-2
routes/api.php
+1
-0
No files found.
app/Admin/Controllers/OrderDivideRecordController.php
0 → 100644
View file @
5d0b0dd8
<?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'
);
});
}
}
This diff is collapsed.
Click to expand it.
app/Admin/Repositories/OrderDivideRecord.php
0 → 100644
View file @
5d0b0dd8
<?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
;
}
This diff is collapsed.
Click to expand it.
app/Admin/routes.php
View file @
5d0b0dd8
...
...
@@ -54,6 +54,8 @@
$router
->
resource
(
'orderInfo'
,
'OrderInfoController'
);
//订单管理
$router
->
resource
(
'order-divide-record'
,
'OrderDivideRecordController'
);
//订单分佣记录
$router
->
resource
(
'user'
,
'UserController'
);
//用户管理
$router
->
resource
(
'user-share'
,
'ShareController'
);
//查看下级
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/CarouselController.php
View file @
5d0b0dd8
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers\Api
;
use
App\Models\OrderDivideRecord
;
use
App\Command\Log
;
use
App\Handlers\QqCos
;
use
App\Handlers\FileUploadHandler
;
...
...
@@ -26,4 +27,14 @@ public function getList()
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
);
}
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/HfOrderController.php
View file @
5d0b0dd8
...
...
@@ -54,8 +54,9 @@ public function paymentConfirm(Request $request)
"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
);
DB
::
beginTransaction
();
try
{
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/HfSettleAccountController.php
View file @
5d0b0dd8
...
...
@@ -7,6 +7,7 @@
use
App\Models\Adapay
;
use
App\Models\HfCompanyMember
;
use
App\Models\HfSettleAccount
;
use
App\Jobs\AutoOrderDivide
;
use
Exception
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -60,6 +61,8 @@ public function createMemberAccount(Request $request)
$local_params
[
'account_id'
]
=
$result
[
'id'
];
$local_params
[
'created_at'
]
=
date
(
"Y-m-d H:i:s"
,
$result
[
'create_time'
]);
DB
::
table
(
'hf_settle_account'
)
->
insert
(
$local_params
);
//发起分账
$this
->
dispatch
(
new
AutoOrderDivide
(
$user_id
,
10
));
}
else
{
throw
new
Exception
(
$result
[
'error_msg'
]);
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/OrderController.php
View file @
5d0b0dd8
...
...
@@ -500,6 +500,11 @@ public function scanCodeVerifi(Request $request)
if
(
!
$orderObj
)
{
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
]);
if
(
!
$orderObj
->
verification_at
)
{
...
...
@@ -568,12 +573,18 @@ public function scanCodeVerifi(Request $request)
//扫码核销展示详情
public
function
scanCodeDetail
(
Request
$request
)
{
$useObj
=
$request
->
user
();
$code
=
$request
->
code
??
''
;
$orderObj
=
OrderInfoModel
::
where
(
'verification_code'
,
$code
)
->
first
();
if
(
!
$orderObj
)
{
Log
::
add
(
'核销码'
,
$code
);
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_goods
=
$this
->
getOrderGoods
(
$order_id
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/SystemController.php
View file @
5d0b0dd8
...
...
@@ -54,30 +54,4 @@ public function autoChangeReceiveStatus()
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--'
;
}
}
This diff is collapsed.
Click to expand it.
app/Jobs/AutoCompleteOrder.php
View file @
5d0b0dd8
...
...
@@ -47,8 +47,7 @@ public function handle()
$this
->
order
->
order_status
=
4
;
//已完成
$this
->
order
->
save
();
//佣金分配
OrderDivideRecord
::
divide
(
$this
->
order
->
id
);
DB
::
commit
();
Log
::
add
(
'订单自动完成'
,
$this
->
order
->
toArray
());
...
...
This diff is collapsed.
Click to expand it.
app/Jobs/AutoOrderDivide.php
0 → 100644
View file @
5d0b0dd8
<?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
);
}
}
}
This diff is collapsed.
Click to expand it.
app/Models/Adapay.php
View file @
5d0b0dd8
...
...
@@ -173,7 +173,9 @@ public function payNotify($params = [])
DB
::
beginTransaction
();
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
);
# 发起支付确认创建
...
...
@@ -189,7 +191,7 @@ public function payNotify($params = [])
Log
::
add
(
'支付确认成功'
,
$payment_confirm
->
result
);
$result
=
$payment_confirm
->
result
;
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
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
app/Models/OrderDivideRecord.php
View file @
5d0b0dd8
...
...
@@ -26,11 +26,13 @@ public static function divide($order_id)
$div_members
=
[];
//汇付 分账对象
$orderObj
=
OrderInfo
::
find
(
$order_id
);
$merchant_id
=
$orderObj
->
merchant_id
;
//绑定的商户
$
us
er_id
=
$orderObj
->
user_id
;
//下单用户ID
$userObj
=
User
::
find
(
$
us
er_id
);
$
buy
er_id
=
$orderObj
->
user_id
;
//下单用户ID
$userObj
=
User
::
find
(
$
buy
er_id
);
$spuid
=
$userObj
->
spuid
;
//直推分享人
$second_spuid
=
$userObj
->
second_spuid
;
//间推分享人
$total_amount
=
0
;
//订单商品总价
$first_proportion
=
$second_proportion
=
$merchant_proportion
=
''
;
//佣金比例
$sp_ogid
=
''
;
//参与分佣商品ID
$commissionPreData
=
[
'first_member_id'
=>
''
,
'first_amount'
=>
0
,
...
...
@@ -39,6 +41,23 @@ public static function divide($order_id)
'merchant_member_id'
=>
''
,
'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
();
//订单商品
foreach
(
$ogList
as
$kk
=>
$item
)
{
$goods_amount
=
$item
->
goods_price
*
$item
->
goods_number
;
...
...
@@ -48,6 +67,10 @@ public static function divide($order_id)
$merchant_commission
=
$goodObj
->
merchant_commission
;
$first_commission
=
$goodObj
->
first_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
)
{
$divide_price
=
number_format
(
$goods_amount
*
(
$first_commission
/
100
),
2
);
...
...
@@ -55,9 +78,8 @@ public static function divide($order_id)
//汇付参数
if
(
$spObj
->
member_id
)
{
$spObj
->
total_revenue
+=
$divide_price
;
//总余额记录
//$spObj->balance += $divide_price; //自动分账打款 字段未使用
$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_amount'
]
+=
$divide_price
;
...
...
@@ -70,9 +92,7 @@ public static function divide($order_id)
//汇付参数
if
(
$spObj
->
member_id
)
{
$spObj
->
total_revenue
+=
$divide_price
;
//$spObj->balance += $divide_price;
$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_amount'
]
+=
$divide_price
;
...
...
@@ -84,48 +104,67 @@ public static function divide($order_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
)
{
$merObj
->
total_revenue
+=
$divide_price
;
//$merObj->balance += $divide_price;
$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_amount'
]
+=
$divide_price
;
}
}
}
//组合分账参数
if
(
$commissionPreData
[
'first_member_id'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'first_member_id'
],
'amount'
=>
sprintf
(
"%.2f"
,
$commissionPreData
[
'first_amount'
]),
'fee_flag'
=>
'Y'
]);
if
(
$spuid
&&
$first_commission
>=
1
&&
$first_commission
<
100
&&
$commissionPreData
[
'first_amount'
]
>
0
)
{
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'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'second_member_id'
],
'amount'
=>
sprintf
(
"%.2f"
,
$commissionPreData
[
'second_amount'
]),
'fee_flag'
=>
'Y'
]);
if
(
$second_spuid
&&
$second_commission
>=
1
&&
$second_commission
<
100
&&
$commissionPreData
[
'second_amount'
]
>
0
)
{
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'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'merchant_member_id'
],
'amount'
=>
sprintf
(
"%.2f"
,
$commissionPreData
[
'merchant_amount'
]),
'fee_flag'
=>
'Y'
]);
if
(
$merchant_id
&&
$merchant_commission
>=
1
&&
$merchant_commission
<
100
&&
$commissionPreData
[
'merchant_amount'
]
>
0
)
{
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'
];
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'
]);
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
->
order_id
=
$order_id
;
$recordObj
->
user_id
=
$
user_id
;
//下单userId
$recordObj
->
og_id
=
$og_id
;
$recordObj
->
user_id
=
$
buyer_id
;
$recordObj
->
og_id
=
trim
(
$og_id
,
','
)
;
$recordObj
->
order_price
=
$goods_amount
;
$recordObj
->
divide_price
=
$divide_price
;
$recordObj
->
proportion
=
$commission
;
$recordObj
->
proportion
=
trim
(
$commission
,
','
)
;
$recordObj
->
um_id
=
$um_id
;
$recordObj
->
sh_type
=
$sh_type
;
$recordObj
->
is_div
=
$isExistAccount
?
1
:
0
;
//是否分账
$recordObj
->
save
();
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'
);
}
}
This diff is collapsed.
Click to expand it.
config/admin.php
View file @
5d0b0dd8
...
...
@@ -200,7 +200,7 @@
|--------------------------------------------------------------------------
*/
'helpers'
=>
[
'enable'
=>
fals
e
,
'enable'
=>
tru
e
,
],
/*
...
...
This diff is collapsed.
Click to expand it.
dcat_admin_ide_helper.php
View file @
5d0b0dd8
...
...
@@ -75,6 +75,7 @@
* @property Grid\Column|Collection cont_phone
* @property Grid\Column|Collection email
* @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_expires
* @property Grid\Column|Collection address
...
...
@@ -86,6 +87,8 @@
* @property Grid\Column|Collection legal_cert_id_expires
* @property Grid\Column|Collection legal_mp
* @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 mid
* @property Grid\Column|Collection card_id
...
...
@@ -96,6 +99,8 @@
* @property Grid\Column|Collection bank_code
* @property Grid\Column|Collection bank_name
* @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 um_id
* @property Grid\Column|Collection openid
...
...
@@ -159,6 +164,7 @@
* @property Grid\Column|Collection delivery_type
* @property Grid\Column|Collection is_commission
* @property Grid\Column|Collection freeze_stat
* @property Grid\Column|Collection div_status
* @property Grid\Column|Collection shipping_name
* @property Grid\Column|Collection shipping_goods
* @property Grid\Column|Collection shipping_code
...
...
@@ -183,6 +189,7 @@
* @property Grid\Column|Collection divide_price
* @property Grid\Column|Collection proportion
* @property Grid\Column|Collection sh_type
* @property Grid\Column|Collection is_div
* @property Grid\Column|Collection other_order
* @property Grid\Column|Collection payment_id
* @property Grid\Column|Collection party_order_id
...
...
@@ -270,6 +277,7 @@
* @method Grid\Column|Collection cont_phone(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 social_credit_code(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 address(string $label = null)
...
...
@@ -281,6 +289,8 @@
* @method Grid\Column|Collection legal_cert_id_expires(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 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 mid(string $label = null)
* @method Grid\Column|Collection card_id(string $label = null)
...
...
@@ -291,6 +301,8 @@
* @method Grid\Column|Collection bank_code(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 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 um_id(string $label = null)
* @method Grid\Column|Collection openid(string $label = null)
...
...
@@ -354,6 +366,7 @@
* @method Grid\Column|Collection delivery_type(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 div_status(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_code(string $label = null)
...
...
@@ -378,6 +391,7 @@
* @method Grid\Column|Collection divide_price(string $label = null)
* @method Grid\Column|Collection proportion(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 payment_id(string $label = null)
* @method Grid\Column|Collection party_order_id(string $label = null)
...
...
@@ -470,6 +484,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection cont_phone
* @property Show\Field|Collection email
* @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_expires
* @property Show\Field|Collection address
...
...
@@ -481,6 +496,8 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection legal_cert_id_expires
* @property Show\Field|Collection legal_mp
* @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 mid
* @property Show\Field|Collection card_id
...
...
@@ -491,6 +508,8 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection bank_code
* @property Show\Field|Collection bank_name
* @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 um_id
* @property Show\Field|Collection openid
...
...
@@ -554,6 +573,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection delivery_type
* @property Show\Field|Collection is_commission
* @property Show\Field|Collection freeze_stat
* @property Show\Field|Collection div_status
* @property Show\Field|Collection shipping_name
* @property Show\Field|Collection shipping_goods
* @property Show\Field|Collection shipping_code
...
...
@@ -578,6 +598,7 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection divide_price
* @property Show\Field|Collection proportion
* @property Show\Field|Collection sh_type
* @property Show\Field|Collection is_div
* @property Show\Field|Collection other_order
* @property Show\Field|Collection payment_id
* @property Show\Field|Collection party_order_id
...
...
@@ -665,6 +686,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection cont_phone(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 social_credit_code(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 address(string $label = null)
...
...
@@ -676,6 +698,8 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection legal_cert_id_expires(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 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 mid(string $label = null)
* @method Show\Field|Collection card_id(string $label = null)
...
...
@@ -686,6 +710,8 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection bank_code(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 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 um_id(string $label = null)
* @method Show\Field|Collection openid(string $label = null)
...
...
@@ -749,6 +775,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection delivery_type(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 div_status(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_code(string $label = null)
...
...
@@ -773,6 +800,7 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection divide_price(string $label = null)
* @method Show\Field|Collection proportion(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 payment_id(string $label = null)
* @method Show\Field|Collection party_order_id(string $label = null)
...
...
This diff is collapsed.
Click to expand it.
lang/zh_CN/order-divide-record.php
View file @
5d0b0dd8
<?php
return
[
'labels'
=>
[
'OrderDivideRecord'
=>
'
余额明细
'
,
'OrderDivideRecord'
=>
'
余额明细
'
,
'OrderDivideRecord'
=>
'
分佣记录
'
,
'OrderDivideRecord'
=>
'
分佣记录
'
,
],
'fields'
=>
[
'user_id'
=>
'用户ID'
,
...
...
This diff is collapsed.
Click to expand it.
routes/api.php
View file @
5d0b0dd8
...
...
@@ -50,6 +50,7 @@
Route
::
post
(
'update-pwd'
,
'UserController@updatePwd'
);
//修改密码
Route
::
get
(
'carousel'
,
'CarouselController@getList'
);
//轮播列表
Route
::
get
(
'test-order-div'
,
'CarouselController@orderDiv'
);
//测试订单分佣
Route
::
get
(
'comment-tpl'
,
'CommentTplController@getList'
);
//评价模板
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment