| | |
| | | } |
| | | break; |
| | | |
| | | case "CouponCode": |
| | | $ok = RecordCoupontypeGroup(); |
| | | break; |
| | | |
| | | default: |
| | | Response(1001, "unknown eventID -> " . $EventID); |
| | | exit; |
| | |
| | | $ServerID = \CommFunc\GetServerIDBySid($RegionName); |
| | | AddAccountFirstLogin($ServerID, $roleInfo); |
| | | AddAccountDayActive($ServerID, $roleInfo); |
| | | |
| | | // 附带更新服务器角色表,之后会替换 GameRoles 表 |
| | | $find = array("Channel" => $Channel, "AccountID" => $AccountID, "ServerID" => $ServerID); |
| | | if (\DBOper\Count("ServerRoles", $find) <= 0) { |
| | | $insArray = array( |
| | | "Channel" => $Channel, |
| | | "AccountID" => $AccountID, |
| | | "ServerID" => $ServerID, |
| | | "CreateYMD" => date("Y-m-d"), |
| | | ); |
| | | if ($roleInfo["CreateRoleTime"]) { |
| | | $insArray["CreateYMD"] = substr($roleInfo["CreateRoleTime"], 0, 10); |
| | | } |
| | | $insArray["RollCount"] = \DBOper\Count("ServerRoles", array("Channel" => $Channel, "AccountID" => $AccountID)); |
| | | $insArray = array_merge($insArray, $roleInfo); |
| | | \DBOper\Insert("ServerRoles", $insArray, $find); |
| | | } else { |
| | | \DBOper\Update("ServerRoles", $find, $roleInfo, true); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | } |
| | | \DBOper\Update("AccountDayActive", $find, $actInfo, false, true); |
| | | } |
| | | |
| | | /**记录媒体卡账号分组 */ |
| | | function RecordCoupontypeGroup() |
| | | { |
| | | global $Channel, $RegionName; |
| | | |
| | | $ServerID = \CommFunc\GetServerIDBySid($RegionName); |
| | | if (!$ServerID) { |
| | | return; |
| | | } |
| | | |
| | | CommFunc\GetConfig("ServerInfo", "CoupontypeGroup", $CoupontypeGroup); |
| | | if (!$CoupontypeGroup) { |
| | | // \Logging\LogInfo("CoupontypeGroup 不需要"); |
| | | return; |
| | | } |
| | | |
| | | $AccountID = $_GET["accid"]; |
| | | $code = $_GET["code"]; |
| | | $coupontype = $_GET["coupontype"]; |
| | | $CoupontypeGroup = json_decode($CoupontypeGroup); |
| | | if (!array_key_exists($coupontype, $CoupontypeGroup)) { |
| | | // \Logging\LogInfo("CoupontypeGroup 不需要记录的组:" . $coupontype); |
| | | return; |
| | | } |
| | | |
| | | $find = array("Channel" => $Channel, "AccountID" => $AccountID, "ServerID" => $ServerID); |
| | | if (!\DBOper\FindOne("CoupontypeGroup", $find, $findData)) { |
| | | return; |
| | | } |
| | | if (isset($findData)) { |
| | | // \Logging\LogInfo("已存在,不再重复添加: " . print_r($findData, true)); |
| | | return true; |
| | | } |
| | | |
| | | $insArray = array( |
| | | "Channel" => $Channel, |
| | | "AccountID" => $AccountID, |
| | | "ServerID" => $ServerID, |
| | | "CreateTime" => date("Y-m-d H:i:s"), |
| | | "Coupontype" => $coupontype, |
| | | "Code" => $code, |
| | | ); |
| | | if (\DBOper\Insert("CoupontypeGroup", $insArray, $find)) { |
| | | \Logging\LogInfo("记录使用媒体卡首次分组: " . print_r($insArray, true)); |
| | | return true; |
| | | } |
| | | } |