| | |
| | | package com.ltkj.web.controller.app; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import org.aspectj.bridge.MessageWriter; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import sun.misc.BASE64Decoder; |
| | |
| | | |
| | | /** |
| | | * 小程序登录 |
| | | * |
| | | * @param code 小程序wx.login返回的临时凭证 |
| | | * @return |
| | | */ |
| | |
| | | Wxuser one = wxuserService.getOne(wq); |
| | | return AjaxResult.success(one); |
| | | } |
| | | |
| | | /** |
| | | * 微信手机号码绑定 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 发送请求用code换取sessionKey和相关信息 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return response; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/wx/wxbindphone") |
| | | @ApiOperation("手动绑定手机号接口") |
| | | @Transactional |
| | | public AjaxResult wxbindphone(@RequestParam @ApiParam(value = "openId") String openId, |
| | | @RequestParam @ApiParam(value = "phone") String phone) { |
| | | |
| | | LambdaQueryWrapper<Wxuser> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(Wxuser::getOpenid, openId); |
| | | Wxuser one = wxuserService.getOne(wq); |
| | | |
| | | if (one!=null){ |
| | | one.setPhone(phone); |
| | | one.setUpdateTime(new DateTime()); |
| | | final boolean b = wxuserService.updateById(one); |
| | | if (b){ |
| | | return AjaxResult.success("绑定成功!"); |
| | | } |
| | | } |
| | | return AjaxResult.error("绑定失败!"); |
| | | } |
| | | |
| | | } |
| | | |