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
cf6e99f5
Commit
cf6e99f5
authored
Mar 12, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页弹窗
parent
27ff12b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
4 deletions
+65
-4
Coupon.php
application/api/controller/Coupon.php
+34
-0
CCoupon.php
application/model/CCoupon.php
+29
-0
route.php
application/route.php
+2
-4
No files found.
application/api/controller/Coupon.php
View file @
cf6e99f5
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\model\CActivity
;
use
app\model\CCoupon
;
use
think\Request
;
/**
...
...
@@ -10,9 +12,40 @@ use think\Request;
* Time: 10:17
*/
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
();
}
/**
* @return \think\Response
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public
function
getHomeCoupon
()
{
if
(
empty
(
$this
->
userId
))
{
// return $this->response(101, '请登录');
}
$data
=
[];
$where
[
'user_id'
]
=
$this
->
userId
;
$where
[
'user_id'
]
=
1
;
$where
[
'first_show'
]
=
0
;
$coupon_data
=
$this
->
m_coupon
->
getCouponColumn
(
'id,activity_id'
,
$where
);
if
(
!
empty
(
$coupon_data
))
{
$activity_id
=
array_unique
(
array_values
(
$coupon_data
));
$coupon_id
=
array_keys
(
$coupon_data
);
$activity_where
[
'id'
]
=
[
'in'
,
$activity_id
];
$data
=
$this
->
m_activity
->
getActivity
(
'money,return_type,return_action'
,
$activity_where
);
// $this->m_coupon->updateData(['first_show'=>1], ['id'=>['in',$coupon_id]]);
}
return
$this
->
response
(
200
,
''
,
$data
);
}
}
\ No newline at end of file
application/model/CCoupon.php
View file @
cf6e99f5
...
...
@@ -46,6 +46,24 @@ class CCoupon extends BaseModel
return
$result
;
}
/**
* @param $field
* @param $params
* @return array
*/
public
function
getCouponColumn
(
$field
,
$params
)
{
if
(
!
isset
(
$params
[
'status'
]))
{
$params
[
'status'
]
=
0
;
}
$result
=
$this
->
db_
->
where
(
$params
)
->
column
(
$field
);
//dump($this->getLastSql());
return
$result
;
}
/**
* @param $where
* @param string $field
...
...
@@ -69,6 +87,17 @@ class CCoupon extends BaseModel
return
$result
;
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
/**
*
*/
...
...
application/route.php
View file @
cf6e99f5
...
...
@@ -435,12 +435,10 @@ Route::group('api', [
'sendSms'
=>
[
'api/member/sendSms'
,
[
'method'
=>
'get'
]],
//发送短信
'check_code'
=>
[
'api/member/check_code'
,
[
'method'
=>
'get'
]],
//检测短信
'index'
=>
[
'api/member/index'
,
[
'method'
=>
'get'
]],
//get broker
'getHomeCoupon'
=>
[
'api/Coupon/getHomeCoupon'
,
[
'method'
=>
'get'
]],
'getBroker'
=>
[
'api/broker/index'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2'
=>
[
'api/broker/indexV2'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'test'
=>
[
'api/broker/testtest'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
//
'test' => ['api/broker/testtest', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'commentAndDeal'
=>
[
'api/broker/commentAndDeal'
,
[
'method'
=>
'get'
]],
//获取当前经纪人的评价和交易列表
'brokerDetail'
=>
[
'api/broker/brokerDetail'
,
[
'method'
=>
'get'
]],
//经纪人详情
//post broker
...
...
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