Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
70918906
authored
Dec 20, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整自营样片列表消耗人数
parent
0f672840
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletions
app/Model/UserSampleApplyModel.php
public/js/web/selfSampleLog.js
app/Model/UserSampleApplyModel.php
View file @
70918906
...
...
@@ -99,7 +99,8 @@ class UserSampleApplyModel extends Model
$v
[
'invite_count'
]
=
$UserSampleInviteModel
->
getUserInviteCount
(
$v
[
'user_id'
]);
$v
[
'apply_num_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片总数
$v
[
'quota_total'
]
=
$this
->
getSampleApplySum
(
$v
[
'user_id'
],
'quota'
);
// 获取指定用户申请的样片消耗总人数
// $v['quota_total'] = $this->getSampleApplySum($v['user_id'], 'quota'); // 获取指定用户申请的样片总数
$v
[
'quota_total'
]
=
$this
->
getUsedCount
(
$v
[
'user_id'
]);
// 获取指定用户申请的样片消耗总人数
$v
[
'apply_count'
]
=
$UserInfoModel
->
getUserApplyCount
(
$v
[
'user_id'
]);
}
...
...
@@ -112,6 +113,16 @@ class UserSampleApplyModel extends Model
return
$this
->
where
(
'user_id'
,
$user_id
)
->
sum
(
$field
);
}
// 获取指定用户申请的样片消耗总人数
public
function
getUsedCount
(
$user_id
)
{
return
$this
->
from
(
'lie_user_sample_apply as s'
)
->
join
(
'lie_order as o'
,
's.order_id'
,
'='
,
'o.order_id'
)
->
where
(
's.user_id'
,
'='
,
$user_id
)
->
where
(
'o.status'
,
'<>'
,
'-1'
)
->
sum
(
'quota'
);
}
// 获取领取记录
public
function
applyLog
(
$request
)
{
...
...
@@ -127,7 +138,25 @@ class UserSampleApplyModel extends Model
->
orderBy
(
'apply_id'
,
'asc'
)
->
paginate
(
$limit
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$list
[
'data'
]
=
$this
->
handleData
(
$list
[
'data'
]);
return
[
0
,
'获取成功'
,
$list
[
'data'
],
$list
[
'total'
]];
}
// 处理记录
public
function
handleData
(
$data
)
{
if
(
!
$data
)
return
false
;
$OrderModel
=
new
OrderModel
();
foreach
(
$data
as
&
$v
)
{
$order
=
$OrderModel
->
where
(
'order_id'
,
$v
[
'order_id'
])
->
select
(
'status'
)
->
first
();
$v
[
'order_status'
]
=
Config
(
'params.order_status'
)[
$order
->
status
];
}
return
$data
;
}
}
\ No newline at end of file
public/js/web/selfSampleLog.js
View file @
70918906
...
...
@@ -18,6 +18,7 @@ layui.use(['table'], function(){
,{
field
:
'account'
,
title
:
'用户账户'
,
width
:
200
}
,{
field
:
'order_id'
,
title
:
'订单ID'
,
width
:
120
}
,{
field
:
'order_sn'
,
title
:
'订单编号'
,
width
:
200
}
,{
field
:
'order_status'
,
title
:
'订单状态'
,
width
:
100
}
,{
field
:
'goods_id'
,
title
:
'样片ID'
,
width
:
120
}
,{
field
:
'goods_name'
,
title
:
'样片名称'
,
width
:
300
}
,{
field
:
'apply_num'
,
title
:
'领取数量'
,
width
:
120
}
...
...
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