ReservationConfigAction.class.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维p2p借贷系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class ReservationConfigAction extends CommonAction{
  10. //预约配置信息
  11. public function index()
  12. {
  13. $region_tree = M("RegionConf")->where("region_level<3")->findAll();
  14. $region_tree = D("RegionConf")->toTree($region_tree);
  15. $this->assign("region_tree",$region_tree);
  16. $reservation_config = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='RESERVATION_CONFIG'");
  17. if(!$reservation_config){
  18. $value['name'] = '';//人物姓名
  19. $value['wanna_count'] = 0;//想见人数
  20. $value['seen_count'] = 0;//见过人数
  21. $value['head_image'] = '';//人物头像
  22. $value['desc'] = '';//人物简介
  23. $value['content'] = '';//人物详细信息
  24. $value['region'] = '';//约见区域
  25. $value['security'] = '';//预约保障
  26. $value = serialize($value);
  27. $GLOBALS['db']->query("insert into ".DB_PREFIX."conf VALUES('','RESERVATION_CONFIG','".$value."',0,0,'',0,0,0)");
  28. $reservation_config = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='RESERVATION_CONFIG'");
  29. }
  30. $reservation_config = unserialize($reservation_config['value']);
  31. $this->assign("reservation_config",$reservation_config);
  32. $this->display ();
  33. }
  34. //预约配置信息保存
  35. public function update() {
  36. $reservation_config = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='RESERVATION_CONFIG'");
  37. $value = unserialize($reservation_config['value']);
  38. $value['name'] = $_REQUEST['name'];
  39. $value['head_image'] = $_REQUEST['head_image'];
  40. $value['desc'] = $_REQUEST['desc'];
  41. $value['content'] = $_REQUEST['content'];
  42. $value['region'] = $_REQUEST['region'];
  43. $value['security'] = $_REQUEST['security'];
  44. $reservation_config['value'] = serialize($value);
  45. $list = M("Conf")->save ($reservation_config);
  46. if (false !== $list) {
  47. //成功提示
  48. //save_log("预约配置信息".L("UPDATE_SUCCESS"),1);
  49. $this->success(L("UPDATE_SUCCESS"));
  50. } else {
  51. //错误提示
  52. $this->error(L("UPDATE_FAILED"),0,"预约配置信息".L("UPDATE_FAILED"));
  53. }
  54. }
  55. }
  56. ?>