SignRewordModel.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * SignRewordModel.php UTF-8
  4. *
  5. *
  6. * @date : 2018/5/4 19:45
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\model\sign;
  13. use huo\model\common\CommonModel;
  14. class SignRewordModel extends CommonModel {
  15. protected $name = 'sign_reward_week';
  16. //设置只读字段
  17. // 开启自动写入时间戳字段
  18. protected $autoWriteTimestamp = true;
  19. public function addConf($data) {
  20. if (empty($data)) {
  21. return false;
  22. }
  23. if ($_obj = self::create($data, true)) {
  24. return $_obj->id;
  25. } else {
  26. return false;
  27. }
  28. }
  29. /**
  30. * @return array|false|\PDOStatement|string|\think\Collection
  31. */
  32. public function getConf() {
  33. $_field = 'id,sign_days,integral,icon,name,desc';
  34. $_data = $this->field($_field)->order('sign_days asc')->column($_field, 'sign_days');
  35. return $_data;
  36. }
  37. /**
  38. * 更新游戏
  39. *
  40. * @param array $conf_data
  41. * @param int $sc_id
  42. *
  43. * @return bool
  44. */
  45. public function updateConf($conf_data, $sc_id) {
  46. $_map['id'] = $sc_id;
  47. $_data = $conf_data;
  48. $_rs = self::update($_data, $_map, true);
  49. if (false == $_rs) {
  50. return false;
  51. } else {
  52. return true;
  53. }
  54. }
  55. }