123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032 |
- <?php
- class ActivitySer extends Mysqldb
- {
- private static $mysql;
- protected $redis = null;
- private static $appid = null;
- protected $game_db_name = 'gank_activites';
- protected $redis_prefix = 'gank_wechat_activites';
- protected $activity_reward_table = 'app_user_reward';
- protected $redis_prize_key = null;
- protected static $activity_user_table = null;
- protected static $activity_prize_dbname = 'wechat_prize_config';
- protected $login_table = 'receivelogin';
- protected static $consignee_table = 'wechat_user_consignee';
- protected static $virtual_item_prize_table = 'wechat_virtual_item_prize';
- protected static $table = null;
- public static $prize_info = null;
- protected static $wechat_stat_lottery_tab = 'wechat_stat_lottery_info';
- protected static $wechat_stat_webclick_tab = 'wechat_stat_web_click';
- const LIMIT_ONE = 1;
- const K_EXPICE_TIME = 3600;
- function __construct($appid = null)
- {
- log_message::info("初始 act sers ...");
- self::$appid = $appid;
- self::$activity_user_table = 'wechat_user';
- $this->redis_prize_key = "prize_info:wechat";
- $xredis_conf = array(
- 'redis_prefix' => $this->redis_prefix,
- 'k_expire_time' => self::K_EXPICE_TIME
- );
- $this->redis = new Xredis($xredis_conf);
- self::$mysql = new Mysqldb();
- self::$prize_info = $this->getCachePrizeInfo();
- self::$table = $this->game_db_name . '.' . self::$activity_user_table;
- }
-
- public function GetActivitySign($openId)
- {
- $sql = "SELECT id,openid,rule,create_at FROM wechat_sign_activity WHERE openid='" . $openId . "' limit 1 ";
- if (self::$mysql->query($sql)) {
- return self::$mysql->fetch_row();
- }
- return false;
- }
- public function SetActivitySign($openId, $ruleinfo)
- {
- $sql = "INSERT INTO wechat_sign_activity (openid,rule,create_at) VALUES('" . $openId . "','" . $ruleinfo . "',NOW())";
- if (self::$mysql->query($sql)) {
- error_log('1' . "\n", 3, 'D:\xampp\htdocs\wechat\log\wechat-log.txt');
- return true;
- }
- return false;
- }
- public function EditActivitySign($infostr, $id)
- {
- $up = self::$mysql->update2('wechat_sign_activity', ['rule' => $infostr], 'id=:id', array('id' => $id));
- if ($up) {
- return true;
- }
- return false;
- }
-
- public function EditGiftCode($id)
- {
- $up = self::$mysql->update2('wechat_gift_code', ['status' => 1], 'id=:id', array('id' => $id));
- if ($up) {
- return true;
- }
- return false;
- }
-
- public function GetGiftCode($type)
- {
- $sql = "SELECT type,giftcode,status FROM wechat_gift_code WHERE type=" . $type . " AND status=GIFTCODE_STATUS limit 1 ";
- error_log($sql . "\n", 3, 'D:\xampp\htdocs\wechat\log\wechat-sql-log.txt');
- if (self::$mysql->query($sql)) {
- return self::$mysql->fetch_row();
- }
- return false;
- }
-
- public function ClearGiftCode($id)
- {
- $sql = "DELETE FROM wechat_gift_code WHERE id=$id";
- if (self::$mysql->query($sql)) {
- return true;
- }
- return false;
- }
-
- public function ActivityConfigList($type = null)
- {
- $sql = "SELECT type,title,desc FROM wechat_activity_config";
- if (self::$mysql->query($sql)) {
- return self::$mysql->fetch_all();
- }
- return false;
- }
-
- public function setConfigCache($key, $app_id, $data)
- {
-
-
-
-
-
- $this->redis->hSet($key, $app_id, $data);
- }
- public function setRankingCache()
- {
- }
-
- public function getCacheUserInfo($uid)
- {
- $userinfo = $this->redis->get(self::$activity_user_table . ":" . $uid);
- if ($userinfo) {
- $this->setCacheEX(self::$activity_user_table . ":" . $uid);
- return $userinfo;
- }
- log_message::info('cache user info is null ');
- return null;
- }
-
- public function setCacheEX($key)
- {
- $ttl = $this->redis->ttl($key);
- if ($ttl < self::K_EXPICE_TIME) {
- return $this->redis->expire($key, self::K_EXPICE_TIME);
- }
- $this->redis->expire($key, self::K_EXPICE_TIME);
- }
-
- public function setCacheUserInfo($data)
- {
- $uid = $data['uid'];
- $data_str = json_encode($data, JSON_UNESCAPED_UNICODE);
- $ret = $this->redis->setex(self::$activity_user_table . ":" . $uid, self::K_EXPICE_TIME, $data_str);
- if (!$ret) {
- return log_message::info('set cache user info false');
- }
- return true;
- log_message::info('set cache user info true');
- }
-
- public function getdbUserInfo($uid,$gameid=null)
- {
- $field = "uid,gameid,respce_lottery_total,surplus_lottery_num,
- act_lottery_end_at,lottery_total,create_at,lucky_draw_total,lottery_up_limit,login_at";
- $where = " WHERE uid=:uid AND gameid=:gameid LIMIT " . self::LIMIT_ONE;
- $sql = "SELECT $field FROM " . self::$activity_user_table . $where;
- $prepare = array('uid' => $uid,'gameid'=>$gameid);
- if (self::$mysql->query($sql, $prepare) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_row();;
- }
- return false;
- }
-
-
-
- public function updateUserInfo($updata, $get_prepare_array)
- {
- $where_str = self::$mysql->formatSqlWhere($get_prepare_array);
- $where_val = $get_prepare_array;
- $up_ret = self::$mysql->update2(self::$activity_user_table, $updata, $where_str, $where_val);
- if ($up_ret) {
- return true;
- log_message::info("update info ok");
- }
- log_message::info("update info false");
- return false;
- }
- public static function formatSqlWhere($data, $addition = null)
- {
- if (isDatas($data)) {
- $where = null;
- foreach ($data as $field_key => $field_val) {
- if (!empty($where)) {
- $where .= ' AND ' . $field_key . '=:' . $field_key;
- } else {
- $where .= $field_key . '=:' . $field_key;
- }
- }
- return $where . $addition;
- }
- return false;
- }
-
- public function saveUserInfo($data)
- {
-
- $uid = isset($data['uid']) ? $data['uid'] : ZERO;
- $gameid = isset($data['gameid']) ? $data['gameid'] : ZERO;
- $user_info = $this->getCacheUserInfo($uid);
- if ($user_info) {
- log_message::info('return cache user info .');
- return Utils::decodeDate($user_info);
- }
- $db_user_info = $this->getdbUserInfo($uid,$gameid);
-
- if (empty($db_user_info)) {
-
- if (!self::$mysql->insert(self::$table, $data)) {
- log_message::info('insert indo db saveuserinfo false');
- }
- if (!$this->setCacheUserInfo($data)) {
- log_message::info('insert indo cache saveuserinfo false');
- }
- return $data;
- }
-
-
- if (!$this->setCacheUserInfo($db_user_info)) {
- log_message::info('insert indo cache saveuserinfo2 false');
- }
- return $db_user_info;
- }
-
- public function updateUserlotteryInfo($data, $lottery = false, $lottery_up_limit = ZERO)
- {
- $uid = isset($data['uid']) ? $data['uid'] : ZERO;
- $gameid = isset($data['gameid']) ? $data['gameid'] : ZERO;
-
- $respce_lottery_total = isset($data['respce_lottery_total']) ? $data['respce_lottery_total'] : ZERO;
-
-
-
- if ($uid != '0366415e26930fa2f42dae66fce21f1b') {
-
- $sql = "UPDATE " . self::$table . " SET
- respce_lottery_total = respce_lottery_total+($respce_lottery_total-respce_lottery_total),
- surplus_lottery_num = respce_lottery_total - lottery_total
- WHERE uid = " . $uid ." AND gameid=".$gameid;
- }
- if ($lottery == true) {
- $sql = "UPDATE " . self::$table . " SET surplus_lottery_num = surplus_lottery_num-1,
- lottery_total=lottery_total+1,lucky_draw_total=lucky_draw_total+1,lottery_up_limit=lottery_up_limit+" . $lottery_up_limit . "
- WHERE uid = " . $uid." AND gameid=".$gameid;;
- }
- $uid = isset($data['uid']) ? $data['uid'] : ZERO;
-
- if (!empty($sql)) {
- log_message::info("lottery", $sql);
- $ret = self::$mysql->query($sql);
- if ($ret->rowCount() > ZERO) {
- $data = $this->getdbUserInfo($uid,$gameid);
-
-
- $this->setCacheUserInfo($data);
-
- return $data;
- }
- return false;
- }
- }
-
- public function getOnlineNum($appid, $channelid, $sid, $uid, $act_start_at, $act_end_at)
- {
- $login_data = [];
- $dbconfg = Utils::config('game_stat_db');
- $appid = '6';
- $serverid = '378';
- $channelid = 'xcx1970';
- $who = '1000002587037899';
- $act_start_at = '2018-08-22 00:00:00';
- $act_end_at = '2018-10-22 23:59:59';
- $mysql = new Mysqldb($dbconfg);
- $field = "who,DATE(begdate) as login_at,COUNT(*) as login_frequency";
- $where = " WHERE who=:who AND begdate>=:act_start_at
- AND begdate<=:act_end_at AND appid=:appid
- AND channelid=:channelid AND serverid=:serverid ";
- $sql = "SELECT $field FROM (SELECT * FROM " .
- $this->login_table . $where . " ) as a GROUP BY DATE(a.begdate)";
- $prepare = array(
- 'who' => $who,
- 'appid' => $appid,
- 'channelid' => $channelid,
- 'act_start_at' => $act_start_at,
- 'act_end_at' => $act_end_at,
- 'serverid' => $serverid
- );
- if ($mysql->query($sql, $prepare) && $mysql->rowcount() > ZERO) {
- log_message::info('login 查询成功!!!!');
- $data = $mysql->fetch_all();
- log_message::info("6666666", json_encode($data));
- $login_day = [];
- $login_num = [];
- $login_successive_day = [];
- foreach ($data as $var) {
- $login_day[] = $var['login_at'];
- $login_num[] = $var['login_frequency'];
- }
- $login_data = [
- 'login_day' => count($login_day),
- 'login_frequency' => array_sum($login_num),
- 'login_successive_day' => count(Utils::successiveTime($login_day)),
- ];
- log_message::info(json_encode($login_data));
- return $login_data;
- }
- return false;
- }
-
- public function getUserPayInfo($appid, $channelid, $sid, $uid, $act_start_at, $act_end_at)
- {
- log_message::info("get **************");
- $login_data = [];
- $dbconfg = Utils::config('game_stat_db');
- $appid = '6';
- $serverid = '378';
- $channelid = 'xcx1970';
- $who = '1000002587037899';
- $act_start_at = '2018-08-22 00:00:00';
- $act_end_at = '2018-10-22 23:59:59';
-
- $mysql = new Mysqldb($dbconfg);
- $field = "COUNT(*) paynum,SUM(currencyamount) as amount ";
- $where = " WHERE who=:who AND begdate>=:act_start_at
- AND begdate<=:act_end_at AND appid=:appid AND
- channelid=:channelid AND serverid=:serverid LIMIT " . self::LIMIT_ONE;
- $sql = "SELECT $field FROM todaypayment " . $where;
- $prepare = array(
- 'who' => $who,
- 'appid' => $appid,
- 'channelid' => $channelid,
- 'act_start_at' => $act_start_at,
- 'act_end_at' => $act_end_at,
- 'serverid' => $serverid
- );
- log_message::info("ddddddddddd");
- if ($mysql->query($sql, $prepare) && $mysql->rowcount() > ZERO) {
- log_message::info('pay 查询成功!!!!');
- $data = $mysql->fetch_row();
- log_message::info("&&&&&&JHHHHHHHHH", json_encode($data));
- $pay_frequency = ZERO;
- $pay_amount = ZERO;
- $pay_frequency = empty($data['pay_frequency']) ? ZERO : $data['pay_frequency'];
- $pay_amount = empty($data['pay_amount']) ? ZERO : $data['pay_amount'];
- $pay_data = [
- 'pay_frequency' => $pay_frequency,
- 'pay_amount' => $pay_amount,
- ];
- log_message::info("555555555555555555&&&&&&JHHHHHHHHH", json_encode($pay_data));
- return $pay_data;
- }
- return false;
- }
-
-
-
- public function getdbPrizeInfo()
- {
- $appid = self::$appid;
-
- $field = "appid,prize_id,prize,rate,number,commodity,upper_limit,creat_at";
- $where = " WHERE appid=:appid";
- $sql = "SELECT $field FROM " . self::$activity_prize_dbname;
- $prepare = array('appid' => $appid);
- if (self::$mysql->query($sql, $prepare) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_all();
- }
- return false;
- }
-
- public function respcedbLottery()
- {
- }
-
- public function getCachePrizeInfo()
- {
- $prize_info = null;
- $data = null;
- $redis_data = null;
- $cache_data = null;
- $data = Utils::config('game_prize');
-
- $prize_info = $this->redis->hGetAll($this->redis_prize_key);
- if ($prize_info) {
- foreach ($prize_info as $key => $var) {
- $redis_data[] = json_decode($var, true);
- }
- $cache_data = Utils::prizeFormat($redis_data);
- log_message::info('getCachePrizeInfo is cache info ', json_encode($cache_data));
- return $cache_data;
- }
- $dbdata = $this->getdbPrizeInfo();
- if ($dbdata) {
-
- $this->setCachePrizeInfo($dbdata);
- $dbdata = Utils::prizeFormat($dbdata);
- log_message::info('cache prize info is null ');
- return $dbdata;
- } else {
-
- if ($data) {
- $data = Utils::prizeFormat($data);
- log_message::info("getCachePrizeInfo set db prize ");
- $this->respaceLottery($data);
- return $data;
- }
- }
- return false;
- }
-
- public function respaceLottery($respace_data)
- {
- if ($respace_data) {
- $res_db = $this->setdbPrizeInfo($respace_data);
- $res_cache = $this->setCachePrizeInfo($respace_data);
- if ($res_db && $res_cache) {
- log_message::info("更新 prize db 与 cache 成功");
- return $respace_data;
- }
- log_message::info("更新 prize db 与 cache 失败");
- return false;
- }
- log_message::info(" respace_data is null ");
- return false;
- }
- public function setdbPrizeInfo($data)
- {
- $prize_out = null;
- $fields = 'prize_id,prize,rate,number,upper_limit,prize_type,status';
- foreach ($data as $key => $var) {
- $prize_out[$key] = [
- "prize_id" => $var['prize_id'],
- "prize" => '"' . $var['prize'] . '"',
- "rate" => $var['rate'],
- "number" => $var['number'],
- "upper_limit" => $var['upper_limit'],
- "prize_type" => $var['prize_type'],
- "status" => $var['status'],
- ];
- }
- if (isDatas($prize_out)) {
- if (self::$mysql->insertBatch(self::$activity_prize_dbname, $fields, $prize_out)) {
- return true;
- }
- log_message::info("setdbPrizeInfo false ");
- return false;
- }
- log_message::info("prize_out is null");
- return false;
- }
-
- public function setCachePrizeInfo($data)
- {
-
-
- $data = Utils::prizeAssembly($data);
-
- $ret = $this->redis->hMset($this->redis_prize_key, $data);
- if (!$ret) {
- log_message::info('set cache prize info false');
- return false;
- }
- return true;
- }
-
- public function setLotteryFrequency($prize_id)
- {
- if ($this->redis->exists($this->redis_prize_key)) {
- $data = json_decode($this->redis->hGet($this->redis_prize_key, $prize_id), true);
- if (isDatas($data)) {
- $upper_limit = (int)$data['upper_limit'];
- $frequency = $data['frequency'];
-
- return $this->setUpperLimit($frequency, $upper_limit, $data);
- }
- log_message::info("setLotteryFrequency false");
- return false;
- }
- log_message::info("setLotteryFrequency false cache is null");
- return false;
- }
-
- public function setUpperLimit($role_upper_limit, $game_upper_limit, $data)
- {
- log_message::info('-----------------', json_encode($data, JSON_UNESCAPED_UNICODE));
- $commodity = $data['status'];
- $prize_id = $data['prize_id'];
- $prize_value = null;
- $isNayUpperLimit = self::isNayUpperLimit($role_upper_limit, $game_upper_limit);
-
- if ($isNayUpperLimit) {
- $role_upper_limit += ONE;
- $data['frequency'] = $role_upper_limit;
- $prize_value = json_encode($data, JSON_UNESCAPED_UNICODE);
- log_message::info("########################", $prize_value);
-
- log_message::info('^^^^^^^^^^^^^^^^^^^^^cishu', $prize_id, $prize_value);
- $this->redis->hSet($this->redis_prize_key, $prize_id, $prize_value);
- return self::prizeIsCommodity($data, $commodity);
- } else {
- log_message::info('set uo limit is nay InterventionLottery');
-
- return self::interventionLottery();
- }
- }
-
- public static function prizeIsCommodity($data, $commodity)
- {
- $id = $data['prize_id'];
- $status = (int)$data['status'];
- $up_limit = $data['upper_limit'];
- if ($commodity == ONE) {
- $data['prize_type'] = (int)ONE;
- }
- if ($up_limit != ZERO && $status != ONE) {
- $ret = self::getdbVirtualItemPrize($id);
- log_message::info("******************", json_encode($ret, JSON_UNESCAPED_UNICODE));
- if ($ret) {
-
- $card_info = '卡密:' . $ret['password'];
- $data['prize_desc'] = $card_info;
-
-
- $item_prize_id = $ret['id'];
- self::setdbVirtualItemPrize($item_prize_id);
- log_message::info("prizeIsCommodity VirtualItem data is true");
- } else {
- log_message::info("prizeIsCommodity VirtualItem data is pres");
- unset($data);
-
- $data = self::$prize_info[SIX];
- }
-
-
- log_message::info("prizeIsCommodity VirtualItem data is null");
- }
-
- return json_encode($data, JSON_UNESCAPED_UNICODE);
- }
-
- public function interventionLottery($data = [])
- {
- $prize_all = self::$prize_info;
- foreach ($prize_all as $key => $val) {
- $arr[$val['prize_id']] = $val['rate'];
- }
- do {
- log_message::info("********************* prize_all ", json_encode($arr));
- $rid = Utils::getPrizeRand($arr);
- log_message::info("********************* rid ", $rid);
-
- $pirze_lottery = $prize_all[$rid];
- $game_upper_limit = (int)$pirze_lottery['upper_limit'];
- $role_upper_limit = (int)$pirze_lottery['frequency'];
- return $this->setLotteryFrequency($pirze_lottery['prize_id']);
- } while (Utils::isUpperlimit($role_upper_limit, $game_upper_limit));
- }
-
- public function byPrizeidInfo($id = null, $all = false)
- {
- $data = $this->redis->hGet($this->redis_prize_key, $id);
- if ($all == true) {
- $data = $this->redis->hGetAll($this->redis_prize_key);
- }
- if (isDatas($data)) {
- return $data;
- }
- log_message::info("getPrizeidInfo is null");
- return false;
- }
-
- public static function isUpperlimit($role_upper_limit, $game_upper_limit)
- {
- if (($game_upper_limit != ZERO && $game_upper_limit >= $role_upper_limit)) {
- return true;
- }
- return false;
- }
-
- public static function isNayUpperLimit($role_upper_limit, $game_upper_limit)
- {
- if ($game_upper_limit == ZERO || ($game_upper_limit != ZERO && $role_upper_limit < $game_upper_limit)) {
- return true;
- }
- return false;
- }
-
- public function replaceUpperLimit()
- {
- $where_data = ['appid' => self::$appid];
- $edit_data = ['frequency' => ZERO];
- $where_str = self::$mysql->formatSqlWhere($where_data);
- $up = self::$mysql->update2(self::$activity_prize_dbname, $edit_data, $where_str, $where_data);
- if ($up) {
- log_message::info('抽奖上限次数重置成功!');
- return true;
- }
- log_message::info('抽奖上限次数重置失败!');
- return false;
- }
- public function getdbLotteryInfo()
- {
- }
-
-
-
-
- public function getdbLotteryTotal($appid, $channelid, $uid, $act_start_at, $act_end_at, $openid)
- {
- $dbconfg = Utils::config('game_stat_db');
- $mysql = new Mysqldb($dbconfg);
- $field = " COUNT(*) as cont_frequency,COUNT(DISTINCT DATE(begdate)) cont_day";
- $where = " WHERE who=:who appid=:appid AND channelid=:channelid AND begdate>=:start_at
- AND begdate<=:end_at LIMIT" . self::LIMIT_ONE;
- $sql = "SELECT $field FROM " . $this->login_table . $where;
- $prepare = array(
- 'who' => $uid,
- 'appid' => $appid,
- 'channelid' => $channelid,
- 'start_at' => $act_start_at,
- 'end_at' => $act_end_at,
- );
- if ($mysql->query($sql, $prepare) && $mysql->rowcount() > ZERO) {
- return $mysql->fetch_row();
- }
- return false;
- }
-
- public static function savePirzeConsignee($data)
- {
-
- $ret = self::$mysql->insert(self::$consignee_table, $data);
- if ($ret) {
- return true;
- }
- return false;
- }
-
- public static function editPirzeConsignee($data)
- {
- $uid = $data['uid'];
- $gameid = $data['gameid'];
- $prize_order = $data['prize_order'];
- $type = $data['type'];
- $where_data = [
- 'uid' => $uid,
- 'gameid' => $gameid,
- 'prize_order' => $prize_order
- ];
- $where_str = self::$mysql->formatSqlWhere($where_data);
- $edit_data = [
- 'consignee_address' => $data['consignee_address'],
- 'consignee_phone' => $data['consignee_phone'],
- 'type' => $type
- ];
- $up = self::$mysql->update2(self::$consignee_table, $edit_data, $where_str, $where_data);
- if ($up) {
- log_message::info('地址更新成功!');
- return true;
- }
- log_message::info('地址更新失败!');
- return false;
- }
-
- public function userPrizeInfo($uid,$gameid=null)
- {
- $sql = " SELECT * FROM " . self::$consignee_table . "
- WHERE uid=:uid AND gameid=:gameid";
- $prepare = array(
- 'uid' => $uid,
- 'gameid' => $gameid,
- );
- if (self::$mysql->query($sql, $prepare) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_all();
- }
- return false;
- }
-
- public function byuserPrizeOrderInfo($uid,$gameid, $prize_order)
- {
- $sql = " SELECT * FROM " . self::$consignee_table . "
- WHERE uid=:uid AND gameid =:gameid AND prize_order=:prize_order";
- $prepare = array(
- 'uid' => $uid,
- 'gameid' => $gameid,
- 'prize_order' => $prize_order
- );
- if (self::$mysql->query($sql, $prepare) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_row();
- }
- return false;
- }
-
- public static function globalConfig($where_data)
- {
- $sql = "SELECT * FROM tb_stat_back_ranking ";
- $addition = 'ORDER BY id desc limit 1';
- $sql .= ' WHERE ' . self::$mysql->formatSqlWhere($where_data, $addition);
- if (self::$mysql->query($sql, $where_data) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_row();
- log_message::info("globalconfig true");
- }
- log_message::info("globalconfig false", $sql);
- return false;
- }
- public function getRankingList($data)
- {
- $sql = "select * from WHERE ";
-
- }
-
-
- public static function getdbVirtualItemPrize($itemid)
- {
-
- $sql = " SELECT id,account,password,`desc`,itemid FROM " . self::$virtual_item_prize_table . "
- WHERE itemid=:itemid AND status=:status LIMIT " . self::LIMIT_ONE;
- $prepare = array(
- 'itemid' => $itemid,
- 'status' => ZERO,
- );
- if (self::$mysql->query($sql, $prepare) && self::$mysql->rowcount() > ZERO) {
- return self::$mysql->fetch_row();
- }
- return false;
- }
-
- public static function setdbVirtualItemPrize($id)
- {
- $where_data = ['id' => $id];
- $edit_data = ['status' => ONE];
- $where_str = self::$mysql->formatSqlWhere($where_data);
- $up = self::$mysql->update2(self::$virtual_item_prize_table, $edit_data, $where_str, $where_data);
- if ($up) {
- log_message::info('重置虚拟配置成功!');
- return true;
- }
- log_message::info('重置虚拟配置失败!');
- return false;
- }
-
- public function setLotteryLog($data)
- {
- $ret = self::$mysql->insert(self::$wechat_stat_lottery_tab, $data);
- if ($ret) {
- return true;
- }
- return false;
- }
-
- public function setWebClickLog($data)
- {
- $ret = self::$mysql->insert(self::$wechat_stat_webclick_tab, $data);
- if ($ret) {
- return true;
- }
- return false;
- }
- }
|