diff --git a/KJD_WebService/BLL/WXXD/WXShopManage.cs b/KJD_WebService/BLL/WXXD/WXShopManage.cs index 043d639..8bd403e 100644 --- a/KJD_WebService/BLL/WXXD/WXShopManage.cs +++ b/KJD_WebService/BLL/WXXD/WXShopManage.cs @@ -70,9 +70,11 @@ namespace KJD_Web.BLL.WXXD MysqlUtils mySql = new MysqlUtils(conn); string sql; bool isPayUser = false; + int userGroup = 4; + string parentUserName = ""; if (!isAdmin) { - sql = "select u.authority,uu.authority as main_authority " + + sql = "select u.parent_user_name,u.group_id,u.authority,uu.authority as main_authority " + "FROM wxxd.user u LEFT JOIN wxxd.user uu ON uu.user_name=u.parent_user_name where u.user_name='" + user_name + "'"; @@ -88,6 +90,12 @@ namespace KJD_Web.BLL.WXXD return "{\"code\":501,\"msg\":\"" + mySql.Message + "\",\"data\":null}"; } isPayUser = dtRow["authority"].ToString().Contains("充值用户") || dtRow["main_authority"].ToString().Contains("充值用户"); + userGroup = dtRow["group_id"].ParseToInt(); + parentUserName = dtRow["parent_user_name"].ParseToString(); + if (userGroup != 3 && parentUserName.IsNullOrEmpty()) + { + return "{\"code\":501,\"msg\":\"用户名错误\",\"data\":null}"; + } } sql = "SELECT COUNT(*) FROM wxxd.shop s WHERE 1=1"; @@ -97,7 +105,12 @@ namespace KJD_Web.BLL.WXXD if (isAdmin) where += " and (s.cookie='' or s.shop_id!='')"; if (!isAdmin) - where += " and (s.user_name='" + user_name + "' or s.sub_user_name like '%" + user_name + "%')"; + { + if (userGroup != 3) + where += " and (s.user_name='" + parentUserName + "' and s.sub_user_name like '%" + user_name + "%')"; + else + where += " and (s.user_name='" + user_name + "')"; + } if (!string.IsNullOrWhiteSpace(operate_sub_sa_name)) where += " and s.operate_sub_sa_name='" + operate_sub_sa_name + "'"; if (!string.IsNullOrWhiteSpace(search_user_name))