* @version : HUOSDK 9.0 */ namespace huomp\model\weixin; use huo\model\game\GameModel; use huo\model\member\MemberModel; use huo\model\user\UserModel; class MpAdReportLogModel extends CommonModel { protected $name = 'mpad_report_log'; protected $pk = 'id'; /* 开启自动写入时间戳字段 */ protected $autoWriteTimestamp = 'create_time'; protected $type = [ 'id' => 'integer', 'agent_id' => 'integer', 'mem_id' => 'integer', 'app_id' => 'integer', 'mg_mem_id' => 'integer', 'server_id' => 'string', 'role_id' => 'string', 'advertiser_app_id' => 'string', 'source_id' => 'string', 'url' => 'string', 'action_type' => 'string', 'action_time' => 'integer', 'wechat_app_id' => 'string', 'wechat_openid' => 'string', 'action_param_value' => 'string', 'action_param_source' => 'string', 'action_param_claim_type' => 'integer', 'create_time' => 'integer', ]; /** * 添加数据 * * @param array $data 需要添加的数据 * * @return false|int 添加失败返回 false 添加成功 返回添加的ID */ public function addData($data) { $_data = $data; $_id = parent::addData($_data); if (false === $_id) { return false; } /* TAG缓存操作 */ return $_id; } public function agent() { return $this->belongsTo(UserModel::class, 'agent_id')->field(['id', 'user_login', 'user_nicename']); } public function mem() { return $this->belongsTo(MemberModel::class, 'mem_id')->field(['id', 'username']); } public function game() { return $this->belongsTo(GameModel::class, 'app_id')->field(['id', 'name']); } }