2
0

my_lesson_update.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. require_once "../config.php";
  3. require_once "../public/_pdo.php";
  4. require_once '../public/function.php';
  5. global $PDO;
  6. PDO_Connect(""._FILE_DB_COURSE_);
  7. $query="SELECT course_id from lesson where id = ? ";
  8. $course_id = PDO_FetchOne($query,array($_POST["lesson"]));
  9. $query="UPDATE course SET receive_time= ? , modify_time= ? where id = ? ";
  10. PDO_Execute($query,array(mTime(),mTime(),$course_id));
  11. $query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ? , attachment = ?, receive_time= ? , modify_time= ? where id = ? ";
  12. $sth = $PDO->prepare($query);
  13. $data = strtotime($_POST["lesson_date"]);
  14. $time = strtotime($_POST["lesson_time"]) - strtotime("today");
  15. $timezone = $_POST["lesson_timezone"];
  16. $datatime = ($data+$time+$timezone*60)*1000;
  17. $duration = strtotime($_POST["duration"]) - strtotime("today");
  18. $sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] , $_POST["teacher"] , $_POST["attachment"] , mTime() , mTime() , $_POST["lesson"]));
  19. $respond=array("status"=>0,"message"=>"");
  20. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  21. $error = PDO_ErrorInfo();
  22. $respond['status']=1;
  23. $respond['message']=$error[2];
  24. $respond["status"]= 1;
  25. }
  26. else{
  27. $respond['status']=0;
  28. $respond['message']="成功";
  29. }
  30. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  31. ?>