Merge branch 'feature/balanceSwitch' into gray
Showing
5 changed files
with
68 additions
and
3 deletions
@@ -295,6 +295,26 @@ class AbstractAction extends Controller_Abstract | @@ -295,6 +295,26 @@ class AbstractAction extends Controller_Abstract | ||
295 | } | 295 | } |
296 | 296 | ||
297 | /** | 297 | /** |
298 | + * 直接查询缓存,不对key做任何处理 | ||
299 | + * | ||
300 | + * @param string $key 键名 | ||
301 | + * @param bool $isMaster 控制是到主服务器取,还是到从服务器取缓存 | ||
302 | + * @return mixed | ||
303 | + */ | ||
304 | + protected function getCacheBy($key, $isMaster = true) | ||
305 | + { | ||
306 | + if (!USE_CACHE) { | ||
307 | + return false; | ||
308 | + } | ||
309 | + | ||
310 | + if ($isMaster) { | ||
311 | + return Cache::getBy($key, 'master'); | ||
312 | + } else { | ||
313 | + return Cache::getBy($key, 'slave'); | ||
314 | + } | ||
315 | + } | ||
316 | + | ||
317 | + /** | ||
298 | * 设置Session | 318 | * 设置Session |
299 | * | 319 | * |
300 | * @param string $name 名称 | 320 | * @param string $name 名称 |
@@ -339,6 +339,22 @@ class WebAction extends Controller_Abstract | @@ -339,6 +339,22 @@ class WebAction extends Controller_Abstract | ||
339 | } | 339 | } |
340 | 340 | ||
341 | /** | 341 | /** |
342 | + * 直接查询缓存,不对key做任何处理 | ||
343 | + * | ||
344 | + * @param string $key 键名 | ||
345 | + * @param bool $isMaster 控制是到主服务器取,还是到从服务器取缓存 | ||
346 | + * @return mixed | ||
347 | + */ | ||
348 | + protected function getCacheBy($key, $isMaster = true) | ||
349 | + { | ||
350 | + if ($isMaster) { | ||
351 | + return Cache::getBy($key, 'master'); | ||
352 | + } else { | ||
353 | + return Cache::getBy($key, 'slave'); | ||
354 | + } | ||
355 | + } | ||
356 | + | ||
357 | + /** | ||
342 | * 设置Session | 358 | * 设置Session |
343 | * | 359 | * |
344 | * @param string $name 名称 | 360 | * @param string $name 名称 |
@@ -975,6 +975,17 @@ class HomeController extends AbstractAction | @@ -975,6 +975,17 @@ class HomeController extends AbstractAction | ||
975 | $this->error(); | 975 | $this->error(); |
976 | } | 976 | } |
977 | 977 | ||
978 | + // 如果新版开启,则跳到新版支付页 | ||
979 | + /*if ($this->getCacheBy('zookeeper:/wap/pay/newPay') === 'true') { | ||
980 | + header('Location: ' . Helpers::url('/home/orders/paynew', | ||
981 | + array( | ||
982 | + 'order_code' => $orderCode, | ||
983 | + 'refer' => $this->server('HTTP_REFERER', SITE_MAIN) | ||
984 | + )) | ||
985 | + ); | ||
986 | + exit(); | ||
987 | + }*/ | ||
988 | + | ||
978 | /* 判断订单信息是否存在 */ | 989 | /* 判断订单信息是否存在 */ |
979 | $orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession); | 990 | $orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession); |
980 | if (empty($orderDetail)) { | 991 | if (empty($orderDetail)) { |
@@ -48,6 +48,17 @@ class IndexController extends AbstractAction | @@ -48,6 +48,17 @@ class IndexController extends AbstractAction | ||
48 | 48 | ||
49 | public function indexAction() | 49 | public function indexAction() |
50 | { | 50 | { |
51 | + | ||
52 | + // 如果新版开启,则跳到新版购物车 | ||
53 | + if ($this->getCacheBy('zookeeper:/wap/pay/newCart') === 'true') { | ||
54 | + header('Location: ' . Helpers::url('/cart/index/new', | ||
55 | + array( | ||
56 | + 'refer' => $this->server('HTTP_REFERER', SITE_MAIN) | ||
57 | + )) | ||
58 | + ); | ||
59 | + exit(); | ||
60 | + } | ||
61 | + | ||
51 | $this->setTitle('购物车'); | 62 | $this->setTitle('购物车'); |
52 | //$this->setNavHeader('购物车', true, ''); | 63 | //$this->setNavHeader('购物车', true, ''); |
53 | // 显示底部TAB | 64 | // 显示底部TAB |
@@ -189,8 +189,15 @@ routes.cart.route.action = Orderdetail | @@ -189,8 +189,15 @@ routes.cart.route.action = Orderdetail | ||
189 | ;routes.weixinapi.route.action = Weixinapi | 189 | ;routes.weixinapi.route.action = Weixinapi |
190 | 190 | ||
191 | ; 支付中心 (微信中配置的目录) | 191 | ; 支付中心 (微信中配置的目录) |
192 | -routes.pay.type = "rewrite" | ||
193 | -routes.pay.match = "/home/orders/pay$" | 192 | +routes.pay.type = "regex" |
193 | +routes.pay.match = "#^/home/orders/pay#" | ||
194 | routes.pay.route.module = Index | 194 | routes.pay.route.module = Index |
195 | routes.pay.route.controller = Home | 195 | routes.pay.route.controller = Home |
196 | -routes.pay.route.action = Pay | ||
196 | +routes.pay.route.action = Pay | ||
197 | + | ||
198 | +; 支付中心 (微信中配置的目录) | ||
199 | +routes.newcart.type = "rewrite" | ||
200 | +routes.newcart.match = "/cart/index/new/orderEnsure$" | ||
201 | +routes.newcart.route.module = Cart | ||
202 | +routes.newcart.route.controller = Index | ||
203 | +routes.newcart.route.action = orderEnsure |
-
Please register or login to post a comment