public static function getInstance() { if(!(self::$instance instanceof self)) { self::$instance = new self(); } return self::$instance; }
/** * 用户操作记录保存接口(比如点击事件) * @param string 用户id * @param string $operKey 操作关键字 * @param int $binding 判断是否需要绑定 * @param string $filed 操作备注信息 */ public function oper($uid,$operKey,$binding=1,$filed="") { if($binding == 1) { if(is_object(self::$_e['bindding'])) { //如果注册了绑定事件 if(!call_user_func_array(array(self::$_e['bindding'], self::$_m['bindding']), array($uid))){ return array('flag'=>-200,'desc'=>'玩家未绑定,不能参与活动'); }; } else { return array('flag'=>0,'desc'=>'未注册绑定事件,不能验证绑定信息'); } } if($this->actionInfo['isoper']) { //判断活动是否开启操作记录保存接口 $operData = $this->actionInfo['operData'] ? json_decode($this->actionInfo['operData'],true) : array(); if(in_array($operKey, $operData)) { $flag = OperOper::getInstance()->updateRecord($uid, $this->actionInfo['id'], $operKey, $filed); return array('flag'=>$flag,'desc'=>'成功'); } else { return array('flag'=>0,'desc'=>'该操作不合法'); } } else { die(json_encode(array('flag'=>0,'desc'=>'系统不提供操作记录支持'))); } }