Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenchao
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
a8bbbe00e3daf673a071f465f69c2767e96839b9
1 parent
9f6b9563
优化新势力领券活动调用逻辑
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
28 deletions
yohobuy/huodong.m.yohobuy.com/application/models/Cuxiao/Xinshili.php
yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Xinshili.php
yohobuy/huodong.m.yohobuy.com/application/models/Cuxiao/Xinshili.php
0 → 100644
View file @
a8bbbe0
<?php
namespace
Cuxiao
;
use
LibModels\Wap\Cuxiao\ActivityData
;
/**
* Created by PhpStorm.
* User: DELL
* Date: 2016/2/25
* Time: 15:11
*
* @name XinshiliModel
* @package models/Cuxiao
* @author Gtskk(tttt6399998@126.com)
*/
class
XinshiliModel
{
/**
* 获取领券活动结果
*
* @param int $uid 用户id
* @param int $actId 活动id
* @return array
*/
public
static
function
getXinshiliCoupon
(
$uid
,
$actId
)
{
$result
=
array
(
'code'
=>
201
);
do
{
if
(
empty
(
$uid
)
||
empty
(
$actId
))
{
break
;
}
$result
=
ActivityData
::
getCouponAll
(
$uid
,
$actId
);
if
(
!
$result
)
{
$result
=
array
(
'code'
=>
201
);
break
;
}
if
(
intval
(
$result
[
'code'
])
===
200
)
{
self
::
sendMessage
(
$uid
,
'【优惠券】您获得1000元套券'
,
'尊敬的客户:恭喜您成功获得1000元套券!您可以在个人中心的交易管理中查看‘我的优惠券’。'
);
}
}
while
(
false
);
return
$result
;
}
/**
* 发送站内信
*
* @param int $uid 用户ID
* @param string $title 站内信标题
* @param string $content 站内信内容
*/
private
static
function
sendMessage
(
$uid
,
$title
,
$content
)
{
try
{
ActivityData
::
message
(
$uid
,
$title
,
$content
);
}
catch
(
Exception
$e
)
{
// do nothing
}
}
}
\ No newline at end of file
...
...
yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Xinshili.php
View file @
a8bbbe0
<?php
use
Action\HuodongAction
;
use
LibModels\Wap\Cuxiao\ActivityData
;
use
Cuxiao\XinshiliModel
;
use
Plugin\Helpers
;
/**
...
...
@@ -35,14 +35,13 @@ class XinshiliController extends HuodongAction
private
function
checkLogin
()
{
$playUrl
=
Helpers
::
url
(
'/cuxiao/xinshili/index'
);
$playUrlEncode
=
strtr
(
$playUrl
,
array
(
'/'
=>
'\\/'
));
$uid
=
$this
->
getLoggedUid
();
if
(
!
$uid
)
{
if
(
!
$this
->
_isApp
)
{
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
'/cuxiao/xinshili/index'
)
),
'default'
));
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
$playUrl
),
'default'
));
}
else
{
$playUrl
=
Helpers
::
url
(
'/cuxiao/xinshili/index'
);
$playUrl
Encode
=
strtr
(
$playUrl
,
array
(
'/'
=>
'\\/'
)
);
$this
->
go
(
$playUrl
.
'?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
.
$playUrlEncode
.
'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'
);
}
}
...
...
@@ -92,14 +91,7 @@ class XinshiliController extends HuodongAction
$activityId
=
$this
->
getActivityId
();
$uid
=
$this
->
getLoggedUid
();
$result
=
ActivityData
::
getCouponAll
(
$uid
,
$activityId
);
if
(
!
isset
(
$result
[
'code'
]))
{
break
;
}
if
(
intval
(
$result
[
'code'
])
===
200
)
{
$this
->
sendMessage
(
$uid
,
'【优惠券】您获得1000元套券'
,
'尊敬的客户:恭喜您成功获得1000元套券!您可以在个人中心的交易管理中查看‘我的优惠券’。'
);
}
$result
=
XinshiliModel
::
getXinshiliCoupon
(
$uid
,
$activityId
);
}
while
(
false
);
$this
->
echoJson
(
$result
);
...
...
@@ -124,20 +116,4 @@ class XinshiliController extends HuodongAction
}
}
/**
* 发送站内信
*
* @param int $uid 用户ID
* @param string $title 站内信标题
* @param string $content 站内信内容
*/
private
function
sendMessage
(
$uid
,
$title
,
$content
)
{
try
{
ActivityData
::
message
(
$uid
,
$title
,
$content
);
}
catch
(
Exception
$e
)
{
// do nothing
}
}
}
...
...
Please
register
or
login
to post a comment