| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 | 
							- <?php
 
- /**
 
-  * UnusualMemModel.php  UTF-8
 
-  * 异常玩家记录
 
-  *
 
-  * @date    : 2018/10/23 18:04
 
-  *
 
-  * @license 这不是一个自由软件,未经授权不许任何使用和传播。
 
-  * @author  : chenbingling <cbl@huosdk.com>
 
-  * @version : HuoMP 1.0
 
-  */
 
- namespace huomp\model\member;
 
- use huo\controller\member\MemCache;
 
- use huolib\constant\MemConst;
 
- use huomp\model\common\CommonModel;
 
- class UnusualMemModel extends CommonModel {
 
-     protected $table = 'mp_unusual_mem';
 
-     // 开启自动写入时间戳字段
 
-     protected $autoWriteTimestamp = true;
 
-     /**
 
-      * 添加数据
 
-      *
 
-      * @param $data
 
-      *
 
-      * @return bool
 
-      */
 
-     public function addData($data) {
 
-         if (empty($data)) {
 
-             return false;
 
-         }
 
-         $_data = $data;
 
-         $_obj = self::create($_data, true);
 
-         if ($_obj) {
 
-             return true;
 
-         }
 
-         return false;
 
-     }
 
-     /**
 
-      * 更新数据
 
-      *
 
-      * @param array $data 数据
 
-      * @param int   $id   ID
 
-      *
 
-      * @return bool
 
-      */
 
-     public function updateData($data, $id) {
 
-         $_map['id'] = $id;
 
-         $_data = $data;
 
-         $_rs = self::update($_data, $_map, true);
 
-         if (false == $_rs) {
 
-             return false;
 
-         }
 
-         return true;
 
-     }
 
-     /**
 
-      * 更新数据
 
-      *
 
-      * @param array $data     数据
 
-      * @param int   $agent_id 渠道id
 
-      *
 
-      * @return bool
 
-      */
 
-     public function updateDataByAgentId($data, $agent_id) {
 
-         $_map['agent_id'] = $agent_id;
 
-         $_data = $data;
 
-         $_rs = self::update($_data, $_map, true);
 
-         if (false == $_rs) {
 
-             return false;
 
-         }
 
-         return true;
 
-     }
 
-     /**
 
-      * 通过agent_id 获取信息
 
-      *
 
-      * @param $agent_id
 
-      *
 
-      * @return array
 
-      */
 
-     public function getDataByAgentId($agent_id) {
 
-         $_rdata = $this->where(['agent_id' => $agent_id])->find();
 
-         if (!empty($_rdata)) {
 
-             $_rdata = $_rdata->toArray();
 
-         }
 
-         return $_rdata;
 
-     }
 
-     /**
 
-      * 删除记录
 
-      *
 
-      * @param $agent_id
 
-      */
 
-     public function deleteByAgentId($agent_id) {
 
-         /* 获取标记信息 */
 
-         $_odata = $this->getDataByAgentId($agent_id);
 
-         if (MemConst::UNUSUAL_MEN_TYPE_3 == $_odata['type']) {
 
-             if (!empty($_odata['mem_id'])) {
 
-                 $_mem_data['status'] = MemConst::STATUS_NORMAL;
 
-                 MemCache::ins()->updateMem($_odata['mem_id'], $_mem_data);
 
-             }
 
-         }
 
-         return $this->where(['agent_id' => $agent_id])->delete();
 
-     }
 
- }
 
 
  |