Manage.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Attr\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. /**
  7. * 更新属性信息
  8. *
  9. * @return mixed
  10. */
  11. public function update($id, $name, $data)
  12. {
  13. foreach ($data as $k => $v) {
  14. if (isset($data[$k . '_s']) && isset($data[$k . '_e'])) {
  15. $temp = explode(',', $v);
  16. if (isset($temp[0])) {
  17. $update[$k . '_s'] = $temp[0];
  18. }
  19. if (isset($temp[1])) {
  20. $update[$k . '_e'] = $temp[1];
  21. }
  22. }
  23. }
  24. if (isset($update)) {
  25. $update['where_id'] = $id;
  26. Dever::db($name)->update($update);
  27. }
  28. }
  29. /**
  30. * 更新属性信息
  31. *
  32. * @return mixed
  33. */
  34. public function infoUpdate($id, $name, $data)
  35. {
  36. $is_sell = Dever::param('is_sell', $data);
  37. if ($is_sell > 1) {
  38. $update['type'] = 11;
  39. }
  40. if (isset($update)) {
  41. $update['where_id'] = $id;
  42. Dever::db('attr/info')->update($update);
  43. }
  44. }
  45. }