Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHO-ACTIVITY-PHP
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
1057249b159f036f8747b15b758e529b1e6b8086
2 parents
6da0e184
03850bd5
Merge branch 'develop/wap' of
http://git.dev.yoho.cn/web/yohobuy
into develop/wap
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
191 additions
and
15 deletions
yohobuy/huodong.m.yohobuy.com/application/models/Cuxiao/Girlday.php
yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Girlday.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
yohobuy/huodong.m.yohobuy.com/application/models/Cuxiao/Girlday.php
0 → 100644
View file @
1057249
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2016/3/4
* Time: 12:18
*/
namespace
Cuxiao
;
use
LibModels\Wap\Cuxiao\ActivityData
;
class
GirldayModel
{
/**
* 获取领券活动结果
*
* @param int $uid 用户id
* @param int $actId 活动id
* @return array
*/
public
static
function
getGirldayCoupon
(
$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
,
'【优惠券】您有4张春潮新势力优惠券'
,
'尊敬的客户:恭喜您成功获得4张春潮新势力优惠券 !您可以在个人中心查看优惠券详情。'
);
}
}
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/Girlday.php
0 → 100644
View file @
1057249
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2016/3/4
* Time: 11:53
*/
use
Action\HuodongAction
;
use
Cuxiao\XinshiliModel
;
use
Plugin\Helpers
;
/**
*
*/
class
GirldayController
extends
HuodongAction
{
const
STATIC_VERSION
=
'http://cdn.yoho.cn/huodong/2016girlday/1.0.0'
;
/**
* 检测登录状态
*
*/
private
function
getLoggedUid
()
{
if
(
$this
->
_isApp
)
{
$uid
=
$this
->
get
(
'uid'
);
}
else
{
$uid
=
$this
->
getUid
();
}
return
$uid
;
}
/**
* 判断是否登陆
*/
private
function
checkLogin
()
{
$playUrl
=
Helpers
::
url
(
'/cuxiao/girlday/index'
);
if
(
!
$this
->
getLoggedUid
())
{
if
(
!
$this
->
_isApp
)
{
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
$playUrl
),
'default'
));
}
else
{
$playUrlEncode
=
strtr
(
$playUrl
,
array
(
'/'
=>
'\\/'
));
$this
->
go
(
$playUrl
.
'?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
.
$playUrlEncode
.
'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'
);
}
}
}
/**
* 领券活动页面控制器
*/
public
function
indexAction
()
{
$this
->
checkLogin
();
//获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
$myCouponUrl
=
Helpers
::
url
(
'/home/coupons'
,
null
,
'default'
)
.
'?openby:yohobuy={"action":"go.coupon"}'
;
$this
->
_view
->
display
(
'index'
,
array
(
'staticTitle'
=>
'YOHO!BUY有货【春潮新势力】'
,
'staticVersion'
=>
self
::
STATIC_VERSION
,
'staticJS'
=>
array
(
'home.js'
),
'couponUrl'
=>
$myCouponUrl
,
// 个人中心优惠券地址
'isApp'
=>
$this
->
_isApp
,
'getCouponUrl'
=>
Helpers
::
url
(
'/cuxiao/girlday/sendCoupon'
,
array
(
'uid'
=>
$this
->
getLoggedUid
())),
'banner'
=>
array
(
'img'
=>
''
,
'url'
=>
'http://feature.yoho.cn/0310/0310APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】", "url":"http://feature.yoho.cn/0310/0310APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"382"},"param":{"share_id":"382"}}'
),
'selectUrl'
=>
'http://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}'
,
'weixinUrl'
=>
'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd'
,
// 微信关注地址
'appUrl'
=>
'http://www.yohoshow.com/about/index/yohobuyqr'
,
// APP 下载地址
'shareTitle'
=>
'YOHO!BUY有货【春潮新势力】火力全开!320元优惠券限时派送中!'
,
'shareDesc'
=>
'换我做主,用新陪伴!白色情人节限时2件7折!'
,
'shareImg'
=>
''
,
'shareLink'
=>
'http://feature.yoho.cn/0310/0310APPHOME/index.html'
));
}
/**
* 领券接口
*/
public
function
sendCouponAction
()
{
$result
=
array
(
'code'
=>
201
);
do
{
if
(
!
$this
->
isAjax
())
{
break
;
}
$activityId
=
$this
->
getActivityId
();
$uid
=
$this
->
getLoggedUid
();
$result
=
GirldayModel
::
getGirldayCoupon
(
$uid
,
$activityId
);
}
while
(
false
);
$this
->
echoJson
(
$result
);
}
/**
* 根据环境来获取活动ID
*
* @return int
*/
private
function
getActivityId
()
{
// 设置环境变量
switch
(
APPLICATION_ENV
)
{
case
'production'
:
// 生产
return
506
;
case
'preview'
:
// 预览
case
'testing'
:
// 测试
case
'develop'
:
// 开发
default
:
return
488
;
}
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
1057249
...
...
@@ -238,6 +238,7 @@ class UserModel
$product
[
'discountPrice'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
'¥'
.
Helpers
::
transPrice
(
$val
[
'sales_price'
])
:
false
;
$product
[
'savePrice'
]
=
(
$val
[
'price_down'
]
>
0
)
?
'¥'
.
Helpers
::
transPrice
(
$val
[
'price_down'
])
:
false
;
$product
[
'sellOut'
]
=
(
$val
[
'storage'
]
<=
0
);
$product
[
'invalidGoods'
]
=
(
$val
[
'status'
]
==
0
);
// 下架商品
$datas
[]
=
$product
;
}
...
...
@@ -378,9 +379,9 @@ class UserModel
$record
=
array
();
foreach
(
$data
as
&
$val
)
{
// 排除下架的商品
if
(
$val
[
'status'
]
==
0
)
{
/*
if ($val['status'] == 0) {
continue;
}
}
*/
$record
=
array
();
$record
[
'product_name'
]
=
$val
[
'product_name'
];
...
...
@@ -389,6 +390,7 @@ class UserModel
$record
[
'image'
]
=
!
empty
(
$val
[
'image'
])
?
Helpers
::
getImageUrl
(
$val
[
'image'
],
447
,
596
)
:
''
;
$record
[
'sales_price'
]
=
Helpers
::
transPrice
(
$val
[
'sales_price'
]);
$record
[
'market_price'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
Helpers
::
transPrice
(
$val
[
'market_price'
])
:
false
;
$record
[
'invalidGoods'
]
=
(
$val
[
'status'
]
==
0
);
// 下架商品
$record
[
'storage'
]
=
$val
[
'storage'
];
$allRecords
[]
=
$record
;
}
...
...
@@ -552,29 +554,21 @@ class UserModel
$coupons
=
UserData
::
couponData
(
$uid
,
$status
,
$page
);
// 没有获取到优惠券时
if
(
empty
(
$coupons
))
{
$result
[
'noRecord'
]
=
true
;
break
;
}
if
(
$page
==
1
&&
isset
(
$coupons
[
'data'
][
'total'
])
&&
$coupons
[
'data'
][
'total'
]
===
0
)
{
if
(
empty
(
$coupons
)
||
empty
(
$coupons
[
'data'
]))
{
$result
[
'noRecord'
]
=
true
;
break
;
}
// 判断是否有优惠券
if
(
empty
(
$coupons
[
'data'
][
'info'
]))
{
break
;
}
// 处理已使用的优惠券
if
(
$status
==
1
)
{
foreach
(
$coupons
[
'data'
][
'info'
]
as
&
$value
)
{
$value
[
'used'
]
=
true
;
}
}
$result
[
'coupons'
]
=
$coupons
[
'data'
][
'info'
];
if
(
!
empty
(
$coupons
[
'data'
][
'info'
]))
{
$result
[
'coupons'
]
=
$coupons
[
'data'
][
'info'
];
}
}
while
(
false
);
...
...
Please
register
or
login
to post a comment