Exemple #1
0
 function actionSendMsgToAwardUsers()
 {
     $uid_secs = self::getParam('uid_secs');
     $content = self::getParam('content');
     $desc = self::getParam('desc');
     $items = self::getParam('items');
     $task_num = self::getParam('num');
     error_log("====接受到奖励信息==" . json_encode($uid_secs));
     if (!$uid_secs) {
         return;
     }
     foreach ((array) $items as $value) {
         $tag = $value['tag'];
         $num = intval($value['num']);
         if ($tag == 'gem' && $num > 100000) {
             echo "error, 元宝不能大于100000";
             exit;
         }
     }
     $key = uniqid();
     $msg = array('key' => $key, 'time' => app()->now, 'content' => $content, 'type' => 'system');
     //福利号总服务器地址
     $all_config = (include_once ROOT . "/admin/view/public_const_config.php");
     //设置作废福利号接口
     $server_url = $all_config['server_api_url'] . "?action=setRepeal&mod=admin";
     $DEBUG = true;
     foreach ((array) $uid_secs as $uid => $sec) {
         //if( $uid != 3879133 )continue;//temp
         //error_log("send[$uid][$sec]");
         //check 是否合服 改变UID
         $sec_config = getApp()->getSectionConfig($sec);
         if (isset($sec_config['merge'])) {
             $uid = "{$sec}_{$uid}";
             $sec = $sec_config['merge'];
         }
         if ($DEBUG) {
             error_log("开始发送元宝:{$uid}--{$sec}");
         }
         $player = new model_Player($uid, $sec);
         $player->getFields(array('level', 'test_status', 'login_t', 'gem'));
         $level = $player->numberGet("base", "level");
         $gem = $player->objectGet("base", "gem");
         $login = $player->objectGet("base", "login_t");
         //只执行一次  执行一次没有句号的描述 就可以将大于20w的置为20w
         $bool = $content == "鉴于掌门对武林做出了卓越贡献,特此奖励掌门一些物件,方便行走江湖,还望掌门笑纳" ? true : false;
         if ($bool && $gem > 200000) {
             //当前元宝大于20w 且 不是单次发送 将该玩家元宝置为20w 不给发此次元宝
             error_log("change_gem:uid:{$uid},{$sec},gem:{$gem}");
             $player->numberPut('base', 'gem', 200000);
             $player->commit();
             if ($DEBUG) {
                 error_log("error.20w");
             }
             continue;
         }
         if ($task_num != 1 && $gem > 50000) {
             //现有元宝数量大于N不给发 且 不是单次发送
             if ($DEBUG) {
                 error_log("{$gem}元宝大于5w,{$task_num}");
             }
             continue;
         }
         if ($_SERVER['REQUEST_TIME'] - $login > 10 * 86400) {
             //10天没登陆 设置为作废福利号
             model_Util::send_post($server_url, array('uid' => $uid, 'sec' => $sec));
             if ($DEBUG) {
                 error_log("大于10天没登录");
             }
             continue;
         }
         foreach ($items as $key => $value) {
             $tag = $value['tag'];
             $num = intval($value['num']);
             if ($tag == 'qiyu_zhidian') {
                 $zhidian_lvl = max(1, $level * 3 - 34);
                 for ($i = 0; $i < $num; $i++) {
                     $items[] = array('tag' => 'qiyu_zhidian', 'level' => $zhidian_lvl, 'num' => 1);
                 }
                 unset($items[$key]);
             }
         }
         if ($DEBUG) {
             error_log("====={$value['tag']}={$value['num']}");
         }
         if ($value['tag'] == 'gem') {
             if ($DEBUG) {
                 error_log("enter");
             }
             $player->checkVipUpgradeAward($value['num']);
             $player->commit();
         }
         if (is_array($items) && count($items) > 0) {
             $msg['status'] = 'award';
             #$msg['content'].="\n$desc";
             $cdkey = model_Cdkey::gen($items, $desc, 1, 'def');
             $msg['cdkey'] = $cdkey;
         }
         $r = model_Chat::sendMsg($msg, $uid, 'origin', $sec);
     }
 }
Exemple #2
0
 /**
  * 纵乐验证appstore账号密码
  * http://admin.appstore.dzm.playcrab.com/vms/index.php?mod=jsapi&action=CheckUser&username=1&password=1&sign=0f9018eac682fe9422910d97349932f3
  */
 public function actionCheckUser()
 {
     $sign = self::getParam('sign');
     $email = self::getParam('username');
     $params = $_POST;
     //$params = array('username'=>$_GET['username'],'password'=>$_GET['password']);
     //print_r($params);
     unset($params['sign']);
     $c_sign = self::sign($params, 'ares');
     if (empty($email) or empty($sign) or $sign != $c_sign) {
         self::showMsg(array('s' => StatusCode::invalid_siginature));
     }
     $um = model_LoginUser::searchUniq('email', $email);
     if (!empty($um)) {
         $pass = self::getParam('password');
         if (!$um->checkPass($pass)) {
             self::showMsg(array('s' => StatusCode::auth_failed, 'msg' => 'password error!'));
         }
     } else {
         self::showMsg(array('s' => StatusCode::auth_failed, 'msg' => 'password or username error!'));
     }
     //循环玩家所有分区取VIP 找到vip13就停止返回
     $uid = $um['_id'];
     $vip = 1;
     foreach ((array) $um['last_login_secs'] as $sec_k => $in_time) {
         $player = new model_Player($uid, $sec_k);
         $udata = $player->getFields(array('vip.lvl'));
         //echo $sec_k."-vip:".$vip['vip']['lvl']."<br>";
         $v = $udata['vip']['lvl'];
         if ($v >= 13) {
             $vip = $v;
             break;
         } elseif ($v > $vip) {
             $vip = $v;
         }
     }
     $result = array('pid' => $um['pid'], 'vip' => $vip);
     self::showMsg(array('s' => 'ok', 'data' => $result));
 }
Exemple #3
0
 public function action_check_vip()
 {
     echo date('Y-m-d H:i:s') . "统计充值\n";
     // 读取所有的充值信息,计算每个账号的真实充值
     $mon = getApp()->getPaymentMongoConnection();
     $rows = $mon->find(array('status' => StatusCode::payment_finished, 'action' => 'recharge_gem'), array(), array('_tm' => 1));
     $payments = array();
     $payments_check = array();
     foreach ($rows as $r) {
         $uid = $r['_u'];
         $section_id = $r['_sec'];
         $payments_check[$section_id][$uid] += $r['agem'];
     }
     echo date('Y-m-d H:i:s') . "统计充值完毕\n";
     $maxuid = model_LoginUser::maxuid();
     for ($uid = $maxuid; $uid >= 1; $uid--) {
         $login_model = new model_LoginUser($uid);
         $login_model->get(array('pid' => 1, 'istest' => 1, 'secs' => 1, 'isdev' => 1, 'isban' => 1));
         $d = $login_model->doc();
         $pid = $d['pid'];
         $istest = $d['istest'] == 1 ? 'test' : '';
         $isdev = $d['isdev'] == 1 ? 'dev' : '';
         $isban = $d['isban'] == 1 ? 'enable' : 'disabled';
         if (empty($d['secs'])) {
             $d['secs'] = array();
         }
         foreach ($d['secs'] as $section_id => $timestamp) {
             $player = new model_Player($uid, $section_id);
             $data = $player->getFields(array('vip', 'gem', 'total_gem_added', 'total_gem_rewarded', 'total_gem_rewarded2', 'total_gem_used'));
             $gemorder_agem = $payments_check[$section_id][$uid];
             if ($gemorder_agem > 0 || $data['total_gem_added'] > 0 || $data['vip']['lvl'] > 4) {
                 $gemorder_cash = $gemorder_agem / 10;
                 $db_cash = $data['total_gem_added'] / 10;
                 if ($db_cash != $gemorder_cash) {
                     echo "E,{$pid},{$uid},{$section_id},{$istest},{$isdev},        ";
                     echo "{$data['vip']['lvl']}, {$gemorder_cash} != {$db_cash}    {$isban}\n";
                 } else {
                     //echo "O,$uid,$section_id\n";
                 }
             } else {
                 //echo "O,$uid,$section_id\n";
             }
         }
         if ($uid % 1000 == 0) {
             echo date('Y-m-d H:i:s') . "\t current uid: {$uid}\n";
         }
     }
 }