Authored by yangyang

修改订单为空时,写入随便逛逛地址

@@ -147,19 +147,20 @@ class HomeController extends AbstractAction @@ -147,19 +147,20 @@ class HomeController extends AbstractAction
147 $currency = \Index\UserModel::getYohoCoinData($uid); 147 $currency = \Index\UserModel::getYohoCoinData($uid);
148 148
149 $this->setTitle('优惠券'); 149 $this->setTitle('优惠券');
150 - $this->setNavHeader('优惠券', true, SITE_MAIN);  
151 - // $uid = $this->getUid();  
152 - $uid = 8826435;  
153 - $coupons = array(  
154 - 'couponsUrl' => array(  
155 - \Index\UserModel::getCouponData($uid, 0),  
156 - \Index\UserModel::getCouponData($uid, 1),  
157 - ),  
158 - 'couponsPage' => true  
159 - );  
160 - 150 + $this->setNavHeader('优惠券', true, SITE_MAIN);
  151 + // $uid = $this->getUid();
  152 + $uid = 8826435;
  153 + $coupons = array(
  154 + 'couponsUrl' => array(
  155 + \Index\UserModel::getCouponData($uid, 0),
  156 + \Index\UserModel::getCouponData($uid, 1),
  157 + ),
  158 + 'couponsPage' => true
  159 + );
  160 +
161 $this->_view->display('coupons', $coupons); 161 $this->_view->display('coupons', $coupons);
162 } 162 }
  163 +
163 /** 164 /**
164 * 优惠券 165 * 优惠券
165 */ 166 */
@@ -204,8 +205,8 @@ class HomeController extends AbstractAction @@ -204,8 +205,8 @@ class HomeController extends AbstractAction
204 // $uid = $this->getUid(); 205 // $uid = $this->getUid();
205 $uid = 967016; 206 $uid = 967016;
206 207
207 - $address = \Index\UserModel::getAddressData($uid);  
208 - $addressList = \Index\UserModel::getAddressListData($uid); 208 + $address = \Index\UserModel::getAddressData($uid);
  209 + $addressList = \Index\UserModel::getAddressListData($uid);
209 210
210 // print_r($address); 211 // print_r($address);
211 212
@@ -213,61 +214,57 @@ class HomeController extends AbstractAction @@ -213,61 +214,57 @@ class HomeController extends AbstractAction
213 'addressPage' => true, 214 'addressPage' => true,
214 'pageFooter' => true, 215 'pageFooter' => true,
215 'address' => $address, 216 'address' => $address,
216 - 'addressList' => $addressList 217 + 'addressList' => $addressList
217 )); 218 ));
218 } 219 }
219 220
220 - /**  
221 - * 修改地址或者添加新地址  
222 - */  
223 - public function saveAddressAction()  
224 - {  
225 - $result = array();  
226 -  
227 - if ($this->isAjax()) {  
228 - // $uid = $this->getUid();  
229 - $uid = 967016;  
230 - $address = $this->post('address', '');  
231 - $area_code = $this->post('area_code', '');  
232 - $consignee = $this->post('consignee', '');  
233 - $email = $this->post('email', '');  
234 - $id = $this->post('id', null);  
235 - $mobile = $this->post('mobile', '');  
236 - $zip_code = $this->post('zip_code', '');  
237 -  
238 - $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);  
239 - }  
240 -  
241 - if (empty($result)) {  
242 - echo ' ';  
243 - } else {  
244 - $this->echoJson($result);  
245 - }  
246 -  
247 - }  
248 -  
249 - /**  
250 - * 设置默认地址  
251 - */  
252 - public function defaultAddressAction()  
253 - {  
254 - $result = array();  
255 -  
256 - if ($this->isAjax()) {  
257 - // $uid = $this->getUid();  
258 - $uid = 967016;  
259 - $id = $this->post('id', '');  
260 -  
261 - $result = \Index\UserModel::setDefaultAddress($uid, $id);  
262 - }  
263 -  
264 - if (empty($result)) {  
265 - echo ' ';  
266 - } else {  
267 - $this->echoJson($result);  
268 - }  
269 -  
270 - } 221 + /**
  222 + * 修改地址或者添加新地址
  223 + */
  224 + public function saveAddressAction() {
  225 + $result = array();
  226 +
  227 + if ($this->isAjax()) {
  228 + // $uid = $this->getUid();
  229 + $uid = 967016;
  230 + $address = $this->post('address', '');
  231 + $area_code = $this->post('area_code', '');
  232 + $consignee = $this->post('consignee', '');
  233 + $email = $this->post('email', '');
  234 + $id = $this->post('id', null);
  235 + $mobile = $this->post('mobile', '');
  236 + $zip_code = $this->post('zip_code', '');
  237 +
  238 + $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
  239 + }
  240 +
  241 + if (empty($result)) {
  242 + echo ' ';
  243 + } else {
  244 + $this->echoJson($result);
  245 + }
  246 + }
  247 +
  248 + /**
  249 + * 设置默认地址
  250 + */
  251 + public function defaultAddressAction() {
  252 + $result = array();
  253 +
  254 + if ($this->isAjax()) {
  255 + // $uid = $this->getUid();
  256 + $uid = 967016;
  257 + $id = $this->post('id', '');
  258 +
  259 + $result = \Index\UserModel::setDefaultAddress($uid, $id);
  260 + }
  261 +
  262 + if (empty($result)) {
  263 + echo ' ';
  264 + } else {
  265 + $this->echoJson($result);
  266 + }
  267 + }
271 268
272 //在线客服 269 //在线客服
273 public function onlineServiceAction() { 270 public function onlineServiceAction() {
@@ -289,8 +286,7 @@ class HomeController extends AbstractAction @@ -289,8 +286,7 @@ class HomeController extends AbstractAction
289 $service = array(); 286 $service = array();
290 $cateId = $this->get('cateId', 0); 287 $cateId = $this->get('cateId', 0);
291 $cateName = $this->get('cateName', ''); 288 $cateName = $this->get('cateName', '');
292 - if ($cateId > 0)  
293 - { 289 + if ($cateId > 0) {
294 $service = home\OnlineModel::getOnlineServiceDetail($cateId); 290 $service = home\OnlineModel::getOnlineServiceDetail($cateId);
295 } 291 }
296 $this->setTitle('在线客服'); 292 $this->setTitle('在线客服');
@@ -412,11 +408,17 @@ class HomeController extends AbstractAction @@ -412,11 +408,17 @@ class HomeController extends AbstractAction
412 $uid = '7566245'; //测试用 408 $uid = '7566245'; //测试用
413 //调用模型层getOrder方法获得并处理数据 409 //调用模型层getOrder方法获得并处理数据
414 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 410 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
  411 + //如果没有订单数据,就给一个随便逛逛链接
  412 + $order = array();
  413 + if (!empty($data)) {
  414 + $order['orders'] = $data;
  415 + } else {
  416 + $order['walkwayUrl'] = 'http://www.baidu.com';
  417 + }
  418 +
415 //渲染模板 419 //渲染模板
416 $this->_view->display('order', array( 420 $this->_view->display('order', array(
417 - 'order' => array(  
418 - 'orders' => $data  
419 - ) 421 + 'order' => $order
420 )); 422 ));
421 } 423 }
422 424
@@ -39,7 +39,7 @@ class OrderModel @@ -39,7 +39,7 @@ class OrderModel
39 foreach ($data['data']['order_list'] as $key => $vo) { 39 foreach ($data['data']['order_list'] as $key => $vo) {
40 //订单号,支付状态,订单商品数量,订单总价格 40 //订单号,支付状态,订单商品数量,订单总价格
41 $result[$key]['orderNum'] = $vo['order_code']; 41 $result[$key]['orderNum'] = $vo['order_code'];
42 - $result[$key]['tradingStatus'] = $vo['status_str']; 42 + $result[$key]['orderStatus'] = $vo['status_str'];
43 $result[$key]['count'] = count($vo['order_goods']); 43 $result[$key]['count'] = count($vo['order_goods']);
44 $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost']; 44 $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
45 //订单商品列表数据 45 //订单商品列表数据