atitit agt sys 设置下级代理功能设计.docx
/atiplat_cms/src/com/attilax/user/AgentService.java3
显示界面
http://localhost:8080/agent/set_sub2.htm
先查询显示 set_sub.js
// JavaScript Document
function btn_click()
{
var sql="select * from account where id='$uid$' ";
sql=sql.replace("$uid$",$("#txtUid").val());
//sql=sql.replace("$pwd$",$("#txtPassword").val());
var orm=new atiOrmV4();
orm.obj=sql ;
orm.callbackFun=function(data)
{
try{
processJavaEx_V2q315(data);
}catch(e)
{
showErr(e);
return;
}
var json=str2json(data);
if(json.length==0)
{
alert("没有此用户id");
return;
}
var obj=json[0];
var fm=new AForm()
fm.bind(obj);
};
orm.query();
}
设置代理
function setSubAgent()
{
if( $("#tel").val()=='' || $("#bankcard").val()=='' || $("#sid").val()=='' )
{
alert("信息不能为空");
reutrn;
}
if(! confirm('确定要授权该玩家为您的下级代理吗?'))
return;
var code="new(com.attilax.user.AgentService).setSubAgent($uid$)";
code=code.replace("$uid$",$("#txtUid").val());
//code=code.replace("$pwd$",$("#txtPassword").val());
var jsb=new AtiJsBridge();
var nick=encodeURIComponent($("#nick").text());
var urlparams=$("form").serialize()+"&$code="+encodeURIComponent(code)+"&uname="+nick;
jsb.exe(urlparams,function(data){
console.log(data);
try{
processJavaEx_V2q315(data);
}catch(e)
{
if(catchEx(e,"com.attilax.secury.LoginException"))
{
alert("用户名密码错误");
return;
//
}
showErr(e);
return;
}
alert(" ok");
// window.location="../uc/uc.htm";
});
}
/atiplat_cms/src/com/attilax/user/AgentService.java
@SuppressWarnings("all")
public Object setSubAgent(String sub_id) throws UserNotExistEx, CantSetSelfEx, SuperiorExistEx, DuplicateEntryEx {
checkUserExist(sub_id);
String getuid = tksvr.getuid();
if (sub_id.equals(getuid))
throw new CantSetSelfEx("ex:CantSetSelfEx:不能设置自己为代理");
// checkSuperiorExist(sub_id);
String sql = "insert agent(uid,parent_id,pwd,name,tel,wechat,bkkad,sid,uname)values('$uid$','$pid$','$pwd$','$name$','$tel$','$wechat$','$bkkad$','$sid$','$uname$') ";
sql = sql.replace("$uid$", sub_id);
tksvr.setUtype("agent");
sql = sql.replace("$pid$", getuid);
sql = sql.replace("$pwd$", "111111");
HttpServletRequest req = Global.req.get();
try {
req.setCharacterEncoding("utf8");
} catch (UnsupportedEncodingException e1) {
ExUtil.throwExV2(e1);
}
String name=req.getParameter("name");
String name_gbk2utf=EncodeX.gbk2utf(name);
String name_utf2gbk=EncodeX.utf2gbk(name);
Map m = ReqX.toMap(req);
sql = new ParamX().sqlFmtV2(sql, m);
System.out.println(sql);
try {
return dbsvrV4.executeUpdateV2qb0(sql);
} catch (DuplicateEntryEx e) {
throw new DuplicateEntryEx("已经存在此代理", e);
} catch (getConnEx | SQLException e) {
ExUtil.throwExV2(e);
}
return sql;
}
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
Atiend