新增字段:累计登录次数loginNum
This commit is contained in:
@@ -61,6 +61,7 @@ public class MpController extends BaseController {
|
||||
public ApiResult<?> getMpInfo() {
|
||||
final Integer tenantId = getTenantId();
|
||||
String key = "MpInfo:" + tenantId;
|
||||
System.out.println("key = " + key);
|
||||
final String mpInfo = redisUtil.get(key);
|
||||
|
||||
if (tenantId.equals(0)) {
|
||||
@@ -82,7 +83,7 @@ public class MpController extends BaseController {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取小程序信息
|
||||
final Mp mp = mpService.getOne(new LambdaQueryWrapper<Mp>().eq(Mp::getTenantId, tenantId).last("limit 1"));
|
||||
final Mp mp = mpService.getOne(new LambdaQueryWrapper<Mp>().last("limit 1"));
|
||||
mp.setAppSecret(null);
|
||||
map.put("mp", mp);
|
||||
|
||||
|
||||
@@ -36,6 +36,31 @@ public class RequestUtil {
|
||||
ACCESS_TOKEN = token;
|
||||
}
|
||||
|
||||
// 更新用户信息
|
||||
public void updateUser(User user){
|
||||
// 设置租户ID
|
||||
setTenantId(user.getTenantId().toString());
|
||||
// 设置token
|
||||
setAccessToken(user.getAccessToken());
|
||||
// 余额支付接口
|
||||
String path = "/login/auth/user";
|
||||
System.out.println("user2222 = " + user.getCreateTime());
|
||||
try {
|
||||
// 链式构建请求
|
||||
final String body = HttpRequest.put(host.concat(path))
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.header("Authorization", ACCESS_TOKEN)
|
||||
.body(JSONUtil.toJSONString(user))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
System.out.println("body = " + body);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 预付请求付款(余额支付)
|
||||
public Object balancePay(Order order){
|
||||
// 设置租户ID
|
||||
|
||||
@@ -252,6 +252,9 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("微信unionid")
|
||||
private String unionid;
|
||||
|
||||
@ApiModelProperty(value = "累计登录次数")
|
||||
private Integer loginNum;;
|
||||
|
||||
@ApiModelProperty("ico文件")
|
||||
@TableField(exist = false)
|
||||
private String logo;
|
||||
@@ -272,6 +275,10 @@ public class User implements UserDetails {
|
||||
@TableField(exist = false)
|
||||
private MerchantAccount merchantAccount;
|
||||
|
||||
@ApiModelProperty(value = "登录令牌")
|
||||
@TableField(exist = false)
|
||||
private String accessToken;
|
||||
|
||||
// @ApiModelProperty("企业信息")
|
||||
// @TableField(exist = false)
|
||||
// private Company companyInfo;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -201,8 +202,8 @@ public class CashierController extends BaseController {
|
||||
if (ObjectUtil.isEmpty(getLoginUser())) {
|
||||
return success("请先登录",null);
|
||||
}
|
||||
final int groupId = Integer.parseInt(getLoginUserId().toString() + RandomUtil.randomInt(1, 100));
|
||||
final boolean update = cashierService.update(new LambdaUpdateWrapper<Cashier>().eq(Cashier::getGroupId, 0).eq(Cashier::getCashierId, getLoginUserId()).set(Cashier::getGroupId, groupId));
|
||||
final long timeMillis = System.currentTimeMillis();
|
||||
final boolean update = cashierService.update(new LambdaUpdateWrapper<Cashier>().eq(Cashier::getGroupId, 0).eq(Cashier::getCashierId, getLoginUserId()).set(Cashier::getGroupId, timeMillis/1000));
|
||||
|
||||
return success("操作成功",update);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import com.gxwebsoft.shop.entity.Users;
|
||||
@@ -20,7 +23,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -38,6 +43,8 @@ import java.util.Map;
|
||||
public class UsersController extends BaseController {
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
@@ -64,11 +71,11 @@ public class UsersController extends BaseController {
|
||||
@PreAuthorize("hasAnyAuthority('sys:auth:user')")
|
||||
@ApiOperation("根据手机查询用户")
|
||||
@GetMapping("/getByPhone")
|
||||
public ApiResult<Users> getByPhone(UsersParam param) {
|
||||
public ApiResult<Users> getByPhone(UsersParam param, HttpServletRequest request) {
|
||||
Users result;
|
||||
final List<Users> users = usersService.listRel(param);
|
||||
if (users.isEmpty()) {
|
||||
// 同步注册用户
|
||||
// 新用户注册
|
||||
final Users addUsers = new Users();
|
||||
addUsers.setPhone(param.getPhone());
|
||||
addUsers.setUsername("微信用户");
|
||||
@@ -79,7 +86,6 @@ public class UsersController extends BaseController {
|
||||
addUsers.setCountry("");
|
||||
addUsers.setProvince("");
|
||||
addUsers.setCity("");
|
||||
long longValue = System.currentTimeMillis() / 1000;
|
||||
usersService.save(addUsers);
|
||||
result = addUsers;
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,9 @@ public class Cashier implements Serializable {
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private String spec;
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ public class CashierParam extends BaseParam {
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private String spec;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user