当前位置: 首页 > news >正文

网站的后台管理员系统建设教程做网站无需备案

网站的后台管理员系统建设教程,做网站无需备案,带前台的wordpress模板下载,男女做爰全过程网站今天写了一个商品到货提醒的job任务#xff0c;具体效果如下 这里用到了微信的发送订阅消息#xff0c;主要代码是这一块的#xff0c;最后我把发送了消息的订单存到表里#xff0c;因为是定时任务#xff0c;大家可不存 发送订阅消息 | 微信开放文档 /*** 微信平台-商品… 今天写了一个商品到货提醒的job任务具体效果如下 这里用到了微信的发送订阅消息主要代码是这一块的最后我把发送了消息的订单存到表里因为是定时任务大家可不存 发送订阅消息 | 微信开放文档 /*** 微信平台-商品到货通知*/public String uploadArrival(WxOrderArrivalDTO wxOrderArrivalDTO) throws ParseException {String url https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token wechatManager.getaccessToken();JSONObject body new JSONObject();JSONObject data new JSONObject();SimpleDateFormat sdf new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);String date sdf.format(DateUtil.now());data.put(time4,new JSONObject().fluentPut(value,date));data.put(character_string5, new JSONObject().fluentPut(value,wxOrderArrivalDTO.getPickupCode()));data.put(amount6,new JSONObject().fluentPut(value,wxOrderArrivalDTO.getOrderAmount() 元));data.put(thing7,new JSONObject().fluentPut(value,wxOrderArrivalDTO.getShopName()) );data.put(short_thing8, new JSONObject().fluentPut(value,自提));body.put(data, data);body.put(touser, wxOrderArrivalDTO.getOpenId());body.put(miniprogram_state, formal);body.put(lang, zh_CN);body.put(template_id, 这里填模板id);String result null;try {result HttpUtil.createPost(url).body(body.toJSONString()).execute().body();log.info(通知微信平台 订单到货接口返回 result);OrderPushMsgDTO orderPushMsgDTO new OrderPushMsgDTO();orderPushMsgDTO.setPushMsgId(UUIDUtils.getUUID());orderPushMsgDTO.setOrderId(wxOrderArrivalDTO.getOrderId());orderPushMsgDTO.setOrderType(CommonKey.CONSTANT_1);JSONObject jsonObject JSON.parseObject(result);int errcode jsonObject.getInteger(errcode);orderPushMsgDTO.setErrCode(String.valueOf(errcode));orderPushMsgBO.save(orderPushMsgDTO);} catch (Exception e) {throw new BizException(e.getMessage());}return result;} 这是微信公众号平台申请的模板其中模板id填到上图中的template_id后面 这是微信官方文档的请求参数示例主要是data里面的数据key是上图详细内容里的time4thing7... 然后遇到一个问题就是给data塞值的时候刚开始采用的是第二种方法发现没塞进去用下图框中的写法就可以了 后面又写了个公众号的效果如下 这个用法的是微信的模板消息大致写法都一样就是tocken要用公众号的tocken用小程序的tocken会报错48001还有如果不是一个模板id代码里记得换不然会报错40037。模板有数据是枚举的拼接返回消息的时候要对应上 模板消息 | 微信开放文档 public String uploadArrivalOfficialAccountPush(WxOrderArrivalDTO wxOrderArrivalDTO){WechatInfoDTO weChatAccessToken authUtil.getWeChatAccessToken();String url https://api.weixin.qq.com/cgi-bin/message/template/send?access_token weChatAccessToken.getAccessToken();ListOrderItemDTO itemList orderItemDao.queryListOrderItemByOrderIdList(Arrays.asList(wxOrderArrivalDTO.getOrderId()));ListShopGoodsDTO shopGoodsDTOS this.shopGoodsBo.queryGoodsByIdList(itemList.stream().map(OrderItemDTO::getGoodsId).collect(Collectors.toList()));if (ObjectUtil.isNull(shopGoodsDTOS)) {return null;}MapString, ShopGoodsDTO shopGoodsDTOMap shopGoodsDTOS.stream().distinct().collect(Collectors.toMap(ShopGoodsDTO::getGoodsId, Function.identity(), (oldValue, newValue) - oldValue));ListShopGoodsSpeciInfoDTO speciInfoList shopGoodsSpeciInfoBO.queryGoodsSpeciInfoByIdList(itemList.stream().map(OrderItemDTO::getGoodsSpeciId).collect(Collectors.toList()));StringBuffer goodNamesnew StringBuffer();int size speciInfoList.size();for (int i 0; i size; i) {ShopGoodsSpeciInfoDTO temp speciInfoList.get(i);String goodsName shopGoodsDTOMap.get(temp.getGoodsId()).getGoodsName();goodNames.append(goodsName);if (i size - 1) {goodNames.append(、);}}if(goodNames.toString().length()20){wxOrderArrivalDTO.setItemDesc(goodNames.toString().substring(0,10)ELLIPSIS_3);}else{wxOrderArrivalDTO.setItemDesc(goodNames.toString());}JSONObject body new JSONObject();JSONObject data new JSONObject();SimpleDateFormat sdf new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);String date sdf.format(DateUtil.now());data.put(time1,new JSONObject().fluentPut(value,date));data.put(thing2,new JSONObject().fluentPut(value,wxOrderArrivalDTO.getItemDesc()));data.put(amount3,new JSONObject().fluentPut(value,wxOrderArrivalDTO.getOrderAmount() 元));data.put(thing4,new JSONObject().fluentPut(value,wxOrderArrivalDTO.getShopName()) );data.put(const5, new JSONObject().fluentPut(value,CommonKey.CONSTANT_3.equals(wxOrderArrivalDTO.getDeliveryMethod()) ? 用户自提 : 商家配送));body.put(data, data);body.put(url, officialAccountPushUrl);body.put(touser, wxOrderArrivalDTO.getOpenId());body.put(template_id, 这里填模板id);String result null;try {result HttpUtil.createPost(url).body(body.toJSONString()).execute().body();log.info(通知微信平台 订单到货接口返回 result);OrderPushMsgDTO orderPushMsgDTO new OrderPushMsgDTO();orderPushMsgDTO.setPushMsgId(UUIDUtils.getUUID());orderPushMsgDTO.setOrderId(wxOrderArrivalDTO.getOrderId());orderPushMsgDTO.setOrderType(CommonKey.CONSTANT_1);JSONObject jsonObject JSON.parseObject(result);orderPushMsgDTO.setPushType(CommonKey.CONSTANT_2);int errcode jsonObject.getInteger(errcode);orderPushMsgDTO.setErrCode(String.valueOf(errcode));orderPushMsgBO.save(orderPushMsgDTO);} catch (Exception e) {throw new BizException(e.getMessage());}return result;} 获取公众号的tocken要注意是urljson的形式 开始开发 / 获取 Stable Access token public WechatInfoDTO getWeChatAccessToken() {MapString,Object requestUrlParamnew HashMapString,Object();//appIdrequestUrlParam.put(appid, wechatAppId);//appSecretrequestUrlParam.put(secret, wechatSecret);//默认参数requestUrlParam.put(grant_type, client_credential);ObjectMapper objectMapper new ObjectMapper();String json null;try {json objectMapper.writeValueAsString(requestUrlParam);} catch (JsonProcessingException e) {e.printStackTrace();}//发送post请求读取调用微信接口获取accessToken信息String result HttpUtil.post(https://api.weixin.qq.com/cgi-bin/stable_token, json);JSONObject jsonObject JSONObject.parseObject(result);Integer errcode jsonObject.getInteger(errcode);if (errcode ! null errcode ! 0) {String errmsg jsonObject.getString(errmsg);log.error(result);throw new BizException(ResultCode.FAIL,errmsg);}return new WechatInfoDTO().setAccessToken(jsonObject.getString(access_token));}
http://www.pierceye.com/news/681490/

相关文章:

  • 专业网站建设公创建app软件
  • 佛山哪家网站建设比较好互联网内容服务商有哪些
  • 商家在携程旅游网站怎样做宣传ppt免费下载素材库
  • 下载建设银行官方网站下载网站模块介绍
  • 网站定制开发公司推荐网站续费问题
  • 专注七星彩网站开发出租云服务器上建网站
  • 天津做网站.都找津坤科技中国菲律宾历史战绩
  • 网站建设合同的效力网站建设公司需要交税么
  • 色弱可以做网站开发吗建网站的步骤及方法
  • 卖衣服的网站排名discuz分类信息模板
  • 广西网站开发公司招聘网页制作软件
  • 网站框架一般用什么做dede搭建网站教程
  • 郑州网站开发比较好的网络公司网络推广公司有多少家
  • 银川做网站服务免费word模板
  • 个人网站备案方法网站开发制作云盘
  • 培训做网站传奇手游发布网站
  • 中国保密在线网站培训系统手机购物平台
  • 厦门网站制作建设沐风 wordpress 主题
  • 网站选择城市怎么做北京招聘信息
  • 一个做搞笑类视频的网站取名手机端企业网站源码
  • 房地产网站模板网站建设论文范文
  • 任丘网站制作公司pc网站制作公司
  • 惠州城乡规划建设局网站工程公司经营范围
  • 淮南服装网站建设地址巴彦淖尔网站建设公司
  • 如何让自己的网站被百度收录wordpress 悬浮网易云
  • 天津展示型网站建设外包腾讯云wordpress镜像
  • python做网站点登入没反映wordpress母公司
  • 中国建设培训网站查询系统地产项目网站建设ppt
  • 温州高端网站建设网站开发实验心得
  • 设计参考网站有哪些陕西省西安市事业单位招聘网