Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
573f6661
Commit
573f6661
authored
Mar 11, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返现红包列表
parent
2bede17e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
1 deletion
+109
-1
Coupon.php
application/index/controller/Coupon.php
+96
-0
cashBackList.html
application/index/view/coupon/cashBackList.html
+0
-0
CActivity.php
application/model/CActivity.php
+11
-0
CCoupon.php
application/model/CCoupon.php
+1
-1
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Coupon.php
0 → 100644
View file @
573f6661
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/3/11
* Time: 15:49
*/
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\model\CActivity
;
use
app\model\CCoupon
;
use
app\model\Users
;
use
think\Request
;
class
Coupon
extends
Basic
{
private
$m_coupon
;
private
$m_activity
;
public
function
__construct
(
?
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
m_coupon
=
new
CCoupon
();
$this
->
m_activity
=
new
CActivity
();
}
public
function
couponList
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'couponList'
);
}
$page_no
=
empty
(
$this
->
params
[
'page_no'
])
?
1
:
$this
->
params
[
'page_no'
];
$page_size
=
empty
(
$this
->
params
[
'page_size'
])
?
15
:
$this
->
params
[
'page_size'
];
$where
=
$this
->
binWhere
(
$this
->
params
);
$field
=
'id,user_id,activity_id,status,create_time'
;
$list
=
$this
->
m_coupon
->
getList
(
$page_no
,
$page_size
,
'id desc'
,
$field
,
$where
);
$total
=
$this
->
m_coupon
->
getTotal
(
$where
);
$m_user
=
new
Users
();
$field_activity
=
'money,return_action,activity_start_time,activity_end_time'
;
foreach
(
$list
as
$k
=>
$v
)
{
$activity_data
=
$this
->
m_activity
->
getFind
(
$field_activity
,
[
'id'
=>
$v
[
'activity_id'
]]);
$list
[
$k
][
'money'
]
=
$activity_data
[
'money'
];
$list
[
$k
][
'return_action'
]
=
$activity_data
[
'return_action'
];
$list
[
$k
][
'activity_start_time'
]
=
$activity_data
[
'activity_start_time'
];
$list
[
$k
][
'activity_end_time'
]
=
$activity_data
[
'activity_end_time'
];
$list
[
$k
][
'user_id'
]
=
$v
[
'user_id'
];
$list
[
$k
][
'user_name'
]
=
''
;
$list
[
$k
][
'user_phone'
]
=
''
;
}
$data
[
'total'
]
=
$total
;
$data
[
'list'
]
=
$list
;
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
* @param $params
* @return array
*/
protected
function
binWhere
(
$params
)
{
$where
=
[];
if
(
isset
(
$params
[
'start_time'
])
&&
isset
(
$params
[
'end_time'
]))
{
$where
[
'create_time'
]
=
[
'between'
,
[
$params
[
'end_time'
],
$params
[
'end_time'
]]];
}
if
(
isset
(
$params
[
'start_time'
])
&&
!
isset
(
$where
[
'a.create_time'
]))
{
$where
[
'create_time'
]
=
$params
[
'start_time'
];
}
if
(
isset
(
$params
[
'end_time'
])
&&
!
isset
(
$where
[
'a.create_time'
]))
{
$where
[
'create_time'
]
=
$params
[
'end_time'
];
}
if
(
isset
(
$params
[
'user_id'
]))
{
$where
[
'user_id'
]
=
$params
[
'user_id'
];
}
if
(
isset
(
$params
[
'id'
]))
{
$where
[
'id'
]
=
$params
[
'id'
];
}
if
(
isset
(
$params
[
'activity_id'
]))
{
$where
[
'activity_id'
]
=
$params
[
'activity_id'
];
}
if
(
isset
(
$params
[
'status'
]))
{
$where
[
'status'
]
=
$params
[
'status'
];
}
return
$where
;
}
}
\ No newline at end of file
application/index/view/
redEnvelope
/cashBackList.html
→
application/index/view/
coupon
/cashBackList.html
View file @
573f6661
File moved
application/model/CActivity.php
View file @
573f6661
...
...
@@ -128,4 +128,15 @@ class CActivity extends Model
return
$this
->
db_
->
table
(
$this
->
table
)
->
where
(
'id'
,
$activity_id
)
->
setInc
(
'get_number'
,
1
);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getFind
(
$field
,
$where
)
{
return
$this
->
field
(
$field
)
->
where
(
$where
)
->
find
();
}
}
application/model/CCoupon.php
View file @
573f6661
...
...
@@ -11,7 +11,7 @@ namespace app\model;
use
think\Db
;
class
CCoupon
class
CCoupon
extends
BaseModel
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'c_coupon'
;
...
...
application/route.php
View file @
573f6661
...
...
@@ -425,6 +425,7 @@ Route::group('index', [
'saveActivity'
=>
[
'index/Activity/saveActivity'
,
[
'method'
=>
'POST|GET'
]],
//新增或修改活动
'getActivityList'
=>
[
'index/Activity/getActivityList'
,
[
'method'
=>
'POST|GET'
]],
//获取活动
'couponList'
=>
[
'index/Coupon/couponList'
,
[
'method'
=>
'GET'
]],
//获取活动
]);
...
...
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