MpConfExtModel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * MpConfExtModel.php UTF-8
  4. *
  5. *
  6. * @date : 2021-03-08 11:13
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 9.0
  11. */
  12. namespace huomp\model\weixin;
  13. use huolib\constant\CommonConst;
  14. class MpConfExtModel extends CommonModel {
  15. protected $table = 'mp_conf_ext';
  16. protected $pk = 'conf_id';
  17. /* 开启自动写入时间戳字段 */
  18. protected $cache_key_prefix = '';
  19. protected $type
  20. = [
  21. 'conf_id' => 'integer',
  22. 'is_advertiser' => 'integer',
  23. 'create_time' => 'integer',
  24. 'update_time' => 'integer',
  25. ];
  26. public function conf() {
  27. return $this->belongsTo(MpConfModel::class, 'conf_id', 'id');
  28. }
  29. public function getAdvertiserList() {
  30. $_list = $this->with('conf')
  31. ->where(['is_advertiser' => CommonConst::STATUS_YES])
  32. ->select();
  33. if (is_object($_list)) {
  34. $_list = $_list->toArray();
  35. }
  36. $_new_list = [];
  37. foreach ($_list as $item) {
  38. $_new_list[$item['conf_id']] = $item['conf']['wx_name'];
  39. }
  40. return $_new_list;
  41. }
  42. }