Choice.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Choice extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->_model("Model_logic_order","logic_order");
  6. }
  7. //定义方法的调用规则 获取URI第二段值
  8. public function _remap($arg,$arg_array)
  9. {
  10. if($arg == 'Choices')
  11. {
  12. $this->_Choices($arg_array);
  13. }
  14. else if($arg == 'check_pm_sku')
  15. {
  16. $this->_checkCkpmAndSku();
  17. }
  18. else
  19. {
  20. $this->_Choice($arg);
  21. }
  22. }
  23. // public function _Choice($arg)//查找重复
  24. // {
  25. // $this->data['arg'] = $arg;
  26. // $this->_Template('choice',$this->data);
  27. // }
  28. public function _Choice($arg)//查找重复
  29. {
  30. $this->load->driver('cache');
  31. $cache_key = 'choice_page_' . $arg;
  32. $cached = $this->cache->get($cache_key);
  33. if ($cached !== FALSE) {
  34. echo $cached;
  35. exit;
  36. }
  37. $this->data['arg'] = $arg;
  38. ob_start();
  39. $this->_Template('choice', $this->data);
  40. $html = ob_get_clean();
  41. $this->cache->save($cache_key, $html, 3600); // 缓存1小时
  42. echo $html;
  43. }
  44. public function _Choices($arg){
  45. }
  46. public function _checkCkpmAndSku(){
  47. $fpdata = $this->input->post('fpdata', TRUE);
  48. $shipremarks = $this->input->post('shipremarks', TRUE);
  49. $r = $this->logic_order->checkCkpmAndSku($fpdata,$shipremarks);
  50. echo json_encode($r,JSON_UNESCAPED_UNICODE);
  51. }
  52. }