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
bf5e87de
Commit
bf5e87de
authored
Jan 13, 2025
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
ce4a8696
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
30 deletions
+38
-30
app/Http/Controllers/Api/GoodController.php
+6
-6
app/Http/Controllers/Api/OrderController.php
+7
-2
app/Models/Adapay.php
+5
-3
app/Models/OrderDivideRecord.php
+20
-19
No files found.
app/Http/Controllers/Api/GoodController.php
View file @
bf5e87de
...
@@ -190,9 +190,9 @@ public function getIndexGoods(Request $request)
...
@@ -190,9 +190,9 @@ public function getIndexGoods(Request $request)
'id'
=>
$datum
->
id
,
'id'
=>
$datum
->
id
,
'goods_name'
=>
$datum
->
goods_name
,
'goods_name'
=>
$datum
->
goods_name
,
'is_hot'
=>
$datum
->
is_hot
,
'is_hot'
=>
$datum
->
is_hot
,
'dg_price'
=>
floor
(
$dg_price
),
'dg_price'
=>
sprintf
(
'%.1f'
,
$dg_price
),
'market_price'
=>
floor
(
$market_price
),
'market_price'
=>
sprintf
(
'%.1f'
,
$market_price
),
'goods_price'
=>
$mer_id
?
floor
(
$dg_price
)
:
floor
(
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.1f'
,
$dg_price
)
:
sprintf
(
'%.1f'
,
$market_price
),
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'cover_img'
=>
togetherFilePath
(
$datum
->
cover_img
),
'cover_img'
=>
togetherFilePath
(
$datum
->
cover_img
),
];
];
...
@@ -263,9 +263,9 @@ public function getDetail(Request $request)
...
@@ -263,9 +263,9 @@ public function getDetail(Request $request)
$data
=
[
$data
=
[
'id'
=>
$goods
->
id
,
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'goods_img'
=>
$cover
,
'dg_price'
=>
floor
(
$dg_price
),
'dg_price'
=>
sprintf
(
'%.2f'
,
$dg_price
),
'goods_price'
=>
$mer_id
?
floor
(
$dg_price
)
:
floor
(
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.2f'
,
$dg_price
)
:
sprintf
(
'%.2f'
,
$market_price
),
'market_price'
=>
floor
(
$market_price
),
'market_price'
=>
sprintf
(
'%.2f'
,
$market_price
),
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
'goods_name'
=>
$goods
->
goods_name
,
'sale'
=>
$goods
->
sale
??
0
,
'sale'
=>
$goods
->
sale
??
0
,
...
...
app/Http/Controllers/Api/OrderController.php
View file @
bf5e87de
...
@@ -298,7 +298,12 @@ public function pay(Request $request)
...
@@ -298,7 +298,12 @@ public function pay(Request $request)
try
{
try
{
$res
=
''
;
$res
=
''
;
$order
=
OrderInfoModel
::
find
(
$order_id
);
$order
=
OrderInfoModel
::
find
(
$order_id
);
if
(
$order
->
pay_cs
>
0
)
{
$order_record
=
$order
->
order_record
??
$order
->
order_sn
;
$order
->
order_sn
=
$this
->
getOrderSn
();
$order
->
order_record
=
$order_record
.
"|"
.
$order
->
order_sn
;
$order
->
save
();
}
$orderGoodsObj
=
OrderGoods
::
where
(
"order_id"
,
$order_id
)
->
first
();
$orderGoodsObj
=
OrderGoods
::
where
(
"order_id"
,
$order_id
)
->
first
();
$order_title
=
$orderGoodsObj
?
$orderGoodsObj
->
goods_name
:
''
;
$order_title
=
$orderGoodsObj
?
$orderGoodsObj
->
goods_name
:
''
;
$res
=
(
new
Adapay
())
->
pay
(
$order_title
,
$order
->
order_sn
,
$order
->
order_amount
,
$openid
);
$res
=
(
new
Adapay
())
->
pay
(
$order_title
,
$order
->
order_sn
,
$order
->
order_amount
,
$openid
);
...
@@ -309,7 +314,7 @@ public function pay(Request $request)
...
@@ -309,7 +314,7 @@ public function pay(Request $request)
return
$this
->
JsonResponse
(
$res
);
return
$this
->
JsonResponse
(
$res
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
Log
::
add
(
'拉起微信支付失败'
,
$exception
->
getMessage
());
Log
::
add
(
'拉起微信支付失败'
,
$exception
->
getMessage
());
return
$this
->
JsonResponse
(
''
,
'拉起微信支付失败'
,
201
);
return
$this
->
JsonResponse
(
''
,
$exception
->
getMessage
(),
500
);
}
}
}
}
...
...
app/Models/Adapay.php
View file @
bf5e87de
...
@@ -34,7 +34,7 @@ public function pay($order_title, $order_sn, $order_amount, $openid)
...
@@ -34,7 +34,7 @@ public function pay($order_title, $order_sn, $order_amount, $openid)
"pay_channel"
=>
"wx_lite"
,
"pay_channel"
=>
"wx_lite"
,
"pay_mode"
=>
"delay"
,
"pay_mode"
=>
"delay"
,
"time_expire"
=>
date
(
'YmdHis'
,
time
()
+
300
),
"time_expire"
=>
date
(
'YmdHis'
,
time
()
+
300
),
"pay_amt"
=>
"0.01"
,
"pay_amt"
=>
$order_amount
,
"goods_title"
=>
$order_title
,
"goods_title"
=>
$order_title
,
"goods_desc"
=>
$order_title
,
"goods_desc"
=>
$order_title
,
"description"
=>
""
,
"description"
=>
""
,
...
@@ -156,6 +156,8 @@ public function payNotify($params = [])
...
@@ -156,6 +156,8 @@ public function payNotify($params = [])
if
(
$freeze_stat
!=
'UNFREEZE'
)
{
if
(
$freeze_stat
!=
'UNFREEZE'
)
{
return
false
;
return
false
;
}
}
$orderObj
->
freeze_stat
=
'UNFREEZE'
;
$orderObj
->
save
();
//交易记录
//交易记录
$prObj
=
PaymentRecord
::
where
(
'order_sn'
,
$order_no
)
->
first
();
$prObj
=
PaymentRecord
::
where
(
'order_sn'
,
$order_no
)
->
first
();
# 支付确认参数设置
# 支付确认参数设置
...
@@ -184,8 +186,8 @@ public function payNotify($params = [])
...
@@ -184,8 +186,8 @@ 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'
)
{
$orderObj
->
freeze_stat
=
'UNFREEZE'
;
DB
::
table
(
'li_order_info'
)
->
where
(
'order_sn'
,
$order_no
)
->
update
([
'div_status'
=>
1
])
;
$orderObj
->
save
(
);
Log
::
add
(
'分账成功'
,
[
'order_sn'
=>
$order_no
]
);
}
}
}
}
...
...
app/Models/OrderDivideRecord.php
View file @
bf5e87de
...
@@ -51,14 +51,14 @@ public static function divide($order_id)
...
@@ -51,14 +51,14 @@ public static function divide($order_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
);
//收益直接到直推账户
$spObj
=
User
::
find
(
$spuid
);
$spObj
=
User
::
find
(
$spuid
);
$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
);
//汇付参数
//汇付参数
if
(
$spObj
->
member_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
);
$commissionPreData
[
'first_member_id'
]
=
$spObj
->
member_id
;
$commissionPreData
[
'first_member_id'
]
=
$spObj
->
member_id
;
$commissionPreData
[
'first_amount'
]
+=
$divide_price
;
$commissionPreData
[
'first_amount'
]
+=
$divide_price
;
}
}
...
@@ -66,14 +66,14 @@ public static function divide($order_id)
...
@@ -66,14 +66,14 @@ public static function divide($order_id)
//间推佣金
//间推佣金
if
(
$second_spuid
&&
$second_commission
>=
1
&&
$second_commission
<
100
)
{
if
(
$second_spuid
&&
$second_commission
>=
1
&&
$second_commission
<
100
)
{
$divide_price
=
number_format
(
$goods_amount
*
(
$second_commission
/
100
),
2
);
$divide_price
=
number_format
(
$goods_amount
*
(
$second_commission
/
100
),
2
);
//收益直接到直推账户
$spObj
=
User
::
find
(
$second_spuid
);
$spObj
=
User
::
find
(
$second_spuid
);
$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
);
//汇付参数
//汇付参数
if
(
$spObj
->
member_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_member_id'
]
=
$spObj
->
member_id
;
$commissionPreData
[
'second_amount'
]
+=
$divide_price
;
$commissionPreData
[
'second_amount'
]
+=
$divide_price
;
}
}
...
@@ -83,14 +83,15 @@ public static function divide($order_id)
...
@@ -83,14 +83,15 @@ public static function divide($order_id)
$divide_price
=
number_format
(
$goods_amount
*
(
$merchant_commission
/
100
),
2
);
$divide_price
=
number_format
(
$goods_amount
*
(
$merchant_commission
/
100
),
2
);
//收益直接到商户账户
//收益直接到商户账户
$merObj
=
Merchant
::
find
(
$merchant_id
);
$merObj
=
Merchant
::
find
(
$merchant_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
);
//汇付参数
//汇付参数
$member_id
=
HfCompanyMember
::
where
(
'merchant_id'
,
$merchant_id
)
->
value
(
'member_id'
);
$member_id
=
HfCompanyMember
::
where
(
'merchant_id'
,
$merchant_id
)
->
value
(
'member_id'
);
if
(
$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_member_id'
]
=
$member_id
;
$commissionPreData
[
'merchant_amount'
]
+=
$divide_price
;
$commissionPreData
[
'merchant_amount'
]
+=
$divide_price
;
}
}
...
@@ -98,17 +99,17 @@ public static function divide($order_id)
...
@@ -98,17 +99,17 @@ public static function divide($order_id)
}
}
//组合分账参数
//组合分账参数
if
(
$commissionPreData
[
'first_member_id'
])
{
if
(
$commissionPreData
[
'first_member_id'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'first_member_id'
],
'amount'
=>
$commissionPreData
[
'first_amount'
]
,
'fee_flag'
=>
'Y'
]);
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
(
$commissionPreData
[
'second_member_id'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'second_member_id'
],
'amount'
=>
$commissionPreData
[
'second_amount'
]
,
'fee_flag'
=>
'Y'
]);
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
(
$commissionPreData
[
'merchant_member_id'
])
{
array_push
(
$div_members
,
[
'member_id'
=>
$commissionPreData
[
'merchant_member_id'
],
'amount'
=>
$commissionPreData
[
'merchant_amount'
]
,
'fee_flag'
=>
'Y'
]);
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'
];
array_push
(
$div_members
,
[
'member_id'
=>
0
,
'amount'
=>
$aimeiyuePrice
,
'fee_flag'
=>
'Y'
]);
array_push
(
$div_members
,
[
'member_id'
=>
0
,
'amount'
=>
sprintf
(
"%.2f"
,
$aimeiyuePrice
)
,
'fee_flag'
=>
'Y'
]);
return
$div_members
;
return
$div_members
;
}
}
...
...
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