Authored by yangyang

解决冲突

  1 +
  2 +guang.m.yohobuy.com/guang/index/clear?type=boys
  3 +guang.m.yohobuy.com/guang/index/clear?type=girls
  4 +guang.m.yohobuy.com/guang/index/clear?type=kids
  5 +guang.m.yohobuy.com/guang/index/clear?type=lifestyle
  6 +
  7 +
  8 +
  9 +http://new.yohobuy.com/cache/clear?key=Default_Kids_index&token=yoho9646abcdef
  10 +
  11 +http://new.yohobuy.com/cache/clear?key=Default_Lifestyle_index&token=yoho9646abcdef
  12 +
  13 +http://new.yohobuy.com/cache/clear?key=Default_Woman_index&token=yoho9646abcdef
  14 +
  15 +##http://new.yohobuy.com/cache/clear?key=Default_Default_index&token=yoho9646abcdef
  16 +
  17 +
  18 +其中token就按照上述中去填写,key代表具体要清的缓存的键
  19 +
  20 +具体key的对应关系如下:
  21 +key 说明
  22 +Default_Kids_index 潮童页面缓存
  23 +Default_Lifestyle_index 创意生活页面缓存
  24 +Default_Woman_index 女生页面缓存
  25 +Default_Default_index 男生
No preview for this file type
No preview for this file type
@@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract @@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract
261 * 获取Session 261 * 获取Session
262 * 262 *
263 * @param string $name 名称 263 * @param string $name 名称
  264 + * @return mixed
264 */ 265 */
265 public function getSession($name) 266 public function getSession($name)
266 { 267 {
@@ -270,18 +271,25 @@ class AbstractAction extends Controller_Abstract @@ -270,18 +271,25 @@ class AbstractAction extends Controller_Abstract
270 /** 271 /**
271 * 获取当前登录的用户ID 272 * 获取当前登录的用户ID
272 * 273 *
  274 + * @param bool $useSession 是否使用Session会话
273 * @return int 275 * @return int
274 - * @todo  
275 */ 276 */
276 - protected function getUid() 277 + protected function getUid($useSession = false)
277 { 278 {
278 if (!$this->_uid) { 279 if (!$this->_uid) {
279 - $cookie = $this->getCookie('_UID');  
280 - if (!empty($cookie)) {  
281 - $cookieList = explode('::', $cookie);  
282 - if (isset($cookieList[1]) && is_numeric($cookieList[1])) {  
283 - $this->_uid = $cookieList[1];  
284 - $this->_uname = $cookieList[0]; 280 + // 从SESSION获取
  281 + if ($useSession) {
  282 + $this->_uid = $this->getSession('_UID');
  283 + }
  284 + // 从COOKIE获取
  285 + else {
  286 + $cookie = $this->getCookie('_UID');
  287 + if (!empty($cookie)) {
  288 + $cookieList = explode('::', $cookie);
  289 + if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
  290 + $this->_uid = $cookieList[1];
  291 + $this->_uname = $cookieList[0];
  292 + }
285 } 293 }
286 } 294 }
287 } 295 }
@@ -130,6 +130,24 @@ class UserData @@ -130,6 +130,24 @@ class UserData
130 } 130 }
131 131
132 /** 132 /**
  133 + * 取消收藏的商品数据
  134 + *
  135 + * @param int $uid 用户ID
  136 + * @param int $fav_id 要取消的收藏id
  137 + * @return array 接口返回的数据
  138 + */
  139 + public static function favoriteDelete($uid, $fav_id)
  140 + {
  141 + $param = Yohobuy::param();
  142 + $param['method'] = 'app.favorite.cancel';
  143 + $param['type'] = 'product';
  144 + $param['fav_id'] = $fav_id;
  145 + $param['client_secret'] = Sign::getSign($param);
  146 +
  147 + return Yohobuy::get(Yohobuy::API_URL, $param);
  148 + }
  149 +
  150 + /**
133 * YOHO币数据 151 * YOHO币数据
134 * 152 *
135 * @param int $uid 用户ID 153 * @param int $uid 用户ID
@@ -267,6 +285,24 @@ class UserData @@ -267,6 +285,24 @@ class UserData
267 } 285 }
268 286
269 /** 287 /**
  288 + * 删除地址
  289 + *
  290 + * @param int $uid 用户ID
  291 + * @param int $id 地址唯一标识符id
  292 + * @return array 接口返回的数据
  293 + */
  294 + public static function deleteAddress($uid, $id)
  295 + {
  296 + $param = Yohobuy::param();
  297 + $param['id'] = $id;
  298 + $param['method'] = 'app.address.del';
  299 + $param['uid'] = $uid;
  300 + $param['client_secret'] = Sign::getSign($param);
  301 +
  302 + return Yohobuy::get(Yohobuy::API_URL, $param);
  303 + }
  304 +
  305 + /**
270 * 意见反馈数据 306 * 意见反馈数据
271 * 307 *
272 * @param string $udid 客户端唯一标识 308 * @param string $udid 客户端唯一标识
@@ -133,14 +133,8 @@ class Images @@ -133,14 +133,8 @@ class Images
133 { 133 {
134 $images[$files['name']] = $files['tmp_name']; 134 $images[$files['name']] = $files['tmp_name'];
135 } 135 }
136 - if($_SERVER['HTTP_HOST'] != 'test.service.api.yohobuy.com') //代理转接  
137 - {  
138 - return self::agentCurlImage($images);  
139 - }  
140 - else  
141 - {  
142 - return self::uploadStreamImage($images);  
143 - } 136 +
  137 + return self::uploadStreamImage($images);
144 } 138 }
145 139
146 /** 140 /**
@@ -199,43 +193,6 @@ class Images @@ -199,43 +193,6 @@ class Images
199 } 193 }
200 } 194 }
201 195
202 - /**  
203 - * 代理上传图片  
204 - *  
205 - * @param array|string $files  
206 - * @return array  
207 - */  
208 - private static function agentCurlImage($file)  
209 - {  
210 - $ch = curl_init();  
211 - curl_setopt($ch, CURLOPT_HEADER, 0);  
212 - curl_setopt($ch, CURLOPT_VERBOSE, 0);  
213 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
214 - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");  
215 - curl_setopt($ch, CURLOPT_URL, 'http://test.service.api.yohobuy.com/sns/ajax/uploadimg');  
216 - curl_setopt($ch, CURLOPT_POST, true);  
217 - $params = array();  
218 - $files = is_array($file) ? $file : array($file);  
219 - foreach($files as $key => $name)  
220 - {  
221 - $key = is_numeric($key) ? $key.'.jpg' : $key;  
222 - $filename = dirname($name).'/'.$key;  
223 - rename($name, $filename);  
224 - if (@class_exists('\CURLFile'))  
225 - {  
226 - $params["images[$key]"] = new \CURLFile(realpath($filename));  
227 - }  
228 - else  
229 - {  
230 - $params["images[$key]"] = '@' . realpath($filename);  
231 - }  
232 - }  
233 - curl_setopt($ch, CURLOPT_POSTFIELDS, $params);  
234 - $response = json_decode(curl_exec($ch), true);  
235 - return $response['data'];  
236 -  
237 - }  
238 -  
239 /** 196 /**
240 * 获取模板的图片地址 197 * 获取模板的图片地址
241 * @param $fileName 198 * @param $fileName
@@ -112,7 +112,7 @@ orderHammer.on('tap', function(e) { @@ -112,7 +112,7 @@ orderHammer.on('tap', function(e) {
112 //Order delete 112 //Order delete
113 $.ajax({ 113 $.ajax({
114 type: 'GET', 114 type: 'GET',
115 - url: '/home/deleteOrder', 115 + url: '/home/delOrder',
116 data: { 116 data: {
117 id: id 117 id: id
118 }, 118 },
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="my-page yoho-page"> 2 <div class="my-page yoho-page">
3 <div class="my-header"> 3 <div class="my-header">
4 - <div class="user-info"> 4 + <div class="user-info"><!--/home/personaldetails-->
5 <img class="user-avatar" src="{{head_ico}}"> 5 <img class="user-avatar" src="{{head_ico}}">
6 <span class="username">{{profile_name}}</span> 6 <span class="username">{{profile_name}}</span>
7 {{#vip_info}} 7 {{#vip_info}}
@@ -11,11 +11,11 @@ @@ -11,11 +11,11 @@
11 </div> 11 </div>
12 </div> 12 </div>
13 <div class="my-link clearfix"> 13 <div class="my-link clearfix">
14 - <a class="link-item" href="/home/"> 14 + <a class="link-item" href="/home/favorite">
15 {{product_favorite_total}} 15 {{product_favorite_total}}
16 <p>收藏的商品</p> 16 <p>收藏的商品</p>
17 </a> 17 </a>
18 - <a class="link-item" href="/home/"> 18 + <a class="link-item" href="/home/favoritebrand">
19 {{brand_favorite_total}} 19 {{brand_favorite_total}}
20 <p>收藏的品牌</p> 20 <p>收藏的品牌</p>
21 </a> 21 </a>
@@ -54,26 +54,26 @@ @@ -54,26 +54,26 @@
54 </a> 54 </a>
55 </div> 55 </div>
56 <div class="group-list"> 56 <div class="group-list">
57 - <a class="list-item" href="/home/"> 57 + <a class="list-item" href="/home/coupons">
58 <span class="iconfont icon">&#xe63a;</span> 58 <span class="iconfont icon">&#xe63a;</span>
59 优惠券 59 优惠券
60 <span class="iconfont num">{{coupon_num}} &#xe604;</span> 60 <span class="iconfont num">{{coupon_num}} &#xe604;</span>
61 </a> 61 </a>
62 - <a class="list-item" href="/home/"> 62 + <a class="list-item" href="/home/currency">
63 <span class="iconfont icon">&#xe635;</span> 63 <span class="iconfont icon">&#xe635;</span>
64 YOHO 64 YOHO
65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span> 65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
66 </a> 66 </a>
67 </div> 67 </div>
68 <div class="group-list"> 68 <div class="group-list">
69 - <a class="list-item" href="/home/"> 69 + <a class="list-item" href="/home/message">
70 <span class="iconfont icon">&#xe636;</span> 70 <span class="iconfont icon">&#xe636;</span>
71 消息 71 消息
72 <span class="iconfont num">{{inbox_total}} &#xe604;</span> 72 <span class="iconfont num">{{inbox_total}} &#xe604;</span>
73 </a> 73 </a>
74 </div> 74 </div>
75 <div class="group-list"> 75 <div class="group-list">
76 - <a class="list-item" href="/home/"> 76 + <a class="list-item" href="/home/onlineService">
77 <span class="iconfont icon">&#xe63c;</span> 77 <span class="iconfont icon">&#xe63c;</span>
78 在线客服 78 在线客服
79 <span class="iconfont num">&#xe604;</span> 79 <span class="iconfont num">&#xe604;</span>
@@ -18,10 +18,27 @@ use LibModels\Wap\Home\OrderData; @@ -18,10 +18,27 @@ use LibModels\Wap\Home\OrderData;
18 class HomeController extends AbstractAction 18 class HomeController extends AbstractAction
19 { 19 {
20 20
  21 + protected $_uid;
  22 +
  23 +// /**
  24 +// * 初始化
  25 +// */
  26 +// public function init()
  27 +// {
  28 +// // 检查用户是否登录, 未登录则跳转到登录页
  29 +// $uid = $this->getUid(true);
  30 +// if (!$uid) {
  31 +// $this->go(Helpers::url('/signin.html'));
  32 +// }
  33 +//
  34 +// parent::init();
  35 +// }
  36 +
21 /** 37 /**
22 * 个人中心入口 38 * 个人中心入口
23 */ 39 */
24 - public function indexAction() { 40 + public function indexAction()
  41 + {
25 // 设置网站标题 42 // 设置网站标题
26 $this->setTitle('个人中心'); 43 $this->setTitle('个人中心');
27 $this->setNavHeader('个人中心', true, SITE_MAIN); 44 $this->setNavHeader('个人中心', true, SITE_MAIN);
@@ -30,7 +47,7 @@ class HomeController extends AbstractAction @@ -30,7 +47,7 @@ class HomeController extends AbstractAction
30 $uid = 8826435; 47 $uid = 8826435;
31 $data = \Index\UserModel::getUserProfileData($uid); 48 $data = \Index\UserModel::getUserProfileData($uid);
32 $data += \Index\UserModel::getInfoNumData($uid); 49 $data += \Index\UserModel::getInfoNumData($uid);
33 - 50 +
34 // 优选新品数据 51 // 优选新品数据
35 $channel = Helpers::getChannelByCookie(); 52 $channel = Helpers::getChannelByCookie();
36 $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel); 53 $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
@@ -45,131 +62,54 @@ class HomeController extends AbstractAction @@ -45,131 +62,54 @@ class HomeController extends AbstractAction
45 /** 62 /**
46 * 用户收藏的商品 63 * 用户收藏的商品
47 */ 64 */
48 - public function favoriteAction() { 65 + public function favoriteAction()
  66 + {
  67 + // 设置网站标题
  68 + $this->setTitle('我的收藏');
  69 + $this->setNavHeader('我的收藏', true, SITE_MAIN);
  70 +
49 $uid = $this->getUid(); 71 $uid = $this->getUid();
  72 + $uid = 8826435;
  73 + $gender = Helpers::getGenderByCookie();
50 74
51 $favProducts = \Index\UserModel::getFavProductData($uid); 75 $favProducts = \Index\UserModel::getFavProductData($uid);
52 -  
53 - //print_r($favProducts); 76 + $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
54 77
55 $this->_view->display('favorite', array( 78 $this->_view->display('favorite', array(
56 'favPage' => true, //加载js 79 'favPage' => true, //加载js
57 - 'pageHeader' => array(  
58 - 'navBack' => true,  
59 - 'navTitle' => '我的收藏',  
60 - 'navHome' => true  
61 - ),  
62 'pageFooter' => true, 80 'pageFooter' => true,
63 'favorite' => true, 81 'favorite' => true,
64 - 'hasFavProduct' => array(  
65 - '0' => array(  
66 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
67 - 'title' => 'adidas Originals ZX FLUXM22508 ',  
68 - 'price' => '¥800',  
69 - 'discountPrice' => false,  
70 - 'savePrice' => false,  
71 - 'sellOut' => true  
72 - ),  
73 - '1' => array(  
74 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
75 - 'title' => 'adidas Originals ZX FLUXM22508 ',  
76 - 'price' => '¥800',  
77 - 'discountPrice' => '¥500',  
78 - 'savePrice' => '¥300',  
79 - 'sellOut' => false  
80 - )  
81 - ),  
82 - 'hasFavBrand' => array(  
83 - '0' => array(  
84 - 'id' => '1',  
85 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
86 - 'brandName' => 'VANS',  
87 - 'update' => 12,  
88 - 'discount' => 10,  
89 - 'link' => '#',  
90 - 'productList' => array(  
91 - '0' => array(  
92 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
93 - 'price' => '¥240',  
94 - 'discount' => '¥240'  
95 - ),  
96 - '1' => array(  
97 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
98 - 'price' => '¥240',  
99 - 'discount' => '¥240'  
100 - ),  
101 - '2' => array(  
102 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
103 - 'price' => '¥240',  
104 - 'discount' => '¥240'  
105 - ),  
106 - '3' => array(  
107 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
108 - 'price' => '¥240',  
109 - 'discount' => '¥240'  
110 - )  
111 - )  
112 - ),  
113 - '1' => array(  
114 - 'id' => '2',  
115 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
116 - 'brandName' => 'VANS',  
117 - 'update' => 12,  
118 - 'discount' => 10,  
119 - 'link' => '#',  
120 - 'productList' => array(  
121 - '0' => array(  
122 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
123 - 'price' => '¥240',  
124 - 'discount' => '¥240'  
125 - ),  
126 - '1' => array(  
127 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
128 - 'price' => '¥240',  
129 - 'discount' => '¥240'  
130 - ),  
131 - '2' => array(  
132 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
133 - 'price' => '¥240',  
134 - 'discount' => '¥240'  
135 - ),  
136 - '3' => array(  
137 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
138 - 'price' => '¥240',  
139 - 'discount' => '¥240'  
140 - )  
141 - )  
142 - ),  
143 - '2' => array(  
144 - 'id' => '3',  
145 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
146 - 'brandName' => 'VANS',  
147 - 'update' => 12,  
148 - 'discount' => 10,  
149 - 'link' => '#',  
150 - 'productList' => array(  
151 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
152 - 'price' => '¥240',  
153 - 'discount' => false  
154 - )  
155 - )  
156 - ) 82 + 'hasFavProduct' => $favProducts,
  83 + 'hasFavBrand' => $favBrands
157 )); 84 ));
158 } 85 }
159 86
160 -  
161 /** 87 /**
162 * 用户收藏的商品-删除 88 * 用户收藏的商品-删除
163 */ 89 */
164 - public function favoriteDelAction() { 90 + public function favoriteDelAction()
  91 + {
  92 + $result = array();
165 93
166 - //$this->echoJson(); 94 + if ($this->isAjax()) {
  95 + $uid = $this->getUid();
  96 + $fav_id = $this->post('fav_id', 0);
  97 +
  98 + $result = \Index\UserModel::favoriteDelete($uid, $fav_id);
  99 + }
  100 +
  101 + if (empty($result)) {
  102 + echo ' ';
  103 + } else {
  104 + $this->echoJson($result);
  105 + }
167 } 106 }
168 107
169 /** 108 /**
170 * 用户收藏的品牌 109 * 用户收藏的品牌
171 */ 110 */
172 - public function favoritebrandAction() { 111 + public function favoritebrandAction()
  112 + {
173 $uid = $this->getUid(); 113 $uid = $this->getUid();
174 $gender = Helpers::getGenderByCookie(); 114 $gender = Helpers::getGenderByCookie();
175 115
@@ -181,7 +121,8 @@ class HomeController extends AbstractAction @@ -181,7 +121,8 @@ class HomeController extends AbstractAction
181 /** 121 /**
182 * 个人信息 122 * 个人信息
183 */ 123 */
184 - public function personalDetailsAction() { 124 + public function personalDetailsAction()
  125 + {
185 $this->setTitle('个人信息'); 126 $this->setTitle('个人信息');
186 $this->setNavHeader('个人信息', true, SITE_MAIN); 127 $this->setNavHeader('个人信息', true, SITE_MAIN);
187 128
@@ -195,12 +136,13 @@ class HomeController extends AbstractAction @@ -195,12 +136,13 @@ class HomeController extends AbstractAction
195 /** 136 /**
196 * YOHO币 137 * YOHO币
197 */ 138 */
198 - public function currencyAction() { 139 + public function currencyAction()
  140 + {
199 $this->setTitle('YOHO币'); 141 $this->setTitle('YOHO币');
200 $this->setNavHeader('YOHO币', true, false); 142 $this->setNavHeader('YOHO币', true, false);
201 143
202 // $uid = $this->getUid(); 144 // $uid = $this->getUid();
203 - $uid = 967016; 145 + $uid = 8826435;
204 $currency = \Index\UserModel::getYohoCoinData($uid); 146 $currency = \Index\UserModel::getYohoCoinData($uid);
205 147
206 $currency['pageFooter'] = true; 148 $currency['pageFooter'] = true;
@@ -210,7 +152,8 @@ class HomeController extends AbstractAction @@ -210,7 +152,8 @@ class HomeController extends AbstractAction
210 /** 152 /**
211 * 优惠券 153 * 优惠券
212 */ 154 */
213 - public function couponsAction() { 155 + public function couponsAction()
  156 + {
214 157
215 $this->setTitle('优惠券'); 158 $this->setTitle('优惠券');
216 $this->setNavHeader('优惠券', true, SITE_MAIN); 159 $this->setNavHeader('优惠券', true, SITE_MAIN);
@@ -221,19 +164,19 @@ class HomeController extends AbstractAction @@ -221,19 +164,19 @@ class HomeController extends AbstractAction
221 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), 164 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
222 'couponsPage' => true 165 'couponsPage' => true
223 ); 166 );
224 -  
225 $this->_view->display('coupons', $coupons); 167 $this->_view->display('coupons', $coupons);
226 } 168 }
227 169
228 /** 170 /**
229 * 我的消息 171 * 我的消息
230 */ 172 */
231 - public function messageAction() { 173 + public function messageAction()
  174 + {
232 // $uid = $this->getUid(); 175 // $uid = $this->getUid();
233 $page = $this->get('page', 0); 176 $page = $this->get('page', 0);
234 $size = $this->get('size', 10); 177 $size = $this->get('size', 10);
235 178
236 - $uid = 967016; 179 + $uid = 8826435;
237 $messages = \Index\UserModel::getMessageData($uid, $page, $size); 180 $messages = \Index\UserModel::getMessageData($uid, $page, $size);
238 181
239 print_r($messages); 182 print_r($messages);
@@ -242,13 +185,14 @@ class HomeController extends AbstractAction @@ -242,13 +185,14 @@ class HomeController extends AbstractAction
242 /** 185 /**
243 * 地址管理 186 * 地址管理
244 */ 187 */
245 - public function addressAction() { 188 + public function addressAction()
  189 + {
246 // 设置网站标题 190 // 设置网站标题
247 $this->setTitle('地址管理'); 191 $this->setTitle('地址管理');
248 $this->setNavHeader('地址管理', true, SITE_MAIN); 192 $this->setNavHeader('地址管理', true, SITE_MAIN);
249 193
250 // $uid = $this->getUid(); 194 // $uid = $this->getUid();
251 - $uid = 967016; 195 + $uid = 8826435;
252 196
253 $address = \Index\UserModel::getAddressData($uid); 197 $address = \Index\UserModel::getAddressData($uid);
254 $addressList = \Index\UserModel::getAddressListData($uid); 198 $addressList = \Index\UserModel::getAddressListData($uid);
@@ -266,12 +210,13 @@ class HomeController extends AbstractAction @@ -266,12 +210,13 @@ class HomeController extends AbstractAction
266 /** 210 /**
267 * 修改地址或者添加新地址 211 * 修改地址或者添加新地址
268 */ 212 */
269 - public function saveAddressAction() { 213 + public function saveAddressAction()
  214 + {
270 $result = array(); 215 $result = array();
271 216
272 if ($this->isAjax()) { 217 if ($this->isAjax()) {
273 // $uid = $this->getUid(); 218 // $uid = $this->getUid();
274 - $uid = 967016; 219 + $uid = 8826435;
275 $address = $this->post('address', ''); 220 $address = $this->post('address', '');
276 $area_code = $this->post('area_code', ''); 221 $area_code = $this->post('area_code', '');
277 $consignee = $this->post('consignee', ''); 222 $consignee = $this->post('consignee', '');
@@ -293,12 +238,13 @@ class HomeController extends AbstractAction @@ -293,12 +238,13 @@ class HomeController extends AbstractAction
293 /** 238 /**
294 * 设置默认地址 239 * 设置默认地址
295 */ 240 */
296 - public function defaultAddressAction() { 241 + public function defaultAddressAction()
  242 + {
297 $result = array(); 243 $result = array();
298 244
299 if ($this->isAjax()) { 245 if ($this->isAjax()) {
300 // $uid = $this->getUid(); 246 // $uid = $this->getUid();
301 - $uid = 967016; 247 + $uid = 8826435;
302 $id = $this->post('id', ''); 248 $id = $this->post('id', '');
303 249
304 $result = \Index\UserModel::setDefaultAddress($uid, $id); 250 $result = \Index\UserModel::setDefaultAddress($uid, $id);
@@ -311,8 +257,31 @@ class HomeController extends AbstractAction @@ -311,8 +257,31 @@ class HomeController extends AbstractAction
311 } 257 }
312 } 258 }
313 259
  260 + /**
  261 + * 删除地址
  262 + */
  263 + public function addressDelAction()
  264 + {
  265 + $result = array();
  266 +
  267 + if ($this->isAjax()) {
  268 + // $uid = $this->getUid();
  269 + $uid = 8826435;
  270 + $id = $this->post('id', '');
  271 +
  272 + $result = \Index\UserModel::deleteAddress($uid, $id);
  273 + }
  274 +
  275 + if (empty($result)) {
  276 + echo ' ';
  277 + } else {
  278 + $this->echoJson($result);
  279 + }
  280 + }
  281 +
314 //在线客服 282 //在线客服
315 - public function onlineServiceAction() { 283 + public function onlineServiceAction()
  284 + {
316 // 设置网站标题 285 // 设置网站标题
317 $this->setTitle('在线客服'); 286 $this->setTitle('在线客服');
318 $this->setNavHeader('在线客服', true, SITE_MAIN); 287 $this->setNavHeader('在线客服', true, SITE_MAIN);
@@ -327,7 +296,8 @@ class HomeController extends AbstractAction @@ -327,7 +296,8 @@ class HomeController extends AbstractAction
327 } 296 }
328 297
329 //在线客服-具体详情 298 //在线客服-具体详情
330 - public function onlineServiceDetailAction() { 299 + public function onlineServiceDetailAction()
  300 + {
331 $service = array(); 301 $service = array();
332 $cateId = $this->get('cateId', 0); 302 $cateId = $this->get('cateId', 0);
333 $cateName = $this->get('cateName', ''); 303 $cateName = $this->get('cateName', '');
@@ -342,14 +312,16 @@ class HomeController extends AbstractAction @@ -342,14 +312,16 @@ class HomeController extends AbstractAction
342 /** 312 /**
343 * 我的逛 313 * 我的逛
344 */ 314 */
345 - public function myGuangAction() { 315 + public function myGuangAction()
  316 + {
346 echo 'My Guang'; 317 echo 'My Guang';
347 } 318 }
348 319
349 /** 320 /**
350 * 意见反馈 321 * 意见反馈
351 */ 322 */
352 - public function suggestAction() { 323 + public function suggestAction()
  324 + {
353 // 设置网站标题 325 // 设置网站标题
354 $this->setTitle('意见反馈'); 326 $this->setTitle('意见反馈');
355 $this->setNavHeader('意见反馈', true, SITE_MAIN); 327 $this->setNavHeader('意见反馈', true, SITE_MAIN);
@@ -371,27 +343,28 @@ class HomeController extends AbstractAction @@ -371,27 +343,28 @@ class HomeController extends AbstractAction
371 /** 343 /**
372 * 意见反馈-提交表单页面 344 * 意见反馈-提交表单页面
373 */ 345 */
374 - public function suggestSubAction() {  
375 -  
376 - // 设置网站标题  
377 - $this->setTitle('反馈问题');  
378 -  
379 - $param = \Api\Yohobuy::param();  
380 - unset($param['private_key']);  
381 - $param['project'] = 'suggest';  
382 - $param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a';  
383 - $data = array(  
384 - 'suggestPage' => true, //加载js  
385 - 'pageHeader' => array(  
386 - 'navBack' => true,  
387 - 'navTitle' => '反馈问题',  
388 - 'navBtn' => '提交'  
389 - ),  
390 - 'param' => $param,  
391 - 'suggestSub' => true,  
392 - 'pageFooter' => true  
393 - );  
394 - //print_r($data); 346 + public function suggestSubAction()
  347 + {
  348 +
  349 + // 设置网站标题
  350 + $this->setTitle('反馈问题');
  351 +
  352 + $param = \Api\Yohobuy::param();
  353 + unset($param['private_key']);
  354 + $param['project'] = 'suggest';
  355 + $param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a';
  356 + $data = array(
  357 + 'suggestPage' => true, //加载js
  358 + 'pageHeader' => array(
  359 + 'navBack' => true,
  360 + 'navTitle' => '反馈问题',
  361 + 'navBtn' => '提交'
  362 + ),
  363 + 'param' => $param,
  364 + 'suggestSub' => true,
  365 + 'pageFooter' => true
  366 + );
  367 + //print_r($data);
395 368
396 $this->_view->display('suggest_sub', $data); 369 $this->_view->display('suggest_sub', $data);
397 } 370 }
@@ -399,19 +372,19 @@ class HomeController extends AbstractAction @@ -399,19 +372,19 @@ class HomeController extends AbstractAction
399 /** 372 /**
400 * 异步上传图片 373 * 异步上传图片
401 */ 374 */
402 - public function suggestimgUploadAction() {  
403 - if ($this->isAjax()) {  
404 - $filename = $this->get('filename', '');  
405 - $result = \Plugin\Images::saveImage($filename); 375 + public function suggestimgUploadAction()
  376 + {
  377 + $filename = $this->post('filename', '');
  378 + $result = \Index\UserModel::saveSuggestImg($filename);
406 379
407 - $this->echoJson($result);  
408 - } 380 + $this->echoJson($result);
409 } 381 }
410 382
411 /** 383 /**
412 * 异步保存意见反馈数据 384 * 异步保存意见反馈数据
413 */ 385 */
414 - public function savesuggestAction() { 386 + public function savesuggestAction()
  387 + {
415 if ($this->isAjax()) { 388 if ($this->isAjax()) {
416 $uid = $this->getUid(); 389 $uid = $this->getUid();
417 $content = $this->post('content', ''); 390 $content = $this->post('content', '');
@@ -425,7 +398,8 @@ class HomeController extends AbstractAction @@ -425,7 +398,8 @@ class HomeController extends AbstractAction
425 /** 398 /**
426 * 会员等级展示页 399 * 会员等级展示页
427 */ 400 */
428 - public function gradeAction() { 401 + public function gradeAction()
  402 + {
429 //设置网站seo信息 403 //设置网站seo信息
430 $this->setTitle('会员等级'); 404 $this->setTitle('会员等级');
431 //显示网站导航头部信息 405 //显示网站导航头部信息
@@ -444,7 +418,8 @@ class HomeController extends AbstractAction @@ -444,7 +418,8 @@ class HomeController extends AbstractAction
444 * 会员特权查看页 418 * 会员特权查看页
445 */ 419 */
446 420
447 - public function preferentialAction() { 421 + public function preferentialAction()
  422 + {
448 //设置网站seo信息 423 //设置网站seo信息
449 $this->setTitle('会员等级'); 424 $this->setTitle('会员等级');
450 //显示网站导航头部信息 425 //显示网站导航头部信息
@@ -461,7 +436,8 @@ class HomeController extends AbstractAction @@ -461,7 +436,8 @@ class HomeController extends AbstractAction
461 * 我的订单页面 436 * 我的订单页面
462 */ 437 */
463 438
464 - public function orderAction() { 439 + public function orderAction()
  440 + {
465 //获得type值 441 //获得type值
466 $type = $this->get('type', 1); 442 $type = $this->get('type', 1);
467 $this->setTitle('我的订单'); 443 $this->setTitle('我的订单');
@@ -481,7 +457,8 @@ class HomeController extends AbstractAction @@ -481,7 +457,8 @@ class HomeController extends AbstractAction
481 } 457 }
482 458
483 //ajax请求订单页面 459 //ajax请求订单页面
484 - public function getOrdersAction() { 460 + public function getOrdersAction()
  461 + {
485 //判断是不是ajax请求 462 //判断是不是ajax请求
486 if (!$this->isAjax()) { 463 if (!$this->isAjax()) {
487 $this->error(); 464 $this->error();
@@ -515,28 +492,31 @@ class HomeController extends AbstractAction @@ -515,28 +492,31 @@ class HomeController extends AbstractAction
515 * 我的订单-取消订单 492 * 我的订单-取消订单
516 */ 493 */
517 494
518 - public function cancelOrderAction() { 495 + public function cancelOrderAction()
  496 + {
519 497
520 //判断是不是ajax请求 498 //判断是不是ajax请求
521 if (!$this->isAjax()) { 499 if (!$this->isAjax()) {
522 $this->error(); 500 $this->error();
523 } 501 }
524 //传入order_code和uid以取消订单 502 //传入order_code和uid以取消订单
525 - $order_code = $this->get('id'); 503 + $order_code = $this->get('orderCode');
526 $uid = $this->getUid(); 504 $uid = $this->getUid();
527 $uid = '10267443'; //测试用 505 $uid = '10267443'; //测试用
528 $gender = Helpers::getGenderByCookie(); 506 $gender = Helpers::getGenderByCookie();
529 $yh_channel = $this->get('yh_channel', 1); 507 $yh_channel = $this->get('yh_channel', 1);
530 $method = 'app.SpaceOrders.close'; 508 $method = 'app.SpaceOrders.close';
531 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); 509 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
532 - $this->echoJson($data); 510 +
  511 + $this->echoJson($data);
533 } 512 }
534 513
535 /* 514 /*
536 * 我的订单-删除订单 515 * 我的订单-删除订单
537 */ 516 */
538 517
539 - public function delOrderAction() { 518 + public function delOrderAction()
  519 + {
540 //判断是不是ajax请求 520 //判断是不是ajax请求
541 if (!$this->isAjax()) { 521 if (!$this->isAjax()) {
542 $this->error(); 522 $this->error();
@@ -549,33 +529,14 @@ class HomeController extends AbstractAction @@ -549,33 +529,14 @@ class HomeController extends AbstractAction
549 $yh_channel = $this->get('yh_channel', 1); 529 $yh_channel = $this->get('yh_channel', 1);
550 $method = 'app.SpaceOrders.delOrderByCode'; 530 $method = 'app.SpaceOrders.delOrderByCode';
551 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); 531 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
552 - if ($data['code'] == 200) {  
553 - $arr = array();  
554 - $arr['code'] = $data['code'];  
555 - $arr['message'] = $data['message'];  
556 - echo json_encode($arr);  
557 - }  
558 - }  
559 -  
560 - /**  
561 - * 付款  
562 - */  
563 - public function getPaymentAction() {  
564 - $contentCode = $this->get('content_code');  
565 - $contentCode = '04cf5abaa7c20178325a07c4a833782c';  
566 - $gender = Helpers::getGenderByCookie();  
567 - $yh_channel = $this->get('yh_channel', 1);  
568 - $data = OrderData::getPaymentData($contentCode, $gender, $yh_channel);  
569 - //print_r($data);  
570 - if ($data['code'] == 200) {  
571 -  
572 - } 532 + $this->echoJson($data);
573 } 533 }
574 534
575 /** 535 /**
576 * 订单详情页 536 * 订单详情页
577 */ 537 */
578 - public function orderDetailAction() { 538 + public function orderDetailAction()
  539 + {
579 $data = array( 540 $data = array(
580 'name' => '毛毛莉Lydia', 541 'name' => '毛毛莉Lydia',
581 'phoneNum' => '18600001133', 542 'phoneNum' => '18600001133',
1 <?php 1 <?php
2 2
3 -namespace home; 3 +namespace Home;
4 4
5 use LibModels\Wap\Home\GradeData; 5 use LibModels\Wap\Home\GradeData;
6 -use Action\AbstractAction;  
7 use Plugin\Helpers; 6 use Plugin\Helpers;
8 7
9 /** 8 /**
@@ -15,7 +14,8 @@ class GradeModel @@ -15,7 +14,8 @@ class GradeModel
15 * 获取个人中心-会员等级数据 14 * 获取个人中心-会员等级数据
16 */ 15 */
17 16
18 - public static function getGrade($gender, $channel, $uid) { 17 + public static function getGrade($gender, $channel, $uid)
  18 + {
19 $result = array(); 19 $result = array();
20 20
21 if (USE_CACHE) { 21 if (USE_CACHE) {
@@ -28,41 +28,41 @@ class GradeModel @@ -28,41 +28,41 @@ class GradeModel
28 //调用接口获取数据 28 //调用接口获取数据
29 $data = GradeData::getGradeData($gender, $channel, $uid); 29 $data = GradeData::getGradeData($gender, $channel, $uid);
30 30
31 - if (!empty($data['grade'])) {  
32 - switch (intval($data['grade']['current_vip_level'])) {  
33 - case 0://普通会员  
34 - $result['vipGrade']['vip0'] = true;  
35 - break;  
36 - case 1://银卡会员  
37 - $result['vipGrade']['vip1'] = true;  
38 - break;  
39 - case 2://金卡会员  
40 - $result['vipGrade']['vip2'] = true;  
41 - break;  
42 - case 3://白金会员  
43 - $result['vipGrade']['vip3'] = true;  
44 - break;  
45 - }  
46 -  
47 - //今年总消费  
48 - $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];  
49 - //升级下一等级会员的进度;  
50 - $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));  
51 - //距离升级所需消费金额  
52 -  
53 - if ($data['grade']['current_vip_level'] != 3) {  
54 - $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];  
55 - }  
56 - //消费总计  
57 - $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];  
58 - //username 调用获取用户基本信息数据,获得username;  
59 - //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);  
60 - $result['vipGrade']['name'] = $data['userProfile']['username'];  
61 - //跳转url(会员特权详情)  
62 - $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);  
63 - //当前vip等级享受的特权  
64 - $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];  
65 - } 31 + if (!empty($data['grade'])) {
  32 + switch (intval($data['grade']['current_vip_level'])) {
  33 + case 0://普通会员
  34 + $result['vipGrade']['vip0'] = true;
  35 + break;
  36 + case 1://银卡会员
  37 + $result['vipGrade']['vip1'] = true;
  38 + break;
  39 + case 2://金卡会员
  40 + $result['vipGrade']['vip2'] = true;
  41 + break;
  42 + case 3://白金会员
  43 + $result['vipGrade']['vip3'] = true;
  44 + break;
  45 + }
  46 +
  47 + //今年总消费
  48 + $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
  49 + //升级下一等级会员的进度;
  50 + $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
  51 + //距离升级所需消费金额
  52 +
  53 + if ($data['grade']['current_vip_level'] != 3) {
  54 + $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
  55 + }
  56 + //消费总计
  57 + $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
  58 + //username 调用获取用户基本信息数据,获得username;
  59 + //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
  60 + $result['vipGrade']['name'] = $data['userProfile']['username'];
  61 + //跳转url(会员特权详情)
  62 + $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
  63 + //当前vip等级享受的特权
  64 + $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
  65 + }
66 66
67 if (USE_CACHE) { 67 if (USE_CACHE) {
68 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 68 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
@@ -82,7 +82,8 @@ class GradeModel @@ -82,7 +82,8 @@ class GradeModel
82 * 获取个人中心-会员特权详情页 82 * 获取个人中心-会员特权详情页
83 */ 83 */
84 84
85 - public function getPreferential($channel, $uid) { 85 + public function getPreferential($channel, $uid)
  86 + {
86 $result = array(); 87 $result = array();
87 88
88 if (USE_CACHE) { 89 if (USE_CACHE) {
@@ -59,7 +59,11 @@ class UserModel @@ -59,7 +59,11 @@ class UserModel
59 foreach ($infoNumData['data'] as &$val) { 59 foreach ($infoNumData['data'] as &$val) {
60 empty($val) && $val = 0; 60 empty($val) && $val = 0;
61 } 61 }
  62 +
62 $result = $infoNumData['data']; 63 $result = $infoNumData['data'];
  64 +
  65 + // 默认没有返回用户地址的数据,添加这块儿数据
  66 + $result['address_num'] = count(self::getAddressData($uid));
63 } 67 }
64 68
65 return $result; 69 return $result;
@@ -150,7 +154,19 @@ class UserModel @@ -150,7 +154,19 @@ class UserModel
150 154
151 // 处理用户收藏的商品数据 155 // 处理用户收藏的商品数据
152 if (isset($favProduct['data']) && !empty($favProduct['data'])) { 156 if (isset($favProduct['data']) && !empty($favProduct['data'])) {
153 - $result = $favProduct['data']; 157 + $product = array();
  158 + foreach ($favProduct['data']['product_list'] as $val) {
  159 + $product = array();
  160 + $product['imgUrl'] = $val['image'];
  161 + $product['title'] = $val['product_name'];
  162 + $product['price'] = '¥'.$val['market_price'];
  163 + $product['discountPrice'] = '¥'.$val['sales_price'];
  164 + $product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) : false;
  165 + $product['sellOut'] = boolval($val['price_down']);
  166 +
  167 + $result[] = $product;
  168 + }
  169 +
154 } 170 }
155 171
156 return $result; 172 return $result;
@@ -172,7 +188,43 @@ class UserModel @@ -172,7 +188,43 @@ class UserModel
172 188
173 // 处理用户收藏的品牌数据 189 // 处理用户收藏的品牌数据
174 if (isset($favBrand['data']) && !empty($favBrand['data'])) { 190 if (isset($favBrand['data']) && !empty($favBrand['data'])) {
175 - $result = $favBrand['data']; 191 + $brand = array();
  192 + foreach ($favBrand['data']['brand_list'] as $val) {
  193 + $brand = array();
  194 + $brand['id'] = $val['brand_id'];
  195 + $brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
  196 + $brand['brandName'] = $val['brand_name'];
  197 + $brand['update'] = $val['new_product_num'];
  198 + $brand['discount'] = $val['product_discount_num'];
  199 + $brand['link'] = '#';
  200 +
  201 + // 处理品牌产品
  202 + $product = array();
  203 + foreach ($val['new_product'] as $one) {
  204 + $product = array();
  205 + $product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
  206 + $product['price'] = '¥'.$one['market_price'];
  207 + $product['discount'] = '¥'.$one['sales_price'];
  208 +
  209 + $brand['productList'][] = $product;
  210 + }
  211 +
  212 + $result[] = $brand;
  213 + }
  214 + }
  215 +
  216 + return $result;
  217 + }
  218 +
  219 + public static function favoriteDelete($uid, $fav_id)
  220 + {
  221 + $result = array();
  222 +
  223 + if (empty($fav_id)) {
  224 + $result['code'] = 400;
  225 + $result['message'] = '取消的商品不可用';
  226 + } else {
  227 + $result = UserData::favoriteDelete($uid, $fav_id);
176 } 228 }
177 229
178 return $result; 230 return $result;
@@ -336,6 +388,27 @@ class UserModel @@ -336,6 +388,27 @@ class UserModel
336 } 388 }
337 389
338 /** 390 /**
  391 + * 删除地址
  392 + *
  393 + * @param int $uid 用户ID
  394 + * @param int $id 地址唯一标识符id
  395 + * @return array|mixed 处理之后的返回数据
  396 + */
  397 + public static function deleteAddress($uid, $id)
  398 + {
  399 + $result = array('code' => 400, 'message' => '错误');
  400 +
  401 + // 调用接口删除地址
  402 + $address = UserData::deleteAddress($uid, $id);
  403 + // 处理返回结果
  404 + if ($address && isset($address['code'])) {
  405 + $result = $address;
  406 + }
  407 +
  408 + return $result;
  409 + }
  410 +
  411 + /**
339 * 处理意见反馈数据 412 * 处理意见反馈数据
340 * 413 *
341 * @param string $udid 客户端唯一标识 414 * @param string $udid 客户端唯一标识
@@ -370,6 +443,25 @@ class UserModel @@ -370,6 +443,25 @@ class UserModel
370 } 443 }
371 444
372 /** 445 /**
  446 + * 图片上传
  447 + *
  448 + * @return array|mixed 保存意见反馈数据之后的返回
  449 + */
  450 + public static function saveSuggestImg($filename)
  451 + {
  452 + $result = array();
  453 +
  454 + if (!isset($_FILES[$filename])) {
  455 + $result['code'] = 400;
  456 + $result['message'] = '文件上传错误';
  457 + } else {
  458 + $result = Images::saveImage($filename);
  459 + }
  460 +
  461 + return $result;
  462 + }
  463 +
  464 + /**
373 * 保存意见反馈数据 465 * 保存意见反馈数据
374 * 466 *
375 * @param int $uid 用户ID 467 * @param int $uid 用户ID
1 <?php 1 <?php
2 2
3 -namespace home; 3 +namespace Home;
4 4
5 use LibModels\Wap\Home\OnlineData; 5 use LibModels\Wap\Home\OnlineData;
6 -use Action\AbstractAction;  
7 use Plugin\Helpers; 6 use Plugin\Helpers;
8 7
9 /** 8 /**
@@ -20,13 +19,10 @@ class OnlineModel @@ -20,13 +19,10 @@ class OnlineModel
20 $cateInfo = $res['data']; 19 $cateInfo = $res['data'];
21 $question = array(); 20 $question = array();
22 $tab = array(); 21 $tab = array();
23 - if ($cateInfo)  
24 - {  
25 - foreach ($cateInfo as $key => $value)  
26 - { 22 + if ($cateInfo) {
  23 + foreach ($cateInfo as $key => $value) {
27 //强制截成3个tab 24 //强制截成3个tab
28 - if ($key > 2)  
29 - { 25 + if ($key > 2) {
30 break; 26 break;
31 } 27 }
32 $tab[$key]['tabid'] = 'tab' . $value['id']; 28 $tab[$key]['tabid'] = 'tab' . $value['id'];
@@ -37,12 +33,10 @@ class OnlineModel @@ -37,12 +33,10 @@ class OnlineModel
37 $question[$key]['current'] = (!$key) ? TRUE : FALSE; 33 $question[$key]['current'] = (!$key) ? TRUE : FALSE;
38 $sub = $value['sub']; 34 $sub = $value['sub'];
39 $qTmp = array(); 35 $qTmp = array();
40 - if ($sub)  
41 - {  
42 - foreach ($sub as $sk => $sv)  
43 - { 36 + if ($sub) {
  37 + foreach ($sub as $sk => $sv) {
44 $qTmp[$sk]['title'] = $sv['category_name']; 38 $qTmp[$sk]['title'] = $sv['category_name'];
45 - $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name']; 39 + $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'] . '&cateName=' . $sv['category_name'];
46 } 40 }
47 } 41 }
48 $question[$key]['list'] = $qTmp; 42 $question[$key]['list'] = $qTmp;
@@ -64,19 +58,15 @@ class OnlineModel @@ -64,19 +58,15 @@ class OnlineModel
64 public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone') 58 public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone')
65 { 59 {
66 $result = array(); 60 $result = array();
67 - if (!$cateId)  
68 - { 61 + if (!$cateId) {
69 return $result; 62 return $result;
70 } 63 }
71 $res = OnlineData::getOnlineServiceDetail($cateId, $clinetType); 64 $res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
72 $questionInfo = $res['data']; 65 $questionInfo = $res['data'];
73 - if ($questionInfo)  
74 - { 66 + if ($questionInfo) {
75 $list = array(); 67 $list = array();
76 - if ($questionInfo)  
77 - {  
78 - foreach ($questionInfo as $qk => $qv)  
79 - { 68 + if ($questionInfo) {
  69 + foreach ($questionInfo as $qk => $qv) {
80 $list[$qk]['q'] = $qv['title']; 70 $list[$qk]['q'] = $qv['title'];
81 $list[$qk]['a'] = $qv['content']; 71 $list[$qk]['a'] = $qv['content'];
82 } 72 }