public function execute($request) { global $priv; $user = Sp_Account_User::current(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $province = Sp_City_City::getProvince(); $view = new Sp_View(); $userInfo = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status')); $auth = array('mobile_status' => $userInfo['mobile_status'], 'email_status' => $userInfo['email_status']); $view->assign('province', $province); $view->assign('action', $priv); $view->assign('auth', $auth); if (!empty($userInfo['province'])) { $city = Sp_City_City::getChlidById($userInfo['province']); $view->assign('city', $city); } if (!empty($userInfo['city'])) { $arrea = Sp_City_City::getChlidById($userInfo['city']); $view->assign('arrea', $arrea); } $view->assign('uploadInfo', $uploadInfo); $view->display("account/index.html"); }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $activit_end = $request->activit_end; //活动结束时间 $activit_start = $request->activit_start; //活动开始时间 $address = $request->address; //详细地址 $arrea = $request->arrea; //区域 $city = $request->city; //城市 $enroll_end = $request->enroll_end; $enroll_start = $request->enroll_start; $is_audit = $request->is_audit; $is_enroll = $request->is_enroll; //是否需要审核 $province = $request->province; //省份 $title = $request->title; //标题 $thumbnail = $request->thumbnail; $enroll_num = $request->enroll_num; if (!is_numeric($id) || empty($title) || empty($activit_end) || empty($activit_end) || empty($address) || empty($province) || empty($city)) { return array('status' => '-5', 'msg' => '参数错误'); } if (!empty($is_enroll) && (empty($is_audit) || empty($enroll_start) || empty($enroll_end))) { return array('status' => '-5', 'msg' => '完善活动时间选项'); } if (strtotime($activit_end) < strtotime($activit_start)) { return array('status' => '-5', 'msg' => '举办结束日期不能小于开始日期'); } $user = Sp_Account_User::current(); $active = array(); $active['activit_end'] = strtotime($activit_end); $active['activit_start'] = strtotime($activit_start); $active['address'] = $address; $active['arrea'] = empty($arrea) ? 0 : $arrea; $active['city'] = $city; $active['province'] = $province; $active['title'] = $title; $active['user_id'] = $user->id; $active['thumbnail'] = $thumbnail; if (!empty($is_audit)) { if (strtotime($enroll_end) < strtotime($enroll_start)) { return array('status' => '-5', 'msg' => '报名结束日期不能小于开始日期'); } if (!is_numeric($enroll_num)) { return array('status' => '-5', 'msg' => '人数不能为空'); } $active['is_audit'] = 1; $active['is_enroll'] = 1; $active['enroll_start'] = strtotime($enroll_start); $active['enroll_end'] = strtotime($enroll_end); $active['enroll_num'] = $enroll_num; } else { $active['is_audit'] = 0; $active['is_enroll'] = 0; $active['enroll_start'] = 0; $active['enroll_end'] = 0; $active['enroll_num'] = 0; } $user = Sp_Account_User::current(); $ret = Sp_Active_Active::updateById($id, $active, $user->id); return array('status' => '0', 'msg' => '修改成功'); // if($ret){ // // }else{ // return array('status'=>'-1','msg'=>'修改失败'); // } } else { $aid = $request->id; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $province = Sp_City_City::getProvince(); $city = Sp_City_City::getChlidById($active['province']); $arrea = Sp_City_City::getChlidById($active['city']); $view = new Sp_View(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $view->assign('province', $province); $view->assign('city', $city); $view->assign('arrea', $arrea); $view->assign('uploadInfo', $uploadInfo); $view->assign('option', 'edit'); $view->assign('active', $active); $view->display("active/create.html"); } }