* @version : HUOSDK 9.0 */ namespace huomp\model\weixin; use huolib\constant\CommonConst; class MpConfExtModel extends CommonModel { protected $table = 'mp_conf_ext'; protected $pk = 'conf_id'; /* 开启自动写入时间戳字段 */ protected $cache_key_prefix = ''; protected $type = [ 'conf_id' => 'integer', 'is_advertiser' => 'integer', 'create_time' => 'integer', 'update_time' => 'integer', ]; public function conf() { return $this->belongsTo(MpConfModel::class, 'conf_id', 'id'); } public function getAdvertiserList() { $_list = $this->with('conf') ->where(['is_advertiser' => CommonConst::STATUS_YES]) ->select(); if (is_object($_list)) { $_list = $_list->toArray(); } $_new_list = []; foreach ($_list as $item) { $_new_list[$item['conf_id']] = $item['conf']['wx_name']; } return $_new_list; } }