You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

53 lines
1.6 KiB

  1. <?php
  2. /*
  3. Author:ZSQ
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. //if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. //$USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
  10. $dateTime=isset($_GET['dateTime'])?$_GET['dateTime']:'';
  11. $productID=isset($_GET['productID'])?$_GET['productID']:'';
  12. $user_id=getUserId();
  13. if ($user_id ===false){
  14. echo json_encode(array("errcode"=>1,"errinfo"=>"用户未登录"));
  15. exit;
  16. }
  17. $pdo=conn();
  18. $sql="CALL HT_GET_CALENDAR_INFO_BY_DATE('".$dateTime."',{$productID})";
  19. $result=$pdo->query($sql);
  20. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  21. $data = array();
  22. //if(strlen(trim($USER_ID))<=0){
  23. // $data['code']='1';
  24. // $data['info']='未登录';
  25. //}else{
  26. $data['code']='0';
  27. $data['info']='';
  28. $row_temp = array();
  29. if( count($rowset) > 0) {
  30. foreach( $rowset as $row_info ) {
  31. $row_temp[$row_info["dateTime"]] = $row_info;
  32. }
  33. }
  34. $empty_common_array = array("buyPrice" => "", "retailPrice" => "", "distributionPrice" => "","switchStyle" => "","buyStyle" => "", "totalCount" => "","saleCount" => "","buy_type_id" => "","can_sale" => "144");
  35. $max_days = date("t", strtotime($_GET['dateTime']."-01"));
  36. for( $day_temp = 1; $day_temp <= $max_days; $day_temp++) {
  37. $index_day = $_GET['dateTime'].sprintf("-%02d", $day_temp );
  38. if( isset($row_temp[$index_day]) ) {
  39. $data['calender_Info'][] = $row_temp[$index_day];
  40. } else {
  41. $empty_array = $empty_common_array;
  42. $empty_array["dateTime"] = $index_day;
  43. $data['calender_Info'][] = $empty_array;
  44. }
  45. }
  46. // $data['calender_Info']=$rowset;
  47. //}
  48. echo json_encode($data);
  49. exit();