123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace huo\model\rate;
- use huo\model\common\CommonModel;
- use huolib\constant\CacheConst;
- use think\Cache;
- class AgentGameRateModel extends CommonModel {
- protected $name = 'agent_game_rate';
-
- protected $autoWriteTimestamp = true;
- protected $agent_cache_tag = CacheConst::TAG_AGENT_GAME_LIST;
-
- public function addData($data) {
- if (empty($data)) {
- return false;
- }
- if ($_obj = self::create($data, true)) {
- Cache::clear($this->agent_cache_tag);
- return true;
- } else {
- return false;
- }
- }
-
- public function updateData($data, $ag_id) {
- $_map['ag_id'] = $ag_id;
- $_data = $data;
- $_rs = self::update($_data, $_map, true);
- if (false == $_rs) {
- return false;
- } else {
- Cache::clear($this->agent_cache_tag);
- return true;
- }
- }
-
- public function getInfoByGameAgent($app_id, $agent_id) {
- $_map['app_id'] = $app_id;
- $_map['agent_id'] = $agent_id;
- $_info = $this->where($_map)->find();
- if (false === $_info) {
- return false;
- }
- if (is_object($_info)) {
- return $_info->toArray();
- } else {
- return $_info;
- }
- }
-
- public function getAgIdsByAgentBenefitType($agent_benefit_type) {
- $_map = [
- 'agent_benefit_type' => $agent_benefit_type
- ];
- return $this->where($_map)->column('ag_id');
- }
- }
|