| @@ -157,6 +157,7 @@ public class WxUserGrantController extends BaseController { | |||
| String openId = null; | |||
| String unionId = null; | |||
| boolean bHaveUnionId = false; | |||
| Long userId = null; | |||
| try { | |||
| WxMaJscode2SessionResult session = wxMaService.jsCode2SessionInfo(code); | |||
| @@ -200,6 +201,7 @@ public class WxUserGrantController extends BaseController { | |||
| user1 = wxCUserService.getByOpenId(user); | |||
| } | |||
| if (user1 != null) { | |||
| userId = user1.getId(); | |||
| token = user1.createToken(new Date()); | |||
| resultMap.put("token", token); | |||
| @@ -254,6 +256,7 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, user1); | |||
| } else { | |||
| userId = user.getId(); | |||
| user.setTenantId(wxAuthorizerInfo.getTenantId()); | |||
| token = user.createToken(new Date()); | |||
| @@ -303,6 +306,23 @@ public class WxUserGrantController extends BaseController { | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, user); | |||
| } | |||
| //用户登陆后 更新最后一次活跃时间 | |||
| if (userId != null) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(userId); | |||
| if (wxCUserBasicInfo != null) { | |||
| WxCUserBasicInfo basicInfo = new WxCUserBasicInfo(); | |||
| basicInfo.setId(userId); | |||
| basicInfo.setActiveTime(new Date()); | |||
| wxCUserBasicInfoService.update(basicInfo); | |||
| } | |||
| WxCUser wxCUser = wxCUserService.getById(userId); | |||
| if (wxCUser != null) { | |||
| WxCUser cUser = new WxCUser(); | |||
| cUser.setId(userId); | |||
| cUser.setActiveTime(new Date()); | |||
| wxCUserService.saveOrUpdate(cUser); | |||
| } | |||
| } | |||
| resultMap.put("score", score); | |||
| resultMap.put("credit", credit); | |||
| @@ -108,6 +108,9 @@ public class WxCUser implements Serializable { | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /*上次活跃时间*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @@ -523,6 +526,14 @@ public class WxCUser implements Serializable { | |||
| this.credit = credit; | |||
| } | |||
| public Date getActiveTime() { | |||
| return activeTime; | |||
| } | |||
| public void setActiveTime(Date activeTime) { | |||
| this.activeTime = activeTime; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -556,6 +567,7 @@ public class WxCUser implements Serializable { | |||
| ,ExtraInfo_ASC("`extra_info` ASC"),ExtraInfo_DESC("`extra_info` DESC") | |||
| ,IsSubscribe_ASC("`is_subscribe` ASC"),IsSubscribe_DESC("`is_subscribe` DESC") | |||
| ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | |||
| ,ActiveTime_ASC("`active_time` ASC"),ActiveTime_DESC("`active_time` DESC") | |||
| ; | |||
| private String value; | |||
| @@ -80,10 +80,14 @@ public class WxCUserBasicInfo implements Serializable { | |||
| private String addressStr; | |||
| /**更新时间**/ | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /**上次活跃时间**/ | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| /**创建时间**/ | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @@ -316,6 +320,14 @@ public class WxCUserBasicInfo implements Serializable { | |||
| this.credit = credit; | |||
| } | |||
| public Date getActiveTime() { | |||
| return activeTime; | |||
| } | |||
| public void setActiveTime(Date activeTime) { | |||
| this.activeTime = activeTime; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -332,6 +344,7 @@ public class WxCUserBasicInfo implements Serializable { | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | |||
| ,ActiveTime_ASC("`active_time` ASC"),ActiveTime_DESC("`active_time` DESC") | |||
| ; | |||
| private String value; | |||
| @@ -18,11 +18,12 @@ | |||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`name`,`level`,`nick_name`,`credit` | |||
| `create_date`,`update_date`,`tenant_id`,`name`,`level`,`nick_name`,`credit`,`active_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -250,12 +251,13 @@ | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| <result column="tags" jdbcType="VARCHAR" property="tags"/> | |||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||
| </resultMap> | |||
| <sql id="allVoColumns"> | |||
| cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`, | |||
| cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`, | |||
| cut.`tags`,cu.`credit` | |||
| cut.`tags`,cu.`credit`,cu.`active_time` | |||
| </sql> | |||
| <sql id="dynamicVoWhereConditions"> | |||
| @@ -44,6 +44,7 @@ | |||
| <result column="subs_subscribe_time" jdbcType="TIMESTAMP" property="subsSubscribeTime"/> | |||
| <result column="subs_subscribe_scene" jdbcType="VARCHAR" property="subsSubscribeScene"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -54,7 +55,7 @@ | |||
| `login_count`, `extra_info`, `is_subscribe`, | |||
| `open_app_id`, | |||
| `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`, | |||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit` | |||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit`,`active_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||