123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /**
- * MpAdReportLogModel.php UTF-8
- *
- *
- * @date : 2021-04-06 11:39
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @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']);
- }
- }
|