/// <summary> /// 添加道具(批量) /// </summary> public static string ITEM_ADD_ALL(string serverIP, int userByID, string itemName, string strMailTitle, string strMailContent) { int result = 0; int userSN = 0; string UserName = ""; string get_result = ""; string sql = null; int itemID = 0; int itemNum = 0; string itemLimit = ""; string itemN = ""; int count = 0; string ItemSex = ""; try { string[] item = itemName.Split('|'); serverIP = CommonInfo.JW2_FindDBIP(serverIP, 9); sql = "select sql_statement from sqlexpress where sql_type='JW2_ADD_ITEM' and sql_condition='JW2_ADD_ITEM'"; System.Data.DataSet ds = SqlHelper.ExecuteDataset(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < item.Length - 1; i++) { result = 0; UserName = item[i].Split(',')[0].ToString(); userSN = CommonInfo.JW2_Account_UserSn(serverIP, UserName); if (userSN != 0) { itemID = int.Parse(item[i].Split(',')[1].ToString()); itemNum = int.Parse(item[i].Split(',')[2].ToString()); itemN = CommonInfo.JW2_ProductIDToName(itemID); ItemSex = CommonInfo.JW2_ItemID_Sex(itemID); switch (CommonInfo.JW2_ItemCodeToLimitDay(itemID)) { case 0: itemLimit = "永久"; break; case 7: itemLimit = "7天"; break; case 30: itemLimit = "30天"; break; } for (int j = 0; j < itemNum; j++) { sql = ds.Tables[0].Rows[0].ItemArray[0].ToString(); sql = string.Format(sql, userSN, strMailTitle, strMailContent, itemID); result += MySqlHelper.ExecuteNonQuery(SqlHelper.JW2GetConnectionString(serverIP, SqlHelper.jw2User, SqlHelper.jw2UserPwd, SqlHelper.jw2messengerDB), sql); } if (result > 0) { get_result += "添加玩家:【" + UserName.ToString() + "】,道具ID:【" + itemID.ToString() + "】,发送性别:【" + ItemSex.ToString() + "】,道具:【" + itemN.ToString() + "】,数量:【" + result + "】,成功\n"; SqlHelper.insertGMtoolsLog(userByID, "劲舞团II", serverIP, "JW2_ITEM_ADD_ALL", "添加玩家:" + UserName.ToString() + ",道具ID:" + itemID.ToString() + ",发送性别:" + ItemSex.ToString() + ",道具:" + itemN.ToString() + ",道具数量:" + result + ",道具期限:" + itemLimit + ",成功"); } else { get_result += "添加玩家:【" + UserName.ToString() + "】,道具ID:【" + itemID.ToString() + "】,发送性别:【" + ItemSex.ToString() + "】,道具:【" + itemN.ToString() + "】,数量:【" + result + "】,成功\n"; SqlHelper.insertGMtoolsLog(userByID, "劲舞团II", serverIP, "JW2_ITEM_ADD_ALL", "添加玩家:" + UserName.ToString() + ",道具ID:" + itemID.ToString() + ",发送性别:" + ItemSex.ToString() + ",道具:" + itemN.ToString() + ",道具数量:" + result + ",道具期限:" + itemLimit + ",成功"); } } else { get_result += "玩家:【" + UserName.ToString() + "】,不存在\n"; SqlHelper.insertGMtoolsLog(userByID, "劲舞团II", serverIP, "JW2_ITEM_ADD_ALL", "玩家:【" + UserName.ToString() + "】,不存在"); } } } } catch (MySqlException ex) { get_result += "数据库连接失败,请稍后尝试"; SqlHelper.errLog.WriteLog("服务器IP" + serverIP + ex.Message); } return(get_result); }