_getOrmUserInfo(); if (!$userInfo) { $this->_rspErr(1, '没有这个玩家1'); return; } $this->updateUserBaseInfo($userInfo); $this->updateMission($userInfo); $this->_rspOk(); } private function updateUserBaseInfo($userInfo) { $fieldsKv = array( 'total_battle_times' => function () { return 'total_battle_times + 1'; }, ); if (getReqVal('rank', 0) == 1) { $fieldsKv['total_win_times'] = function () { return 'total_win_times + 1'; }; } $kills = getReqVal('kills', 0); if ($kills > 0) { $fieldsKv['total_kills_times'] = function () { return "total_kills_times + ${kills}"; }; $fieldsKv['max_kills_times'] = function () { return "GREATEST(max_kills_times, ${kills})"; }; } $damageOut = getReqVal('damage_out', 0); if ($damageOut > 0) { $fieldsKv['total_damage_out'] = function () { return "total_damage_out + ${damageOut}"; }; $fieldsKv['max_damage_out'] = function () { return "GREATEST(max_damage_out, ${damageOut})"; }; } $damageIn = getReqVal('damage_in', 0); if ($damageIn > 0) { $fieldsKv['total_damage_in'] = function () { return "total_damage_in + ${damageIn}"; }; } $recoverHp = getReqVal('recover_hp', 0); if ($recoverHp > 0) { $fieldsKv['total_recover_hp'] = function () { return "total_recover_hp + ${recoverHp}"; }; $fieldsKv['max_recover_hp'] = function () { return "GREATEST(max_recover_hp, ${recoverHp})"; }; } $aliveTime = getReqVal('alive_time', 0); if ($aliveTime > 0) { $fieldsKv['total_alive_time'] = function () { return "total_alive_time + ${aliveTime}"; }; $fieldsKv['max_alive_time'] = function () { return "GREATEST(max_alive_time, ${aliveTime})"; }; } if (count($fieldsKv) > 0) { $this->_updateUserInfo($fieldsKv); } } private function updateMission($userInfo) { } }