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
64157074
Commit
64157074
authored
Jan 09, 2025
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
6796a728
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
269 additions
and
28 deletions
+269
-28
app/Admin/Actions/EditShareUserAct.php
+94
-0
app/Admin/Actions/UserBuyCode.php
+2
-2
app/Admin/Controllers/HfCompanyMemberController.php
+21
-5
app/Admin/Controllers/UserController.php
+3
-1
app/Admin/Forms/EditShareUserForm.php
+78
-0
app/Http/Controllers/Api/HfCompanyMemberController.php
+5
-1
app/Http/Controllers/Api/HfSettleAccountController.php
+38
-9
app/Http/Controllers/Api/LoginController.php
+1
-1
app/Http/Controllers/Api/StoreAdminUsersController.php
+2
-2
app/Http/Controllers/Api/SystemController.php
+1
-1
app/Http/Controllers/Api/UserController.php
+2
-2
app/Models/Adapay.php
+16
-0
app/Models/OrderDivideRecord.php
+4
-4
routes/api.php
+2
-0
No files found.
app/Admin/Actions/EditShareUserAct.php
0 → 100644
View file @
64157074
<?php
namespace
App\Admin\Actions
;
use
Dcat\Admin\Actions\Response
;
use
App\Admin\Forms\EditShareUserForm
;
use
Dcat\Admin\Grid\RowAction
;
use
Dcat\Admin\Traits\HasPermissions
;
use
Illuminate\Contracts\Auth\Authenticatable
;
use
Illuminate\Http\Request
;
use
Dcat\Admin\Widgets\Modal
;
class
EditShareUserAct
extends
RowAction
{
protected
$uid
=
0
;
/**
* 接收参数
*/
public
function
__construct
(
$title
=
''
,
$uid
=
0
)
{
$this
->
uid
=
$uid
;
parent
::
__construct
(
$title
);
$this
->
title
=
$title
;
}
/**
* @return string
*/
//protected $title = '<i class="feather icon-stop-circle"> </i>';
/**
* 按钮文本
*
* @return string|void
*/
public
function
title
()
{
return
'<i class="feather icon-edit-1"></i> '
.
$this
->
title
.
''
;
}
/**
* Handle the action request.
*
* @param Request $request
*
* @return Response
*/
public
function
handle
(
Request
$request
)
{
$id
=
$this
->
getKey
()
??
0
;
return
$this
->
response
()
->
success
(
'成功'
)
->
refresh
();
}
/**
* 渲染模态框.
* @return Modal
*/
public
function
render
()
{
// 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
button
(
$this
->
title
())
->
body
(
EditShareUserForm
::
make
()
->
payload
([
'uid'
=>
$this
->
uid
]));
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
}
/**
* @return string|array|void
*/
public
function
confirm
()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected
function
authorize
(
$user
)
:
bool
{
return
true
;
}
/**
* @return array
*/
protected
function
parameters
()
{
return
[];
}
}
app/Admin/Actions/UserBuyCode.php
View file @
64157074
...
...
@@ -25,7 +25,7 @@ class UserBuyCode extends RowAction
*/
public
function
title
()
{
return
'<i class="feather icon-
stop-circle"></i> '
.
$this
->
title
.
'
'
;
return
'<i class="feather icon-
edit"></i> '
.
'直购码
'
;
}
/**
* Handle the action request.
...
...
@@ -55,7 +55,7 @@ public function render()
return
Modal
::
make
()
->
lg
()
->
title
(
'直购码'
)
->
button
(
"直购码"
)
->
button
(
$this
->
title
()
)
->
body
(
BuyCodeForm
::
make
())
->
onShown
(
<<<
js
...
...
app/Admin/Controllers/HfCompanyMemberController.php
View file @
64157074
...
...
@@ -67,12 +67,26 @@ protected function grid()
}
return
$str
;
});
$grid
->
column
(
'audit_desc'
,
'审核原因'
)
->
display
(
'点击查看'
)
->
modal
(
function
(
$modal
)
{
//设置弹窗标题
$modal
->
title
(
'审核原因'
);
$content
=
$this
->
audit_desc
.
"<br/>"
;
$card
=
new
Card
(
null
,
$content
);
return
"<div style='padding:10px 10px 0;width:100%;'>
$card
</div>"
;
});
$grid
->
disableViewButton
();
$grid
->
disableEditButton
();
$grid
->
disableDeleteButton
();
$grid
->
disableActions
();
$grid
->
disableRowSelector
();
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
$rowData
=
$actions
->
row
;
if
(
$rowData
[
'status'
]
!=
'failed'
)
{
$actions
->
disableEdit
();
}
});
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// 更改为 panel 布局
...
...
@@ -129,8 +143,8 @@ protected function form()
//$form->text('order_no');
$form
->
select
(
'merchant_id'
,
'商家名称'
)
->
options
(
Merchant
::
whereNull
(
'deleted_at'
)
->
get
()
->
pluck
(
'name'
,
'id'
))
->
required
();
$order_no
=
'cm'
.
date
(
"YmdHis"
)
.
mt_rand
(
10000
,
99999
);
$form
->
text
(
'order_no'
)
->
default
(
$order_no
);
//请求订单号
//
$order_no = 'cm' . date("YmdHis") . mt_rand(10000, 99999);
//
$form->text('order_no')->default($order_no); //请求订单号
$form
->
text
(
'cont_name'
)
->
required
();
$form
->
text
(
'cont_phone'
)
->
required
();
$form
->
text
(
'email'
)
->
required
();
...
...
@@ -158,6 +172,8 @@ protected function form()
->
help
(
'内容须包含三证合一证件照、法人身份证正面照、法人身份证反面照、开户银行许可证照。 压缩 zip包后上传,最大限制为 9 M'
);
//hf
$form
->
text
(
'card_no'
,
'银行卡号'
)
->
required
();
$form
->
text
(
'card_name'
,
'银行卡对应的户名'
)
->
required
();
$form
->
hidden
(
'audit_state'
);
$form
->
hidden
(
'audit_desc'
);
$form
->
disableCreatingCheck
();
$form
->
disableEditingCheck
();
...
...
@@ -180,7 +196,7 @@ function (Form $form, $result) {
# 商户用户id
"member_id"
=>
"cm_id"
.
$params
[
'merchant_id'
],
# 订单号
"order_no"
=>
$params
[
'order_no'
]
,
"order_no"
=>
'corp_member'
.
date
(
"YmdHis"
)
.
mt_rand
(
10000
,
99999
)
,
# 企业名称
"name"
=>
$params
[
'name'
],
'prod_mode'
=>
false
,
...
...
app/Admin/Controllers/UserController.php
View file @
64157074
...
...
@@ -5,6 +5,7 @@
use
App\Admin\Forms\EditPermission
;
use
App\Admin\Forms\updatePassword
;
use
App\Admin\Actions\UserBuyCode
;
use
App\Admin\Actions\EditShareUserAct
;
use
Dcat\Admin\Grid\RowAction
;
use
App\Models\User
;
use
App\Models\UserPermission
;
...
...
@@ -46,9 +47,10 @@ protected function grid()
//$grid->simplePaginate();
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
$actions
->
append
(
new
EditShareUserAct
(
'更改所属上级'
,
$actions
->
row
->
id
));
$actions
->
append
(
new
UserBuyCode
(
$actions
->
row
->
id
));
// 添加一个按钮,并设置其属性
$actions
->
append
(
'<a href="/user-share?id='
.
$this
->
id
.
'" alt="查看下级" target="_blank">
查看下级
</a>'
);
$actions
->
append
(
'<a href="/user-share?id='
.
$this
->
id
.
'" alt="查看下级" target="_blank">
<i class="feather icon-list"> 查看下级 </i>
</a>'
);
// 或者使用 RowAction 来添加按钮
//$actions->append(RowAction::make('自定义按钮')->route('custom.route'));
...
...
app/Admin/Forms/EditShareUserForm.php
0 → 100644
View file @
64157074
<?php
namespace
App\Admin\Forms
;
use
App\Admin\Actions\UserBuyCode
;
use
App\Command\Log
;
use
App\Models\Company
;
use
App\Models\Employee
;
use
App\Models\Income
;
use
App\Models\Merchant
;
use
App\Models\Pay
;
use
App\Models\User
;
use
App\Models\UserBuycodeCheck
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\Admin\Contracts\LazyRenderable
;
use
Dcat\Admin\Traits\LazyWidget
;
use
Exception
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Request
;
class
EditShareUserForm
extends
Form
implements
LazyRenderable
{
use
LazyWidget
;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public
function
handle
(
array
$input
)
{
DB
::
beginTransaction
();
try
{
$user_id
=
$this
->
payload
[
'uid'
];
$phone
=
trim
(
$input
[
'phone'
]);
//推荐人手机号
$spObj
=
User
::
where
(
'phone'
,
$phone
)
->
first
();
if
(
!
$spObj
)
{
throw
new
Exception
(
'该推荐人信息不存在!'
);
}
$uObj
=
User
::
find
(
$user_id
);
Log
::
add
(
'更改推荐人前信息uid:'
.
$user_id
,
[
'spuid'
=>
$uObj
->
spuid
,
'second_spuid'
=>
$uObj
->
second_spuid
]);
if
(
$uObj
)
{
$uObj
->
spuid
=
$spObj
->
id
;
//直推
$uObj
->
second_spuid
=
$spObj
->
spuid
??
0
;
//间推
$uObj
->
save
();
Log
::
add
(
'更改推荐人后信息uid:'
.
$user_id
,
[
'spuid'
=>
$uObj
->
spuid
,
'second_spuid'
=>
$uObj
->
second_spuid
]);
}
DB
::
commit
();
}
catch
(
\Exception
$exception
)
{
DB
::
rollBack
();
return
$this
->
response
()
->
error
(
$exception
->
getMessage
())
->
refresh
();
}
return
$this
->
response
()
->
success
(
'提交成功'
)
->
refresh
();
}
/**
* Build a form here.
*/
public
function
form
()
{
$this
->
text
(
'phone'
,
'推荐手机号'
);
}
/**
* The data of the form.
*
* @return array
*/
public
function
default
()
{
// 获取外部传递参数
return
[];
}
}
app/Http/Controllers/Api/HfCompanyMemberController.php
View file @
64157074
...
...
@@ -98,10 +98,14 @@ public function notify()
$member_id
=
$post_data
[
'member_id'
];
$order_no
=
$post_data
[
'order_no'
];
$hfcObj
=
HfCompanyMember
::
where
([
'member_id'
=>
$member_id
,
'order_no'
=>
$order_no
])
->
first
();
if
(
$post_data
[
'audit_state'
]
!=
'B
'
)
{
if
(
$post_data
[
'audit_state'
]
==
'D
'
)
{
$hfcObj
->
status
=
'succeeded'
;
$hfcObj
->
audit_state
=
'D'
;
$hfcObj
->
audit_desc
=
$post_data
[
'audit_desc'
];
}
else
{
$hfcObj
->
status
=
'failed'
;
$hfcObj
->
audit_state
=
$post_data
[
'audit_state'
];
$hfcObj
->
audit_desc
=
$post_data
[
'audit_desc'
];
}
$hfcObj
->
save
();
return
true
;
...
...
app/Http/Controllers/Api/HfSettleAccountController.php
View file @
64157074
...
...
@@ -160,20 +160,49 @@ public function myCard(Request $request)
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
$account_params
=
[];
$accountObj
=
HfSettleAccount
::
where
([
'member_type'
=>
$member_type
,
'mid'
=>
$mid
])
->
first
();
$account_params
=
array
(
'card_id'
=>
$accountObj
->
card_id
,
'card_name'
=>
$accountObj
->
card_name
,
'tel_no'
=>
$accountObj
->
tel_no
,
'bank_code'
=>
$accountObj
->
bank_code
??
''
,
'bank_name'
=>
$accountObj
->
bank_name
??
''
,
);
if
(
$accountObj
)
{
$account_params
=
array
(
'card_id'
=>
$accountObj
->
card_id
??
''
,
'card_name'
=>
$accountObj
->
card_name
??
''
,
'tel_no'
=>
$accountObj
->
tel_no
??
''
,
'bank_code'
=>
$accountObj
->
bank_code
??
''
,
'bank_name'
=>
$accountObj
->
bank_name
??
''
,
);
}
return
$this
->
JsonResponse
(
$account_params
);
}
//查询结算账户
public
function
queryAccount
(
Request
$request
)
{}
//查询账户余额
public
function
queryBalance
(
Request
$request
)
{
$userObj
=
$request
->
user
();
//$member_type = $request->member_type ?? 0;
$role_id
=
$useObj
->
role_id
??
''
;
if
(
$role_id
==
1
)
{
//商家
$mid
=
$userObj
->
merchant_id
;
$member_id
=
HfCompanyMember
::
where
([
'merchant_id'
=>
$mid
,
'status'
=>
'succeeded'
])
->
value
(
'member_id'
);
}
else
{
$mid
=
$userObj
->
id
;
$member_id
=
$userObj
->
member_id
;
}
if
(
!
$member_id
)
{
return
$this
->
JsonResponse
(
''
,
'账户异常,请联系管理员'
,
500
);
}
$account_params
=
[
'app_id'
=>
env
(
'HUIFU_APPID'
),
'member_id'
=>
$member_id
,
];
$result
=
(
new
Adapay
())
->
queryBalance
(
$account_params
);
if
(
isset
(
$result
[
'status'
])
&&
$result
[
'status'
]
==
'succeeded'
)
{
return
$this
->
JsonResponse
(
$result
);
}
else
{
return
$this
->
JsonResponse
(
''
,
'查询失败'
,
201
);
}
}
//银行代码
public
function
getBankCode
()
...
...
app/Http/Controllers/Api/LoginController.php
View file @
64157074
...
...
@@ -106,7 +106,7 @@ public function login(Request $request)
if
(
!
$user
->
member_id
)
{
$result
=
(
new
Adapay
())
->
createMember
(
$user
->
id
,
$user
->
phone
);
if
(
isset
(
$result
[
'status'
])
&&
$result
[
'status'
]
==
'succeeded'
)
{
DB
::
table
(
'user'
)
->
where
(
'id'
,
$user
->
id
)
->
update
([
'member_id'
=>
$result
[
'member_id'
]]);
DB
::
table
(
'user
s
'
)
->
where
(
'id'
,
$user
->
id
)
->
update
([
'member_id'
=>
$result
[
'member_id'
]]);
}
}
...
...
app/Http/Controllers/Api/StoreAdminUsersController.php
View file @
64157074
...
...
@@ -71,8 +71,8 @@ public function info(Request $request)
$phone
=
$merObj
->
phone
;
$merchant_name
=
$merObj
->
name
;
$total_revenue
=
$merObj
->
total_revenue
??
0
;
$balance
=
$merObj
->
balance
??
0
;
$cashout
=
$total_revenue
-
$balance
;
$balance
=
0
;
//
$merObj->balance ?? 0;
$cashout
=
0
;
//
$total_revenue - $balance;
}
if
(
$store_id
)
{
$storeObj
=
Store
::
where
(
'id'
,
$store_id
)
->
first
();
...
...
app/Http/Controllers/Api/SystemController.php
View file @
64157074
...
...
@@ -55,7 +55,7 @@ public function autoChangeReceiveStatus()
return
'--ok--'
;
}
//定时任务--订单分佣
//定时任务--订单分佣
(废弃) -- 分佣已采用汇付分账模式
public
function
autoOrderCommission
()
{
$chunkSize
=
50
;
// 每次处理的订单数量
...
...
app/Http/Controllers/Api/UserController.php
View file @
64157074
...
...
@@ -166,9 +166,9 @@ public function numberShoppingCart(Request $request)
public
function
info
(
Request
$request
)
{
$user
=
$request
->
user
();
$balance
=
$user
->
balance
??
0
;
//余额
$balance
=
0
;
//
$user->balance ?? 0; //余额
$total_revenue
=
$user
->
total_revenue
??
0
;
//总金额
$cashout
=
$total_revenue
-
$balance
;
//已提现
$cashout
=
0
;
//
$total_revenue - $balance; //已提现
return
$this
->
JsonResponse
([
'user_id'
=>
$user
->
id
,
'nickname'
=>
$user
->
name
,
...
...
app/Models/Adapay.php
View file @
64157074
...
...
@@ -405,4 +405,20 @@ public function deleteSettleAccount($account_params)
return
$account
->
result
;
}
}
//查询账户余额
public
function
queryBalance
(
$account_params
)
{
$account
=
new
\NwVVVS\AdapaySdk\SettleAccount
();
# 查询账户余额
$account
->
balance
(
$account_params
);
# 对查询账户余额结果进行处理
if
(
$account
->
isError
())
{
//失败处理
return
$account
->
result
;
}
else
{
//成功处理
return
$account
->
result
;
}
}
}
app/Models/OrderDivideRecord.php
View file @
64157074
...
...
@@ -53,8 +53,8 @@ public static function divide($order_id)
$divide_price
=
number_format
(
$goods_amount
*
(
$first_commission
/
100
),
2
);
//收益直接到直推账户
$spObj
=
User
::
find
(
$spuid
);
$spObj
->
total_revenue
+=
$divide_price
;
$spObj
->
balance
+=
$divide_price
;
$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
);
//汇付参数
...
...
@@ -69,7 +69,7 @@ public static function divide($order_id)
//收益直接到直推账户
$spObj
=
User
::
find
(
$second_spuid
);
$spObj
->
total_revenue
+=
$divide_price
;
$spObj
->
balance
+=
$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
);
//汇付参数
...
...
@@ -84,7 +84,7 @@ public static function divide($order_id)
//收益直接到商户账户
$merObj
=
Merchant
::
find
(
$merchant_id
);
$merObj
->
total_revenue
+=
$divide_price
;
$merObj
->
balance
+=
$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
);
...
...
routes/api.php
View file @
64157074
...
...
@@ -204,5 +204,7 @@
Route
::
post
(
'hf-settle-account-query'
,
'HfSettleAccountController@queryAccount'
);
//汇付 查询用户结算账户
Route
::
get
(
'hf-account-balance'
,
'HfSettleAccountController@queryBalance'
);
//汇付 查询账户余额
});
});
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