Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘小敏
loveisland
Commits
7cb64f71
Commit
7cb64f71
authored
Jul 07, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(agent): 优化代理商详情查看与状态校验
parent
26035c5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
34 deletions
+22
-34
Agent.php
addons/shopro/controller/user/Agent.php
+12
-4
Agent.php
application/admin/controller/shopro/agent/Agent.php
+10
-30
No files found.
addons/shopro/controller/user/Agent.php
View file @
7cb64f71
...
...
@@ -3,7 +3,7 @@
namespace
addons\shopro\controller\user
;
use
addons\shopro\controller\Common
;
use
app\admin\model\shopro\
commission
\Agent
as
AgentModel
;
use
app\admin\model\shopro\
agent
\Agent
as
AgentModel
;
class
Agent
extends
Common
{
...
...
@@ -63,13 +63,21 @@ class Agent extends Common
$user
=
auth_user
();
$userId
=
$user
->
id
??
0
;
$agent
=
\app\admin\model\shopro\agent\Agent
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
\app\admin\model\shopro\agent\Agent
::
STATUS_NORMAL
)
$agentModel
=
new
AgentModel
();
$agent
=
$agentModel
->
where
(
'user_id'
,
$userId
)
->
field
(
'id,user_id,province_name,real_name,id_card,id_card_images,commission_rate,total_commission,status,apply_id,createtime'
)
->
find
();
if
(
!
$agent
)
{
$this
->
error
(
'数据不存在'
);
$this
->
error
(
'您还不是代理商'
);
}
// 冻结或禁用状态不允许查看详情
$allowStatus
=
[
AgentModel
::
STATUS_NORMAL
];
if
(
!
in_array
(
$agent
->
status
,
$allowStatus
))
{
$statusText
=
$agentModel
->
statusList
()[
$agent
->
status
]
??
$agent
->
status
;
$this
->
error
(
"代理商状态
{
$statusText
}
,不可查看详情"
);
}
$this
->
success
(
'成功'
,
$agent
);
...
...
application/admin/controller/shopro/agent/Agent.php
View file @
7cb64f71
...
...
@@ -233,42 +233,12 @@ class Agent extends Backend
*/
public
function
detail
(
$ids
=
null
)
{
// 容错:多层兜底获取代理商 ID
// Fast.api.open 以 iframe 方式打开,URL 格式可能是:
// ?ids=1&dialog=1 (新 JS,query 参数)
// /ids/1 (旧 JS,路径参数)
// /ids/1.html (旧 JS + url_html_suffix=html)
// 1) 方法参数(ThinkPHP 路由自动注入)
if
(
empty
(
$ids
))
{
// 2) param() — 兼容 query string (?ids=1) 和 url_common_param
$ids
=
$this
->
request
->
param
(
'ids'
);
}
// if (empty($ids)) {
// // 3) get() — 直接读 GET 参数
// $ids = $this->request->get('ids');
// }
// if (empty($ids)) {
// // 4) pathinfo 正则解析 /ids/数字 或 /ids/数字.html
// $pathinfo = $this->request->pathinfo();
// if (preg_match('#/ids/(\d+)[.\b]#', $pathinfo, $m)) {
// $ids = $m[1];
// }
// }
// echo '[detail] row=' . var_export($row, true), 'notice'; '[detail] ids来源检测: method=' . var_export(func_get_arg(0), true) .
// ' param=' . var_export($this->request->param('ids'), true) .
// ' get=' . var_export($this->request->get('ids'), true) .
// ' pathinfo=' . $this->request->pathinfo() .
// ' 最终ids=' . var_export($ids, true), 'notice';
// 临时调试日志(问题定位后可删除)
// \think\Log::write('[detail] ids来源检测: method=' . var_export(func_get_arg(0), true) .
// ' param=' . var_export($this->request->param('ids'), true) .
// ' get=' . var_export($this->request->get('ids'), true) .
// ' pathinfo=' . $this->request->pathinfo() .
// ' 最终ids=' . var_export($ids, true), 'notice');
if
(
empty
(
$ids
))
{
if
(
$this
->
request
->
isAjax
())
{
return
json
([
'code'
=>
0
,
'msg'
=>
'缺少代理商ID'
,
'total'
=>
0
,
'rows'
=>
[]]);
...
...
@@ -285,6 +255,16 @@ class Agent extends Backend
$this
->
error
(
__
(
'No Results were found'
));
}
// // 冻结或禁用状态不允许查看详情
// $allowStatus = [\app\admin\model\shopro\agent\Agent::STATUS_NORMAL];
// if (!in_array($row->status, $allowStatus)) {
// $statusText = $this->model->statusList()[$row->status] ?? $row->status;
// if ($this->request->isAjax()) {
// return json(['code' => 0, 'msg' => "该代理商{$statusText}状态不可查看详情", 'total' => 0, 'rows' => []]);
// }
// $this->error("该代理商{$statusText}状态不可查看详情");
// }
$commissionModel
=
new
\app\admin\model\shopro\agent\AgentOrderCommission
;
// Ajax 分页获取佣金流水
...
...
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