LaoyuAction.class.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 LaoyuAction 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. $laoyu_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='LAOYU_INFO'");
  17. if(!$laoyu_info){
  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 = serialize($value);
  26. $GLOBALS['db']->query("insert into ".DB_PREFIX."conf VALUES('','LAOYU_INFO','".$value."',0,0,'',0,0,0)");
  27. $laoyu_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='LAOYU_INFO'");
  28. }
  29. $laoyu_info = unserialize($laoyu_info['value']);
  30. //$laoyu_info['region'] = implode(',',$laoyu_info['region']);
  31. $this->assign("laoyu_info",$laoyu_info);
  32. $this->display ();
  33. }
  34. //老余个人信息保存
  35. public function update() {
  36. $laoyu_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='LAOYU_INFO'");
  37. $value = unserialize($laoyu_info['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. $laoyu_info['value'] = serialize($value);
  44. $list = M("Conf")->save ($laoyu_info);
  45. if (false !== $list) {
  46. //成功提示
  47. //save_log("老余个人信息".L("UPDATE_SUCCESS"),1);
  48. $this->success(L("UPDATE_SUCCESS"));
  49. } else {
  50. //错误提示
  51. $this->error(L("UPDATE_FAILED"),0,"老余个人信息".L("UPDATE_FAILED"));
  52. }
  53. }
  54. //老余个人信息
  55. public function security()
  56. {
  57. $security = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='DATE_SECURITY'");
  58. if(!$security){
  59. $GLOBALS['db']->query("insert into ".DB_PREFIX."conf VALUES('','DATE_SECURITY','',0,0,'',0,0,0)");
  60. $security = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='DATE_SECURITY'");
  61. }
  62. $this->assign("security",$security);
  63. $this->display ();
  64. }
  65. //约见保障保存
  66. public function security_update(){
  67. $security = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."conf where `name`='DATE_SECURITY'");
  68. $security['value'] = $_REQUEST['value'];
  69. $list = M("Conf")->save ($security);
  70. if (false !== $list) {
  71. //成功提示
  72. //save_log("约见保障".L("UPDATE_SUCCESS"),1);
  73. $this->success(L("UPDATE_SUCCESS"));
  74. } else {
  75. //错误提示
  76. $this->error(L("UPDATE_FAILED"),0,"老余个人信息".L("UPDATE_FAILED"));
  77. }
  78. }
  79. }
  80. ?>