price.inc.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. //门店列表
  3. global $_GPC, $_W;
  4. $GLOBALS['frames'] = $this->getMainMenu2();
  5. $seller_id=$_COOKIE["storeid"];
  6. $cur_store = $this->getStoreById($seller_id);
  7. //echo 111;die;
  8. $uniacid=$_W['uniacid'];
  9. $version=$_W['current_module']['version'];
  10. if($_GPC['ac']=='getDate'){
  11. $start = $_GPC['start'];
  12. $end = $_GPC['end'];
  13. $btime = strtotime($start);
  14. $etime = strtotime($end);
  15. //print_r($_GPC);
  16. $days = ceil(($etime - $btime) / 86400);
  17. $pagesize = 9;
  18. $totalpage = ceil($days / $pagesize);
  19. $page = intval($_GPC['page']);
  20. if ($page > $totalpage) {
  21. $page = $totalpage;
  22. } else if ($page <= 1) {
  23. $page = 1;
  24. }
  25. $currentindex = ($page - 1) * $pagesize;
  26. $start = date('Y-m-d', strtotime(date('Y-m-d') . "+$currentindex day"));
  27. $btime = strtotime($start);
  28. $etime = strtotime(date('Y-m-d', strtotime("$start +$pagesize day")));
  29. $date_array = array();
  30. $date_array[0]['date'] = $start;
  31. $date_array[0]['day'] = date('j', $btime);
  32. $date_array[0]['time'] = $btime;
  33. $date_array[0]['month'] = date('m', $btime);
  34. for ($i = 1; $i <= $pagesize; $i++) {
  35. $date_array[$i]['time'] = $date_array[$i - 1]['time'] + 86400;
  36. $date_array[$i]['date'] = date('Y-m-d', $date_array[$i]['time']);
  37. $date_array[$i]['day'] = date('j', $date_array[$i]['time']);
  38. $date_array[$i]['month'] = date('m', $date_array[$i]['time']);
  39. }
  40. $list=pdo_fetchall("select * from ".tablename('zh_jdgjb_room')." where `uniacid`='$uniacid' and seller_id= '$seller_id' order by id desc");
  41. foreach ($list as $key => $value) {
  42. $rid=$value['id'];
  43. $pricearr=array();
  44. for($i = 0; $i <= $pagesize; $i++){
  45. $dateday1=$date_array[$i]['time'];
  46. $rplist=pdo_get('zh_jdgjb_roomprice',array('dateday'=>$dateday1,'rid'=>$rid));
  47. //print_r($rplist);
  48. if($rplist['id']){
  49. $pricearr[$i]['mprice']=$rplist['mprice'];
  50. $pricearr[$i]['rid']=$value['id'];
  51. $pricearr[$i]['pid']=$rplist['id'];
  52. $pricearr[$i]['dateday']=date('Y-m-d', $date_array[$i]['time']);
  53. }else{
  54. $pricearr[$i]['mprice']=$value['price'];
  55. $pricearr[$i]['dateday']=date('Y-m-d', $date_array[$i]['time']);
  56. $pricearr[$i]['rid']=$value['id'];
  57. }
  58. }
  59. $list[$key]['pricearr']=$pricearr;
  60. }
  61. $data = array();
  62. $data['result'] = 1;
  63. ob_start();
  64. include $this->template('web/roompricelist');
  65. $data['code'] = ob_get_contents();
  66. ob_clean();
  67. die(json_encode($data));
  68. }
  69. $startime = time();
  70. $firstday = date('Y-m-01', time());
  71. $endtime = strtotime(date('Y-m-d', strtotime("$firstday +1 month +10 day")));
  72. include $this->template('web/price');