20177 月4
分享:微信电子导航DEMO
后台JAVA代码:
package cn.wizzer.app.web.modules.controllers.front.wx;
import cn.wizzer.app.web.commons.base.Globals;
import cn.wizzer.app.wx.modules.services.WxAddressService;
import cn.wizzer.app.wx.modules.services.WxConfigService;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.weixin.at.impl.MemoryJsapiTicketStore;
import org.nutz.weixin.spi.WxApi2;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* Created by wizzer on 2017/6/27.
*/
@IocBean
@At("/public/wx/add")
public class AddController {
private static final Log log = Logs.get();
@Inject
private WxConfigService wxConfigService;
@Inject
private WxAddressService wxAddressService;
@At("/index/?")
@Ok("beetl:/public/add/index.html")
public void index(String wxid,HttpServletRequest req, HttpSession session) {
WxApi2 wxApi2 = wxConfigService.getWxApi2(wxid);
if (Lang.isEmpty(Globals.memoryJsapiTicketStore.get(wxid))) {
Globals.memoryJsapiTicketStore.put(wxid, new MemoryJsapiTicketStore());
}
MemoryJsapiTicketStore memoryJsapiTicketStore = Globals.memoryJsapiTicketStore.get(wxid);
wxApi2.setJsapiTicketStore(memoryJsapiTicketStore);
String url = "http://" + Globals.AppDomain + Globals.AppBase + "/public/wx/add/index/"+wxid;
NutMap jsConfig = wxApi2.genJsSDKConfig(url, "getLocation");
req.setAttribute("list", wxAddressService.query(Cnd.orderBy().asc("opAt")));
req.setAttribute("jsConfig", Json.toJson(jsConfig));
}
}
前台代码:
电子导航
var base = '${base!}';
公司检索
公司名称:
当前位置:
-
- ${oLP.index}、${o.name}
- lng:${o.lng}, lat:${o.lat}
没有检索到结果
本文地址:https://wizzer.cn/archives/3352 , 转载请保留.