MpAdSourceModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * MpAdSourceModel.php UTF-8
  4. *
  5. *
  6. * @date : 2021-03-08 11:47
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 9.0
  11. */
  12. namespace huomp\model\weixin;
  13. class MpAdSourceModel extends CommonModel {
  14. protected $table = 'mp_ad_source';
  15. protected $pk = 'id';
  16. /* 开启自动写入时间戳字段 */
  17. protected $cache_key_prefix = '';
  18. protected $type
  19. = [
  20. 'id' => 'integer',
  21. 'conf_id' => 'integer',
  22. 'type' => 'string',
  23. 'name' => 'string',
  24. 'description' => 'string',
  25. 'advertiser_conf_id' => 'integer',
  26. 'source_id' => 'string',
  27. 'create_time' => 'integer',
  28. 'update_time' => 'integer',
  29. ];
  30. public function getInfoByConfType($conf_id, $agent_id, $advertiser_conf_id, $type = 'WECHAT_MINI_PROGRAM') {
  31. $_map = [
  32. 'conf_id' => $conf_id,
  33. 'agent_id' => $agent_id,
  34. 'type' => $type,
  35. 'advertiser_conf_id' => $advertiser_conf_id
  36. ];
  37. $_data = $this->where($_map)
  38. ->find();
  39. if (is_object($_data)) {
  40. $_data = $_data->toArray();
  41. }
  42. return $_data;
  43. }
  44. }