Manage.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace Demand\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. /**
  7. * 更新需求信息
  8. *
  9. * @return mixed
  10. */
  11. public function demandUpdate($id, $name, $data)
  12. {
  13. # 更新分类id
  14. $category = Dever::param('category', $data);
  15. if ($category) {
  16. $array = explode(',', $category);
  17. $category_id = end($array);
  18. $update['category_id'] = $category_id;
  19. $update['where_id'] = $id;
  20. Dever::db('demand/info')->update($update);
  21. }
  22. }
  23. /**
  24. * 更新需求属性信息
  25. *
  26. * @return mixed
  27. */
  28. public function attrUpdate($id, $name, $data)
  29. {
  30. print_r($data);die;
  31. foreach ($data as $k => $v) {
  32. }
  33. }
  34. /**
  35. * 显示需求信息
  36. *
  37. * @return mixed
  38. */
  39. public function demandInfo($id)
  40. {
  41. $info = Dever::db('demand/info')->one($id);
  42. if ($info) {
  43. $table['需求编号'] = $info['id'];
  44. $table['需求标题'] = $info['name'];
  45. $table['需求分类'] = Dever::load("category/api.string", $info['category']);
  46. if ($info['pic_cover']) {
  47. $table['封面图'] = '<img src="'.$info['pic_cover'].'" width="150" />';
  48. }
  49. $table['信息服务费'] = '无';
  50. if ($info['view_price'] > 0) {
  51. $table['信息服务费'] = $info['view_price'] . '元';
  52. }
  53. if ($info['poster_uid'] > 0) {
  54. $user = Dever::load('passport/user-one', $info['poster_uid']);
  55. $table['创建人'] = $user['username'] . '(UID:'.$info['poster_uid'].')';
  56. if ($poster_pay_type == 1) {
  57. //$table['支付状态'] = '';
  58. }
  59. }
  60. /*
  61. if ($info['area']) {
  62. $table['地区'] = Dever::load("area/api.string", $info['area']);
  63. }
  64. $method = $type . 'Load';
  65. //$this->$method($info, $table);
  66. */
  67. if ($info['cdate']) {
  68. $table['发布时间'] = date("Y-m-d H:i:s", $info['cdate']);
  69. }
  70. }
  71. return Dever::table($table);
  72. }
  73. # 根据type 显示不同的字段
  74. private function houseLoad($info, &$table)
  75. {
  76. if ($info['price_type'] == 1) {
  77. $price_type = '元';
  78. } else {
  79. $price_type = '万';
  80. }
  81. $table['价格'] = $info['price'] . $price_type;
  82. }
  83. public function area($id, $name, $data)
  84. {
  85. # 不再执行syncone等后续操作
  86. Dever::config('base')->after = 1;
  87. $type = Dever::input('type');
  88. $area = Dever::param('area', $data);
  89. if ($area) {
  90. if (isset($area[2])) {
  91. $update['district_id'] = $area[2];
  92. }
  93. if (isset($area[1])) {
  94. $update['city_id'] = $area[1];
  95. }
  96. if (isset($area[0])) {
  97. $update['province_id'] = $area[0];
  98. }
  99. if (isset($update)) {
  100. $update['where_id'] = $id;
  101. Dever::db($type . '/info')->update($update);
  102. }
  103. }
  104. }
  105. }