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
f04a3114
Commit
f04a3114
authored
Oct 24, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
037df136
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
50 deletions
+33
-50
app/Admin/Forms/CheckIncome.php
+16
-4
app/Admin/Renderable/RenderGoodSku.php
+1
-0
app/Http/Controllers/Api/IncomeController.php
+9
-1
app/Http/Controllers/Api/OrderController.php
+4
-4
app/Models/Pay.php
+1
-1
app/Store/Controllers/MerchatGoodsStoreController.php
+0
-2
app/Store/Controllers/OrderDivideRecordController.php
+0
-1
app/Store/Controllers/OrderInfoController.php
+2
-35
app/Store/Controllers/StoreIncomeController.php
+0
-2
No files found.
app/Admin/Forms/CheckIncome.php
View file @
f04a3114
...
@@ -49,16 +49,16 @@ public function handle(array $input)
...
@@ -49,16 +49,16 @@ public function handle(array $input)
//更新余额
//更新余额
if
(
$income
->
user_type
==
1
)
{
//用户
if
(
$income
->
user_type
==
1
)
{
//用户
$uObj
=
User
::
find
(
$income
->
um_id
);
$uObj
=
User
::
find
(
$income
->
um_id
);
if
(
$uObj
->
balance
>=
$income
->
amount
)
{
if
(
$uObj
->
freeze_
balance
>=
$income
->
amount
)
{
$uObj
->
balance
-=
$income
->
amount
;
$uObj
->
freeze_
balance
-=
$income
->
amount
;
$uObj
->
save
();
$uObj
->
save
();
}
else
{
}
else
{
throw
new
Exception
(
'用户余额不足!'
);
throw
new
Exception
(
'用户余额不足!'
);
}
}
}
elseif
(
$income
->
user_type
==
2
)
{
//商户
}
elseif
(
$income
->
user_type
==
2
)
{
//商户
$mObj
=
Merchant
::
find
(
$income
->
um_id
);
$mObj
=
Merchant
::
find
(
$income
->
um_id
);
if
(
$mObj
->
balance
>=
$income
->
amount
)
{
if
(
$mObj
->
freeze_
balance
>=
$income
->
amount
)
{
$mObj
->
balance
-=
$income
->
amount
;
$mObj
->
freeze_
balance
-=
$income
->
amount
;
$mObj
->
save
();
$mObj
->
save
();
}
else
{
}
else
{
throw
new
Exception
(
'商户余额不足!'
);
throw
new
Exception
(
'商户余额不足!'
);
...
@@ -67,6 +67,18 @@ public function handle(array $input)
...
@@ -67,6 +67,18 @@ public function handle(array $input)
}
}
}
elseif
(
$status
==
2
)
{
}
elseif
(
$status
==
2
)
{
$income
->
status
=
2
;
$income
->
status
=
2
;
//退回余额
if
(
$income
->
user_type
==
1
)
{
//用户
$uObj
=
User
::
find
(
$income
->
um_id
);
$uObj
->
balance
+=
$income
->
amount
;
$uObj
->
freeze_balance
-=
$income
->
amount
;
$uObj
->
save
();
}
elseif
(
$income
->
user_type
==
2
)
{
//商户
$mObj
=
Merchant
::
find
(
$income
->
um_id
);
$mObj
->
freeze
+=
$income
->
amount
;
$mObj
->
freeze_balance
-=
$income
->
amount
;
$mObj
->
save
();
}
}
}
$income
->
save
();
$income
->
save
();
...
...
app/Admin/Renderable/RenderGoodSku.php
View file @
f04a3114
...
@@ -22,6 +22,7 @@ public function grid(): Grid
...
@@ -22,6 +22,7 @@ public function grid(): Grid
//规格 购买数量 折扣价 采购价 京东价 零售价 库存
//规格 购买数量 折扣价 采购价 京东价 零售价 库存
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
model
()
->
where
(
'goods_id'
,
$gid
);
$grid
->
model
()
->
where
(
'goods_id'
,
$gid
);
$grid
->
column
(
'pic'
,
'商品图片'
)
->
image
(
''
,
100
,
100
);
$grid
->
column
(
'attr_val'
,
'规格'
);
$grid
->
column
(
'attr_val'
,
'规格'
);
$grid
->
column
(
'cg_price'
,
'代购价'
);
$grid
->
column
(
'cg_price'
,
'代购价'
);
$grid
->
column
(
'market_price'
,
'零售价'
);
$grid
->
column
(
'market_price'
,
'零售价'
);
...
...
app/Http/Controllers/Api/IncomeController.php
View file @
f04a3114
...
@@ -80,8 +80,16 @@ public function add(Request $request)
...
@@ -80,8 +80,16 @@ public function add(Request $request)
}
}
DB
::
beginTransaction
();
DB
::
beginTransaction
();
try
{
try
{
$comObj
=
new
Income
();
if
(
$role_id
==
1
)
{
//商家
$memObj
=
Merchant
::
find
(
$um_id
);
}
else
{
//用户
$memObj
=
User
::
find
(
$um_id
);
}
$memObj
->
balance
-=
$money
;
$memObj
->
freeze_balance
+=
$money
;
$memObj
->
save
();
$comObj
=
new
Income
();
$comObj
->
user_type
=
$type
;
$comObj
->
user_type
=
$type
;
$comObj
->
um_id
=
$um_id
;
$comObj
->
um_id
=
$um_id
;
$comObj
->
openid
=
$useObj
->
openid
;
$comObj
->
openid
=
$useObj
->
openid
;
...
...
app/Http/Controllers/Api/OrderController.php
View file @
f04a3114
...
@@ -290,10 +290,10 @@ public function pay(Request $request)
...
@@ -290,10 +290,10 @@ public function pay(Request $request)
$res
=
''
;
$res
=
''
;
$order
=
OrderInfoModel
::
find
(
$order_id
);
$order
=
OrderInfoModel
::
find
(
$order_id
);
if
(
$order
->
pay_cs
>
0
)
{
if
(
$order
->
pay_cs
>
0
)
{
$order_record
=
$order
->
order_record
??
$order
->
order_sn
;
//
$order_record = $order->order_record ?? $order->order_sn;
$order
->
order_sn
=
$this
->
getOrderSn
();
//
$order->order_sn = $this->getOrderSn();
$order
->
order_record
=
$order_record
.
"|"
.
$order
->
order_sn
;
//
$order->order_record = $order_record . "|" . $order->order_sn;
$order
->
save
();
//
$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
:
''
;
...
...
app/Models/Pay.php
View file @
f04a3114
...
@@ -60,11 +60,11 @@ public static function payNotify($fields = [])
...
@@ -60,11 +60,11 @@ public static function payNotify($fields = [])
{
{
$app
=
Factory
::
payment
(
self
::
getConfig
());
$app
=
Factory
::
payment
(
self
::
getConfig
());
$response
=
$app
->
handlePaidNotify
(
function
(
$message
,
$fail
)
{
$response
=
$app
->
handlePaidNotify
(
function
(
$message
,
$fail
)
{
Log
::
add
(
'--支付回调--'
,
$message
);
$orderObj
=
OrderInfo
::
where
([
'order_sn'
=>
$message
[
'out_trade_no'
]])
->
first
();
$orderObj
=
OrderInfo
::
where
([
'order_sn'
=>
$message
[
'out_trade_no'
]])
->
first
();
if
(
!
$orderObj
)
{
if
(
!
$orderObj
)
{
$fail
(
'订单不存在'
);
$fail
(
'订单不存在'
);
}
}
Log
::
add
(
'--支付回调--'
,
$message
);
//支付完成后的业务逻辑[result_code] => SUCCESS
//支付完成后的业务逻辑[result_code] => SUCCESS
if
(
$orderObj
->
pay_status
==
1
)
{
if
(
$orderObj
->
pay_status
==
1
)
{
return
true
;
return
true
;
...
...
app/Store/Controllers/MerchatGoodsStoreController.php
View file @
f04a3114
...
@@ -6,8 +6,6 @@
...
@@ -6,8 +6,6 @@
use
App\Models\MerchantGoodSku
;
use
App\Models\MerchantGoodSku
;
use
App\Admin\Renderable\MerchantStoreSkuList
;
use
App\Admin\Renderable\MerchantStoreSkuList
;
use
App\Models\Good
;
use
App\Models\Good
;
use
App\Models\StoreGoodsCategory
;
use
App\Models\StoreGoodsTag
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
...
...
app/Store/Controllers/OrderDivideRecordController.php
View file @
f04a3114
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
use
App\Models\Merchant
;
use
App\Models\Merchant
;
use
App\Models\OrderDivideRecord
;
use
App\Models\OrderDivideRecord
;
use
App\Store\Actions\Grid\IncomeApply
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
...
...
app/Store/Controllers/OrderInfoController.php
View file @
f04a3114
...
@@ -3,10 +3,6 @@
...
@@ -3,10 +3,6 @@
namespace
App\Store\Controllers
;
namespace
App\Store\Controllers
;
use
App\Models\UserAddress
;
use
App\Models\UserAddress
;
use
App\Models\UserRefund
;
use
App\Store\Actions\Grid\RefundToExamine
;
use
App\Store\Actions\Grid\SendOutGoods
;
use
App\Models\StoreOrder
;
use
App\Models\OrderInfo
;
use
App\Models\OrderInfo
;
use
App\Models\City
;
use
App\Models\City
;
use
App\Models\Store
;
use
App\Models\Store
;
...
@@ -96,41 +92,12 @@ protected function grid()
...
@@ -96,41 +92,12 @@ protected function grid()
*
*
* @return Show
* @return Show
*/
*/
protected
function
detail
(
$id
)
protected
function
detail
(
$id
)
{}
{
return
Show
::
make
(
$id
,
new
StoreOrder
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'order_id'
);
$show
->
field
(
'goods_id'
);
$show
->
field
(
'num'
);
$show
->
field
(
'address_id'
);
$show
->
field
(
'status'
);
$show
->
field
(
'over_time'
);
$show
->
field
(
'voucher'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
/**
* Make a form builder.
* Make a form builder.
*
*
* @return Form
* @return Form
*/
*/
protected
function
form
()
protected
function
form
()
{}
{
return
Form
::
make
(
new
StoreOrder
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'order_id'
);
$form
->
text
(
'goods_id'
);
$form
->
text
(
'num'
);
$form
->
text
(
'address_id'
);
$form
->
text
(
'status'
);
$form
->
text
(
'over_time'
);
$form
->
text
(
'voucher'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
}
app/Store/Controllers/StoreIncomeController.php
View file @
f04a3114
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
namespace
App\Store\Controllers
;
namespace
App\Store\Controllers
;
use
App\Models\Income
;
use
App\Models\Income
;
use
App\Store\Actions\Grid\IncomeApply
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
...
@@ -21,7 +20,6 @@ class StoreIncomeController extends AdminController
...
@@ -21,7 +20,6 @@ class StoreIncomeController extends AdminController
protected
function
grid
()
protected
function
grid
()
{
{
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Income
(),
function
(
Grid
$grid
)
{
//$grid->tools(new IncomeApply());
$grid
->
addTableClass
([
'table-text-center'
]);
$grid
->
addTableClass
([
'table-text-center'
]);
$merchant_id
=
Admin
::
user
()
->
merchant_id
;
$merchant_id
=
Admin
::
user
()
->
merchant_id
;
$grid
->
model
()
->
where
([
'user_type'
=>
2
,
'um_id'
=>
$merchant_id
])
->
orderBy
(
'created_at'
,
'DESC'
);
$grid
->
model
()
->
where
([
'user_type'
=>
2
,
'um_id'
=>
$merchant_id
])
->
orderBy
(
'created_at'
,
'DESC'
);
...
...
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