MpConfAgentModel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. class MpConfAgentModel extends CommonModel {
  14. protected $table = 'mp_conf_agent';
  15. protected $pk = 'id';
  16. /* 开启自动写入时间戳字段 */
  17. protected $cache_key_prefix = '';
  18. protected $type
  19. = [
  20. 'id' => 'integer',
  21. 'conf_id' => 'integer',
  22. 'app_id' => 'integer',
  23. 'agent_id' => 'integer',
  24. 'advertiser_conf_id' => 'integer',
  25. 'create_time' => 'integer',
  26. 'update_time' => 'integer',
  27. ];
  28. public function conf() {
  29. return $this->belongsTo(MpConfModel::class, 'conf_id', 'id');
  30. }
  31. public function getInfoByConfAgent($conf_id, $agent_id) {
  32. $_map = [
  33. 'conf_id' => $conf_id,
  34. 'agent_id' => $agent_id,
  35. ];
  36. $_data = $this->where($_map)->find();
  37. if (is_object($_data)) {
  38. $_data->toArray();
  39. }
  40. return $_data;
  41. }
  42. }