require_once ykfile("source/model/user_model.php"); require_once ykfile('source/activity_service.php'); $param = json_decode(file_get_contents('php://input')); $state = $param->state ? $param->state : ActivityModel::state_published; $param->state = $state; $user = new UserModel(); $user->uuid = unserialize($_SESSION['current_user'])->uuid; $param->author = $user; date_default_timezone_set("Asia/Shanghai"); $now_time = date("Y-m-d H:i:s"); $param->modify_time = $now_time; $param->isdelete = 0; $param->longitude = 0; $param->latitude = 0; if (!$param->position) { $param->position = 0; } $actsrv = new ActivityService(); $result = $actsrv->save_activity($param); $status = NULL; $message = NULL; if ($result !== false) { $status = 0; $message = "发布成功,请等待审核"; $act = $result; } else { $status = ERR_INTERNAL; $message = "发布失败"; $act = $param; } echo json_encode(array("status" => $status, "message" => $message, "activity" => $act));
$act->seo_title = $seo_title; $act->thumbnail = $thumbnail; $act->seo_alt = $seo_alt; $act->state = 2; // state 0:待审核, 1:驳回, 2:发布 $act->author->uuid = @$_SESSION['current_user']->uuid; $act->start_time = $start_time; $act->end_time = $end_time; $act->address = $address; $act->modify_time = $now_time; $act->seo_keywords = $seo_keywords; $act->holder = $holder; $act->is_delete = 0; //0:不删除 1:删除 $activitySer = new ActivityService(); $result = $activitySer->save_activity($act); if ($result) { echo "保存成功"; } function getUuid() { $str = md5(uniqid(mt_rand(), true)); $uuid = substr($str, 0, 8) . '-'; $uuid .= substr($str, 8, 4) . '-'; $uuid .= substr($str, 12, 4) . '-'; $uuid .= substr($str, 16, 4) . '-'; $uuid .= substr($str, 20, 12); return $uuid; } // 上传图片 function upload_img($file_upload_name)