| | |
| | | package com.yeshi.makemoney.app.controller.admin; |
| | | |
| | | import com.yeshi.makemoney.app.Application; |
| | | import com.yeshi.makemoney.app.service.inter.AdminUserService; |
| | | import com.yeshi.makemoney.app.utils.ImageUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | |
| | | import org.yeshi.utils.entity.FileUploadResult; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | @Controller |
| | | @RequestMapping("/admin/api/file") |
| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornPriceCountType; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import com.yeshi.makemoney.app.vo.admin.goldcorn.GoldCornGetPriceAdminVO; |
| | | import net.sf.json.JSONArray; |
| | |
| | | |
| | | @Override |
| | | public JsonElement serialize(GoldCornGetType value, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return value == null ? new JsonPrimitive("") : new JsonPrimitive(value.getName()); |
| | | } |
| | | }).registerTypeAdapter(GoldCornPriceCountType.class, new JsonSerializer<GoldCornPriceCountType>() { |
| | | |
| | | @Override |
| | | public JsonElement serialize(GoldCornPriceCountType value, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return value == null ? new JsonPrimitive("") : new JsonPrimitive(value.getName()); |
| | | } |
| | | }).create(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getPriceTypes") |
| | | public String getPriceTypes(HttpSession session) { |
| | | @RequestMapping("getCountTypeList") |
| | | public String getCountTypeList() { |
| | | JSONArray array = new JSONArray(); |
| | | for (GoldCornGetType type : GoldCornGetType.values()) { |
| | | for (GoldCornPriceCountType type : GoldCornPriceCountType.values()) { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("key", type.name()); |
| | | json.put("value", type.getName()); |
| | |
| | | } |
| | | return JsonUtil.loadTrueResult(array); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.controller.admin.goldcorn; |
| | | |
| | | import com.google.gson.*; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornTaskTypeInfoService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornTaskTypeInfoQuery; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import com.yeshi.makemoney.app.vo.admin.goldcorn.GoldCornTaskTypeInfoAdminVO; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("/admin/api/goldcorn/task") |
| | | public class GoldCornTaskTypeInfoAdminController { |
| | | |
| | | @Resource |
| | | private GoldCornTaskTypeInfoService goldCornTaskTypeInfoService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("list") |
| | | public String list(GoldCornTaskTypeInfoQuery query, int page, int limit ) { |
| | | List<GoldCornTaskTypeInfo> list = goldCornTaskTypeInfoService.list(query,page,limit); |
| | | long count = goldCornTaskTypeInfoService.count(query); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | |
| | | @Override |
| | | public JsonElement serialize(Date date, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return date == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(date.getTime(), "yyyy.MM.dd HH:mm")); |
| | | } |
| | | }).create(); |
| | | |
| | | data.put("list", gson.toJson(list)); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(String ids) { |
| | | Type type = new TypeToken<List<String>>(){}.getType(); |
| | | List<String> idList=new Gson().fromJson(ids,type); |
| | | goldCornTaskTypeInfoService.delete(idList); |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("add") |
| | | |
| | | public String add(GoldCornTaskTypeInfoAdminVO vo, AcceptAdminData acceptAdminData) { |
| | | try{ |
| | | goldCornTaskTypeInfoService.add(vo.toEntity(acceptAdminData.getSystem())); |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | }catch(Exception e){ |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("get") |
| | | public String get(String id, AcceptAdminData acceptAdminData) { |
| | | GoldCornTaskTypeInfo entity = goldCornTaskTypeInfoService.get(id); |
| | | if (entity !=null){ |
| | | return JsonUtil.loadTrueResult(GoldCornTaskTypeInfoAdminVO.create( entity)); |
| | | |
| | | } else { |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("update") |
| | | |
| | | public String update( GoldCornTaskTypeInfoAdminVO vo ,AcceptAdminData acceptAdminData) { |
| | | if (vo.getId() == null) { |
| | | return JsonUtil.loadFalseResult("ID不能为空"); |
| | | } |
| | | try{ |
| | | goldCornTaskTypeInfoService.update(vo.toEntity(null)); |
| | | }catch(Exception e){ |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getTypeList") |
| | | public String getTypeList() { |
| | | JSONArray array = new JSONArray(); |
| | | for (GoldCornGetType type : GoldCornGetType.values()) { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("key", type.name()); |
| | | json.put("value", type.getName()); |
| | | array.add(json); |
| | | } |
| | | return JsonUtil.loadTrueResult(array); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.dto.goldcorn.GoldCornMakeResultDTO; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.*; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornConsumeRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetPriceService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.*; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornTaskTypeInfoQuery; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | | import com.yeshi.makemoney.app.utils.annotation.UserLogin; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | |
| | | private UserExtraInfoService userExtraInfoService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Resource |
| | | private GoldCornTaskTypeInfoService goldCornTaskTypeInfoService; |
| | | |
| | | @Resource |
| | | private GoldCornGetFrequencyConfigService goldCornGetFrequencyConfigService; |
| | | |
| | | private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create(); |
| | | |
| | |
| | | |
| | | try { |
| | | JSONObject data = new JSONObject(); |
| | | Integer result = null; |
| | | GoldCornMakeResultDTO result = null; |
| | | if (vo.getType() == GoldCornGetType.watchVideo) { |
| | | result = goldCornMakeService.watchVideo(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | result = goldCornMakeService.watchVideo(uid, vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.readNovel) { |
| | | result = goldCornMakeService.readNovel(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | result = goldCornMakeService.readNovel(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.scanNews) { |
| | | result = goldCornMakeService.scanNews(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getNum()); |
| | | result = goldCornMakeService.scanNews(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getNum()); |
| | | } else { |
| | | return JsonUtil.loadFalseResult("任务类型出错"); |
| | | } |
| | | data.put("goldCorn", result); |
| | | |
| | | data.put("goldCorn", result.getGoldCorn()); |
| | | data.put("leftCount", result.getLeftEventCount()); |
| | | return JsonUtil.loadTrueResult(data); |
| | | |
| | | } catch (GoldCornGetPriceException e) { |
| | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取任务信息 |
| | | * @date 18:58 2022/4/28 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: vo |
| | | **/ |
| | | @RequestMapping("getTaskInfo") |
| | | @ResponseBody |
| | | public String getTaskInfo(AcceptData acceptData, Long uid, String type) { |
| | | |
| | | GoldCornGetType goldCornGetType = GoldCornGetType.valueOf(type); |
| | | if (goldCornGetType == null) { |
| | | return JsonUtil.loadFalseResult("类型不存在"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | UserInfo user = null; |
| | | if (uid != null) { |
| | | user = userInfoService.get(uid); |
| | | } |
| | | //获取单价 |
| | | GoldCornGetPrice price = goldCornGetPriceService.getCountPrice(goldCornGetType, user, acceptData.getSystem(), now); |
| | | boolean finish = true; |
| | | if (uid != null) { |
| | | try { |
| | | if (goldCornMakeService.frequencyVerify(user, goldCornGetType, now) > 0) { |
| | | finish = false; |
| | | } |
| | | } catch (GoldCornGetFrequencyConfigException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornMakeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | finish = false; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("price", price.getCornNum()); |
| | | data.put("finish", finish); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取任务列表 |
| | | * @date 11:27 2022/4/28 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | **/ |
| | | @RequestMapping("getTaskList") |
| | | @ResponseBody |
| | | public String getTaskList(AcceptData acceptData, Long uid) { |
| | | Date now = new Date(); |
| | | |
| | | GoldCornTaskTypeInfoQuery query = new GoldCornTaskTypeInfoQuery(); |
| | | query.setSystem(acceptData.getSystem()); |
| | | query.setShow(true); |
| | | query.setShowTime(now); |
| | | |
| | | List<GoldCornTaskTypeInfo> list = goldCornTaskTypeInfoService.list(query, 1, 100); |
| | | |
| | | List<GoldCornTaskVO> voList = new ArrayList<>(); |
| | | if (list != null) { |
| | | UserInfo user = null; |
| | | if (uid != null) { |
| | | user = userInfoService.get(uid); |
| | | } |
| | | //查询价格 |
| | | List<GoldCornGetType> typeList = list.stream().map(item -> { |
| | | return item.getType(); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Map<GoldCornGetType, GoldCornGetPrice> priceMap = goldCornGetPriceService.getCountPrice(typeList, user, acceptData.getSystem(), now); |
| | | |
| | | Map<GoldCornGetType, Long> processMap = new HashMap<>(); |
| | | if (uid != null) { |
| | | GoldCornGetRecordQuery goldCornGetRecordQuery = new GoldCornGetRecordQuery(); |
| | | goldCornGetRecordQuery.setUid(uid); |
| | | goldCornGetRecordQuery.setDay(GoldCornUtil.getFormatDay(now)); |
| | | //获取今日的进度 |
| | | processMap = goldCornGetRecordService.sumEventCount(goldCornGetRecordQuery); |
| | | } |
| | | List<GoldCornGetFrequencyConfig> frequencyConfigs = goldCornGetFrequencyConfigService.listByTypes(typeList, acceptData.getSystem(), now); |
| | | Map<GoldCornGetType, GoldCornGetFrequencyConfig> frequencyConfigsMaps = frequencyConfigs.stream().collect(Collectors.toMap(GoldCornGetFrequencyConfig::getType, config -> config)); |
| | | |
| | | |
| | | for (GoldCornTaskTypeInfo task : list) { |
| | | if (priceMap.get(task.getType()) == null) { |
| | | continue; |
| | | } |
| | | if (frequencyConfigsMaps.get(task.getType()) == null) { |
| | | continue; |
| | | } |
| | | GoldCornTaskVO vo = GoldCornTaskVO.create(task, priceMap.get(task.getType()), frequencyConfigsMaps.get(task.getType()), processMap.get(task.getType())); |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", JsonUtil.getSimpleGson().toJson(voList)); |
| | | data.put("count", voList.size()); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取签到信息 |
| | | * @date 17:12 2022/4/21 |
| | | * @param: acceptData |
| | |
| | | @ResponseBody |
| | | @RequestMapping("sendSMS") |
| | | public String sendSMS(AcceptData acceptData, String phone) { |
| | | if (StringUtil.isMobile(phone)) { |
| | | if (!StringUtil.isMobile(phone)) { |
| | | return JsonUtil.loadFalseResult("手机号格式错误"); |
| | | } |
| | | String key = "sendsms-" + phone; |
| | |
| | | import com.yeshi.makemoney.app.entity.team.TeamInviteRelation; |
| | | import com.yeshi.makemoney.app.entity.team.UserSpreadImg; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException; |
| | | import com.yeshi.makemoney.app.exception.team.SpreadImgException; |
| | | import com.yeshi.makemoney.app.exception.team.TeamInviteRelationException; |
| | | import com.yeshi.makemoney.app.exception.team.UserSpreadImgException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.inter.team.UserSpreadImgService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.ThreadUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private UserSpreadImgService userSpreadImgService; |
| | | |
| | | @Resource |
| | | private GoldCornMakeService goldCornMakeService; |
| | | |
| | | |
| | | /** |
| | |
| | | } catch (TeamInviteRelationException e) { |
| | | return JsonUtil.loadFalseResult("加入出错"); |
| | | } |
| | | //添加金币 |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | goldCornMakeService.inviteFriends(bossUid, userInfoService.get(uid), new Date()); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetPriceException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornMakeException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetFrequencyConfigException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(UserInfoVO.create(bossUser)); |
| | |
| | | return JsonUtil.loadFalseResult("无分享图"); |
| | | } |
| | | |
| | | JSONObject data=new JSONObject(); |
| | | data.put("list",urlList); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", urlList); |
| | | |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.yeshi.makemoney.app.dto.user.LoginInfoDTO; |
| | | import com.yeshi.makemoney.app.entity.APPPlatform; |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserLoginRecord; |
| | |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.vip.VIPService; |
| | | import com.yeshi.makemoney.app.service.manager.PushManager; |
| | | import com.yeshi.makemoney.app.service.manager.VerifyCodeManager; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | | import com.yeshi.makemoney.app.utils.ImageUtil; |
| | |
| | | @Resource |
| | | private VerifyCodeManager verifyCodeManager; |
| | | |
| | | // @Reference(version = "1.0", check = false) |
| | | private BDeviceTokenService bDeviceTokenService; |
| | | @Resource |
| | | private PushManager pushManager; |
| | | |
| | | @Resource |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | |
| | | public void run() { |
| | | try { |
| | | //登录成功 |
| | | bDeviceTokenService.bindUid(acceptData.getSystem().name(), acceptData.getUtdId(), userInfo.getId() + ""); |
| | | pushManager.bindUid(acceptData.getSystem(), userInfo.getId(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId()); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | |
| | | public String logout(AcceptData acceptData, Long uid) { |
| | | try { |
| | | //解绑UID |
| | | bDeviceTokenService.unBindUid(acceptData.getSystem().name(), acceptData.getUtdId()); |
| | | pushManager.unBind(acceptData.getSystem(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @RequestMapping("uploadPushRegId") |
| | | public String uploadPushRegId(AcceptData acceptData, Long uid, String regId) { |
| | | |
| | | BPushDeviceToken deviceToken = new BPushDeviceToken(); |
| | | deviceToken.setAppCode(acceptData.getSystem().name()); |
| | | deviceToken.setDeviceId(acceptData.getUtdId()); |
| | | deviceToken.setBuildModel(acceptData.getDeviceType()); |
| | | deviceToken.setBuildVersion(acceptData.getOsVersion()); |
| | | deviceToken.setToken(regId); |
| | | deviceToken.setType(PushPlatform.jpush); |
| | | if (uid != null) { |
| | | deviceToken.setUid(uid + ""); |
| | | } |
| | | deviceToken.setVersionCode(acceptData.getVersion()); |
| | | |
| | | try { |
| | | bDeviceTokenService.save(deviceToken); |
| | | pushManager.saveToken(acceptData, uid, regId); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (BPushDeviceTokenException e) { |
| | | return JsonUtil.loadTrueResult(e.getMessage()); |
| | | return JsonUtil.loadTrueResult("业务出错"); |
| | | } catch (ParamsException e) { |
| | | return JsonUtil.loadTrueResult(e.getMessage()); |
| | | return JsonUtil.loadTrueResult("参数错误"); |
| | | } |
| | | |
| | | } |
| | |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | |
| | | if (daoQuery.typeList != null && daoQuery.typeList.size() > 0) { |
| | | Criteria[] ors = new Criteria[daoQuery.typeList.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("type").is(daoQuery.typeList.get(i)); |
| | | } |
| | | andList.add(new Criteria().orOperator(ors)); |
| | | } |
| | | |
| | | if (daoQuery.maxValidateTime != null) { |
| | | andList.add(Criteria.where("validateTime").lt(daoQuery.maxValidateTime)); |
| | | } |
| | |
| | | public static class DaoQuery { |
| | | public SystemEnum system; |
| | | public GoldCornGetType type; |
| | | public List<GoldCornGetType> typeList; |
| | | public Date maxValidateTime; |
| | | public Date minValidateTime; |
| | | public int start; |
| | |
| | | package com.yeshi.makemoney.app.dao.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornPriceCountType; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | |
| | | if (bean.getType() != null) { |
| | | update.set("type", bean.getType()); |
| | | } |
| | | |
| | | if (bean.getCountType() != null) { |
| | | update.set("countType", bean.getCountType()); |
| | | } |
| | | |
| | | if (bean.getCornNum() != null) { |
| | | update.set("cornNum", bean.getCornNum()); |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.dao.goldcorn; |
| | | |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | |
| | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | |
| | | import java.lang.Integer; |
| | | import java.util.ArrayList; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | |
| | |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | /** |
| | | * @return java.util.Map<com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType , java.lang.Long> |
| | | * @author hxh |
| | | * @description 统计事件数量 |
| | | * @date 10:48 2022/4/28 |
| | | * @param: daoQuery |
| | | **/ |
| | | public Map<GoldCornGetType, Long> sumEventCount(DaoQuery daoQuery) { |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(getCriteria(daoQuery))); |
| | | list.add(Aggregation.group("type").sum("eventCount").as("eventCount")); |
| | | list.add(Aggregation.project("type", "eventCount")); |
| | | AggregationResults<Map> results = aggregate(list, Map.class); |
| | | List<Map> mapList = results.getMappedResults(); |
| | | Map<GoldCornGetType, Long> resultMap = new HashMap<>(); |
| | | if (mapList != null) { |
| | | for (Map map : mapList) { |
| | | GoldCornGetType type = GoldCornGetType.valueOf(map.get("_id")+""); |
| | | Long count = (Long) map.get("eventCount"); |
| | | count = count == null ? 0L : count; |
| | | resultMap.put(type, count); |
| | | } |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | |
| | | private Criteria getCriteria(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.uid != null) { |
| | | andList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | if (daoQuery.doubles != null) { |
| | | andList.add(Criteria.where("isDubble").is(daoQuery.doubles)); |
| | | } |
| | | if (daoQuery.maxCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | if (daoQuery.minCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | return new Criteria().andOperator(ands); |
| | | } |
| | | return new Criteria(); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | query.addCriteria(getCriteria(daoQuery)); |
| | | return query; |
| | | } |
| | | |
| | |
| | | public Long fromUid; |
| | | public String fromId; |
| | | public GoldCornGetType type; |
| | | public Boolean doubles; |
| | | public Date maxCreateTime; |
| | | public Date minCreateTime; |
| | | public int start; |
New file |
| | |
| | | package com.yeshi.makemoney.app.dao.goldcorn; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | |
| | | import java.lang.Boolean; |
| | | import java.lang.String; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class GoldCornTaskTypeInfoDao extends MongodbBaseDao<GoldCornTaskTypeInfo> { |
| | | |
| | | public void updateSelective(GoldCornTaskTypeInfo bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.getIcon() != null) { |
| | | update.set("icon", bean.getIcon()); |
| | | } |
| | | if (bean.getSystem() != null) { |
| | | update.set("system", bean.getSystem()); |
| | | } |
| | | if (bean.getType() != null) { |
| | | update.set("type", bean.getType()); |
| | | } |
| | | |
| | | if (bean.getOrder() != null) { |
| | | update.set("order", bean.getOrder()); |
| | | } |
| | | |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | if (bean.getShow() != null) { |
| | | update.set("show", bean.getShow()); |
| | | } |
| | | if (bean.getStartTime() != null) { |
| | | update.set("startTime", bean.getStartTime()); |
| | | } |
| | | if (bean.getEndTime() != null) { |
| | | update.set("endTime", bean.getEndTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<GoldCornTaskTypeInfo> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(Sort.by(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.system != null) { |
| | | andList.add(Criteria.where("system").is(daoQuery.system)); |
| | | } |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | if (daoQuery.show != null) { |
| | | andList.add(Criteria.where("show").is(daoQuery.show)); |
| | | } |
| | | |
| | | if (daoQuery.showTime != null) { |
| | | andList.add(Criteria.where("startTime").lte(daoQuery.showTime).and("endTime").gt(daoQuery.showTime)); |
| | | } |
| | | |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public SystemEnum system; |
| | | public GoldCornGetType type; |
| | | public Boolean show; |
| | | public Date showTime; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.dto.goldcorn; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornMakeResult |
| | | * @description: 挣金币结果 |
| | | * @date 2022/4/28 11:17 |
| | | */ |
| | | public class GoldCornMakeResultDTO { |
| | | |
| | | private Integer goldCorn; |
| | | |
| | | //剩余的事件数量 |
| | | private Long leftEventCount; |
| | | |
| | | public GoldCornMakeResultDTO(Integer goldCorn, Long leftEventCount) { |
| | | this.goldCorn = goldCorn; |
| | | this.leftEventCount = leftEventCount; |
| | | } |
| | | |
| | | public Integer getGoldCorn() { |
| | | return goldCorn; |
| | | } |
| | | |
| | | public void setGoldCorn(Integer goldCorn) { |
| | | this.goldCorn = goldCorn; |
| | | } |
| | | |
| | | public Long getLeftEventCount() { |
| | | return leftEventCount; |
| | | } |
| | | |
| | | public void setLeftEventCount(Long leftEventCount) { |
| | | this.leftEventCount = leftEventCount; |
| | | } |
| | | } |
| | |
| | | * @date 2022/4/2 14:10 |
| | | */ |
| | | public enum AppJumpType { |
| | | web, baichuan; |
| | | //邀请 |
| | | invite, |
| | | //短视频 |
| | | drawVideo, |
| | | //资讯 |
| | | news, |
| | | //小说 |
| | | novel, |
| | | //提现 |
| | | extract, |
| | | //签到 |
| | | signIn, |
| | | //网页 |
| | | web, |
| | | //百川 |
| | | baichuan; |
| | | } |
| | |
| | | tencentVerifySMSTemplate(SystemConfigType.system, "腾讯云验证码短信模板"), |
| | | testAccount(SystemConfigType.system, "测试账号"), |
| | | appLink(SystemConfigType.system, "应用二合一链接"), |
| | | androidPushAppCode(SystemConfigType.system, "android推送应用编码"), |
| | | |
| | | //返回给前端的数据 |
| | | kefu(SystemConfigType.common, "客服链接"), |
| | |
| | | teamFirstDivideRate(SystemConfigType.team, "团队一级分成比例(0-1)"), |
| | | teamSecondDivideRate(SystemConfigType.team, "团队二级分成比例(0-1)"), |
| | | //金币设置 |
| | | signInGoldCorn(SystemConfigType.goldCorn,"连续签到金币分布"), |
| | | signInGoldCorn(SystemConfigType.goldCorn, "连续签到金币分布"), |
| | | |
| | | ; |
| | | |
| | |
| | | @Indexed |
| | | private GoldCornGetType type; |
| | | /** |
| | | * 限制的次数,配合单位使用,表示 每一个unit周期内limitCount次限制 |
| | | * 限制的(次数/分钟数),配合单位使用,表示 每一个unit周期内limitCount次限制 |
| | | */ |
| | | private Integer limitCount; |
| | | private Long limitCount; |
| | | /** |
| | | * 单位 |
| | | */ |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getLimitCount() { |
| | | public Long getLimitCount() { |
| | | return limitCount; |
| | | } |
| | | |
| | | public void setLimitCount(Integer limitCount) { |
| | | public void setLimitCount(Long limitCount) { |
| | | this.limitCount = limitCount; |
| | | } |
| | | |
| | |
| | | * 获得类型 |
| | | */ |
| | | private GoldCornGetType type; |
| | | |
| | | /** |
| | | * 金币数量 |
| | | * 计数类型 |
| | | */ |
| | | private GoldCornPriceCountType countType; |
| | | |
| | | |
| | | /** |
| | | * 金币数量(次/分钟) |
| | | */ |
| | | private Integer cornNum; |
| | | |
| | |
| | | * 备注 |
| | | */ |
| | | private String remarks; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | |
| | | public void setTeamDivide(Boolean teamDivide) { |
| | | this.teamDivide = teamDivide; |
| | | } |
| | | |
| | | |
| | | public GoldCornPriceCountType getCountType() { |
| | | return countType; |
| | | } |
| | | |
| | | public void setCountType(GoldCornPriceCountType countType) { |
| | | this.countType = countType; |
| | | } |
| | | } |
| | |
| | | private Integer cornNum; |
| | | |
| | | /** |
| | | * 时间数量(单位为次/个/秒) |
| | | **/ |
| | | private Long eventCount; |
| | | |
| | | /** |
| | | * 缘由用户ID(当有二级分销时存在) |
| | | **/ |
| | | @Indexed |
| | |
| | | public void setDubble(Boolean dubble) { |
| | | isDubble = dubble; |
| | | } |
| | | |
| | | public Long getEventCount() { |
| | | return eventCount; |
| | | } |
| | | |
| | | public void setEventCount(Long eventCount) { |
| | | this.eventCount = eventCount; |
| | | } |
| | | } |
| | |
| | | * @date 2022/3/31 18:29 |
| | | */ |
| | | public enum GoldCornGetType { |
| | | signIn("签到"), watchVideo("观看视频"), readNovel("读小说"), scanNews("浏览资讯"); |
| | | signIn("签到"), watchVideo("观看视频"), readNovel("读小说"), scanNews("浏览资讯"), invite("邀请好友"),extract("提现"); |
| | | private String name; |
| | | |
| | | private GoldCornGetType(String name) { |
New file |
| | |
| | | package com.yeshi.makemoney.app.entity.goldcorn; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornPriceCountType |
| | | * @description: 计价类型 |
| | | * @date 2022/4/28 12:06 |
| | | */ |
| | | public enum GoldCornPriceCountType { |
| | | |
| | | //时间计数 |
| | | time("时间计数"), |
| | | //次数计数 |
| | | num("次数计数"); |
| | | |
| | | private String name; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | private GoldCornPriceCountType(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.yeshi.makemoney.app.entity.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GolCornGetTypeInfo |
| | | * @description: 获取金币的任务类型信息 |
| | | * @date 2022/4/27 15:51 |
| | | */ |
| | | @Document(collection = "goldCornTaskTypeInfo") |
| | | public class GoldCornTaskTypeInfo { |
| | | |
| | | @Id |
| | | private String id; |
| | | |
| | | private String name; |
| | | |
| | | private String icon; |
| | | |
| | | @Indexed |
| | | private SystemEnum system; |
| | | |
| | | @Indexed |
| | | private GoldCornGetType type; |
| | | |
| | | @Indexed |
| | | private Integer order; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | @Indexed |
| | | private Boolean show; |
| | | @Indexed |
| | | private Date startTime; |
| | | @Indexed |
| | | private Date endTime; |
| | | |
| | | |
| | | public String toId() { |
| | | return system.name() + "-" + type.name(); |
| | | } |
| | | |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(GoldCornGetType type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Boolean getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(Boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Integer getOrder() { |
| | | return order; |
| | | } |
| | | |
| | | public void setOrder(Integer order) { |
| | | this.order = order; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.exception.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class GoldCornTaskTypeInfoException extends BaseException{ |
| | | |
| | | public GoldCornTaskTypeInfoException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetFrequencyConfigDao; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornGetFrequencyConfig> listByTypes(List<GoldCornGetType> typeList, SystemEnum system, Date date) { |
| | | |
| | | Criteria[] ors = new Criteria[typeList.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("type").is(typeList.get(i)); |
| | | } |
| | | |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(new Criteria().orOperator(ors).and("validateTime").lte(date))); |
| | | list.add(Aggregation.sort(Sort.Direction.DESC, "validateTime")); |
| | | list.add(Aggregation.group("type").first("id").as("id")); |
| | | list.add(Aggregation.lookup("goldCornGetFrequencyConfig", "id", "_id", "config")); |
| | | list.add(Aggregation.project("config")); |
| | | AggregationResults<Map> results = goldCornGetFrequencyConfigDao.aggregate(list, Map.class); |
| | | List<GoldCornGetFrequencyConfig> resultList = new ArrayList<>(); |
| | | for (Map map : results.getMappedResults()) { |
| | | List<GoldCornGetFrequencyConfig> config = (List<GoldCornGetFrequencyConfig>) map.get("config"); |
| | | resultList.addAll(config); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornPriceCountType; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetPriceDao; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer getWatchVideoPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException { |
| | | |
| | | //获取价格 |
| | | GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.watchVideo, date); |
| | | public Integer getCountPrice(GoldCornGetType type, UserInfo user, SystemEnum system, Date date, long eventCount) throws GoldCornGetPriceException { |
| | | GoldCornGetPrice getPrice = getPrice(system, type, date); |
| | | if (getPrice == null) { |
| | | throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失"); |
| | | } |
| | | |
| | | int goldCorn = (int) (timeSeconds * getPrice.getCornNum() / 60.0f); |
| | | int goldCorn; |
| | | if (getPrice.getCountType() == GoldCornPriceCountType.time) { |
| | | goldCorn = (int) (eventCount * getPrice.getCornNum() / 60.0f); |
| | | |
| | | //加上团队增益比例 |
| | | if (teamInviteRelationService.getBossUid(user.getId()) != null) { |
| | | goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } else { |
| | | goldCorn = (int) (eventCount * getPrice.getCornNum()); |
| | | } |
| | | |
| | | //加上团队增益比例 |
| | | if (user != null && teamInviteRelationService.getBossUid(user.getId()) != null) { |
| | | goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } |
| | | return goldCorn; |
| | | } |
| | | |
| | | @Override |
| | | public Integer getReadNovelPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException { |
| | | |
| | | //获取价格 |
| | | GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.readNovel, date); |
| | | if (getPrice == null) { |
| | | throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失"); |
| | | public Map<GoldCornGetType, GoldCornGetPrice> getCountPrice(List<GoldCornGetType> typeList, UserInfo user, SystemEnum system, Date date) { |
| | | Map<GoldCornGetType, GoldCornGetPrice> map = new HashMap(); |
| | | for (GoldCornGetType type : typeList) { |
| | | GoldCornGetPrice getPrice = getPrice(system, type, date); |
| | | if (getPrice == null) { |
| | | continue; |
| | | } |
| | | int goldCorn = getPrice.getCornNum(); |
| | | //加上团队增益比例 |
| | | if (user != null && teamInviteRelationService.getBossUid(user.getId()) != null) { |
| | | goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } |
| | | getPrice.setCornNum(goldCorn); |
| | | map.put(type, getPrice); |
| | | } |
| | | |
| | | int goldCorn = (int) (timeSeconds * getPrice.getCornNum() / 60.0f); |
| | | |
| | | //加上团队增益比例 |
| | | if (teamInviteRelationService.getBossUid(user.getId()) != null) { |
| | | goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } |
| | | |
| | | return goldCorn; |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Integer getScanNewsPrice(UserInfo user, Date date, int num) throws GoldCornGetPriceException { |
| | | //获取价格 |
| | | GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.scanNews, date); |
| | | if (getPrice == null) { |
| | | throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失"); |
| | | } |
| | | public GoldCornGetPrice getCountPrice(GoldCornGetType type, UserInfo user, SystemEnum system, Date date) { |
| | | |
| | | int goldCorn = num * getPrice.getCornNum(); |
| | | Map<GoldCornGetType, GoldCornGetPrice> map = getCountPrice(Arrays.asList(new GoldCornGetType[]{type}), user, system, date); |
| | | |
| | | //加上团队增益比例 |
| | | if (teamInviteRelationService.getBossUid(user.getId()) != null) { |
| | | goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } |
| | | |
| | | return goldCorn; |
| | | return map.get(type); |
| | | } |
| | | |
| | | |
| | |
| | | @Resource |
| | | private GoldCornGetRecordDao goldCornGetRecordDao; |
| | | |
| | | @Override |
| | | public List<GoldCornGetRecord> list(GoldCornGetRecordQuery goldCornGetRecordQuery, int page, int pageSize) { |
| | | private DaoQuery createDaoQuery(GoldCornGetRecordQuery goldCornGetRecordQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornGetRecordQuery.getType(); |
| | | daoQuery.uid = goldCornGetRecordQuery.getUid(); |
| | | daoQuery.day=goldCornGetRecordQuery.getDay(); |
| | | daoQuery.dayList=goldCornGetRecordQuery.getDayList(); |
| | | |
| | | |
| | | daoQuery.day = goldCornGetRecordQuery.getDay(); |
| | | daoQuery.doubles = goldCornGetRecordQuery.getDoubles(); |
| | | daoQuery.dayList = goldCornGetRecordQuery.getDayList(); |
| | | daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime(); |
| | | return daoQuery; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornGetRecord> list(GoldCornGetRecordQuery goldCornGetRecordQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = createDaoQuery(goldCornGetRecordQuery); |
| | | |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | |
| | | |
| | | @Override |
| | | public long count(GoldCornGetRecordQuery goldCornGetRecordQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornGetRecordQuery.getType(); |
| | | daoQuery.uid = goldCornGetRecordQuery.getUid(); |
| | | daoQuery.day=goldCornGetRecordQuery.getDay(); |
| | | daoQuery.dayList=goldCornGetRecordQuery.getDayList(); |
| | | daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime(); |
| | | DaoQuery daoQuery = createDaoQuery(goldCornGetRecordQuery); |
| | | return goldCornGetRecordDao.count(daoQuery); |
| | | } |
| | | |
| | |
| | | Map<Long, Integer> map = new HashMap<>(); |
| | | if (mapList != null) { |
| | | for (Map m : mapList) { |
| | | map.put((long) m.get("fromUid"), (int) m.get("cornNum")); |
| | | map.put((long) m.get("_id"), (int) m.get("cornNum")); |
| | | } |
| | | } |
| | | return map; |
| | |
| | | //最大限制为365天 |
| | | list.add(Aggregation.limit(365)); |
| | | list.add(Aggregation.project("day")); |
| | | AggregationResults<Map<String,String>> results = goldCornGetRecordDao.aggregate(list, Map.class); |
| | | List<Map<String,String>> resultList = results.getMappedResults(); |
| | | AggregationResults<Map<String, String>> results = goldCornGetRecordDao.aggregate(list, Map.class); |
| | | List<Map<String, String>> resultList = results.getMappedResults(); |
| | | //获取连续的天数 |
| | | String format="yyyy-MM-dd"; |
| | | String format = "yyyy-MM-dd"; |
| | | Date lastDay = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(deadDate.getTime(), format), format)); |
| | | int continueDay = 0; |
| | | for (Map<String,String> day : resultList) { |
| | | for (Map<String, String> day : resultList) { |
| | | Long timestamp = TimeUtil.convertToTimeTemp(day.get("_id"), format); |
| | | long cha = lastDay.getTime() - timestamp; |
| | | if (cha <= 1000 * 60 * 60 * 24L) { |
| | |
| | | return continueDay; |
| | | } |
| | | |
| | | @Override |
| | | public Map<GoldCornGetType, Long> sumEventCount(GoldCornGetRecordQuery goldCornGetRecordQuery) { |
| | | return goldCornGetRecordDao.sumEventCount(createDaoQuery(goldCornGetRecordQuery)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.impl.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.dto.goldcorn.GoldCornMakeResultDTO; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.*; |
| | | import com.yeshi.makemoney.app.entity.money.UserMoneyRecord; |
| | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | |
| | | private UserMoneyRecordService userMoneyRecordService; |
| | | |
| | | |
| | | private void frequencyVerify(UserInfo user, GoldCornGetType type, Date time) throws GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | /** |
| | | * @return int 当前时间段还剩余的事件数量 |
| | | * @author hxh |
| | | * @description 频率限制 |
| | | * @date 11:02 2022/4/28 |
| | | * @param: user |
| | | * @param: type |
| | | * @param: time |
| | | **/ |
| | | @Override |
| | | public long frequencyVerify(UserInfo user, GoldCornGetType type, Date time) throws GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | GoldCornGetFrequencyConfig config = goldCornGetFrequencyConfigService.getConfig(user.getSystem(), type, time); |
| | | if (config == null) { |
| | | throw new GoldCornGetFrequencyConfigException(GoldCornGetFrequencyConfigException.CODE_NOT_EXIST, "频率配置不存在"); |
| | |
| | | //service里面有减去1天 |
| | | query.setEndTime(TimeUtil.getGernalTime(endTime.getTime() - 1000 * 60 * 60 * 24L, query.getFormat())); |
| | | |
| | | long count = goldCornGetRecordService.count(query); |
| | | if (count >= config.getLimitCount()) { |
| | | Map<GoldCornGetType, Long> countMap = goldCornGetRecordService.sumEventCount(query); |
| | | if (countMap.get(type) != null && (countMap.get(type) >= config.getLimitCount())) { |
| | | String msg = String.format("超出%s次/%s的限制", config.getLimitCount(), config.getTimeUnit().getName()); |
| | | throw new GoldCornMakeException(GoldCornMakeException.CODE_GET_FREQUENCY_LIMIT, msg); |
| | | } |
| | | |
| | | return config.getLimitCount() - (countMap.get(type) != null ? countMap.get(type) : 0); |
| | | } |
| | | |
| | | |
| | | @RequestSerializableByKey(key = "'addgoldcorn-'+#uid+'-'+#type") |
| | | @Override |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime, Integer price) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime, Integer price, Long eventCount) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | if (uid == null || type == null || currentTime == null) { |
| | | throw new GoldCornMakeException(GoldCornMakeException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | //判断是否超出了次数限制 |
| | | frequencyVerify(user, type, currentTime); |
| | | GoldCornGetPrice getPrice = goldCornGetPriceService.getPrice(user.getSystem(), GoldCornGetType.watchVideo, currentTime); |
| | | |
| | | |
| | |
| | | record.setUid(uid); |
| | | record.setLevel(GoldCornGetRecord.LEVEL_OWN); |
| | | record.setCreateTime(currentTime); |
| | | record.setEventCount(eventCount); |
| | | GoldCornGetRecord recordD = null; |
| | | if (isDouble) { |
| | | recordD = new GoldCornGetRecord(); |
| | |
| | | recordD.setLevel(GoldCornGetRecord.LEVEL_OWN); |
| | | recordD.setCreateTime(currentTime); |
| | | recordD.setDubble(true); |
| | | recordD.setEventCount(eventCount); |
| | | } |
| | | |
| | | //允许上级提成 |
| | |
| | | public GoldCornGetRecord signIn(Long uid) throws GoldCornGetFrequencyConfigException, UserInfoException, GoldCornGetPriceException, GoldCornMakeException { |
| | | |
| | | UserInfo user = userInfoService.get(uid); |
| | | |
| | | Date now = new Date(); |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.signIn, now); |
| | | //获取连续签到次数 |
| | | Integer price = goldCornGetPriceService.getSingInPrice(user.getSystem(), getContinueSignDay(uid) + 1); |
| | | |
| | | |
| | | return addGoldCorn(uid, GoldCornGetType.signIn, false, new Date(), price); |
| | | return addGoldCorn(uid, GoldCornGetType.signIn, false, now, price, 1L); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer watchVideo(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | public GoldCornMakeResultDTO watchVideo(Long uid, boolean isDouble, Date time, long timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | |
| | | Integer price = goldCornGetPriceService.getWatchVideoPrice(user, time, timeSeconds); |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.watchVideo, time); |
| | | timeSeconds = timeSeconds > leftCount ? leftCount : timeSeconds; |
| | | |
| | | Integer price = goldCornGetPriceService.getCountPrice(GoldCornGetType.watchVideo, user, user.getSystem(), time, timeSeconds); |
| | | //价格为0时不加入记录 |
| | | if (price == 0) { |
| | | return 0; |
| | | return new GoldCornMakeResultDTO(0, leftCount); |
| | | } |
| | | |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.watchVideo, isDouble, time, price); |
| | | return record.getCornNum() * (isDouble ? 2 : 1); |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.watchVideo, isDouble, time, price, (long) timeSeconds); |
| | | return new GoldCornMakeResultDTO(record.getCornNum() * (isDouble ? 2 : 1), leftCount - timeSeconds); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer readNovel(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | public GoldCornMakeResultDTO readNovel(Long uid, boolean isDouble, Date time, long timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | |
| | | String readNovelCacheKey = "task-n-" + uid + "-" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"); |
| | | Integer readNovelNowSeconds = timeSeconds; |
| | | long readNovelNowSeconds = timeSeconds; |
| | | |
| | | Integer start = (Integer) redisTemplate.opsForValue().get(readNovelCacheKey); |
| | | if (start == null) { |
| | |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | |
| | | Integer price = goldCornGetPriceService.getReadNovelPrice(user, time, timeSeconds); |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.readNovel, time); |
| | | timeSeconds = timeSeconds > leftCount ? leftCount : timeSeconds; |
| | | |
| | | Integer price = goldCornGetPriceService.getCountPrice(GoldCornGetType.readNovel, user, user.getSystem(), time, timeSeconds); |
| | | //价格为0时不加入记录 |
| | | if (price == 0) { |
| | | return 0; |
| | | return new GoldCornMakeResultDTO(0, leftCount); |
| | | } |
| | | |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.readNovel, isDouble, time, price); |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.readNovel, isDouble, time, price, (long) timeSeconds); |
| | | |
| | | //记录当天的实时阅读分钟数 |
| | | redisTemplate.opsForValue().set(readNovelCacheKey, readNovelNowSeconds, 60 * 60 * 24, TimeUnit.SECONDS); |
| | | return record.getCornNum() * (isDouble ? 2 : 1); |
| | | return new GoldCornMakeResultDTO(record.getCornNum() * (isDouble ? 2 : 1), leftCount - timeSeconds); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | public GoldCornMakeResultDTO scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | |
| | | Integer price = goldCornGetPriceService.getScanNewsPrice(user, time, num); |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.scanNews, time); |
| | | |
| | | Integer price = goldCornGetPriceService.getCountPrice(GoldCornGetType.scanNews, user, user.getSystem(), time, num); |
| | | //价格为0时不加入记录 |
| | | if (price == 0) { |
| | | return 0; |
| | | return new GoldCornMakeResultDTO(0, leftCount); |
| | | } |
| | | |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.scanNews, isDouble, time, price); |
| | | return record.getCornNum() * (isDouble ? 2 : 1); |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.scanNews, isDouble, time, price, (long) num); |
| | | return new GoldCornMakeResultDTO(record.getCornNum() * (isDouble ? 2 : 1), leftCount - num); |
| | | } |
| | | |
| | | @Override |
| | | public GoldCornMakeResultDTO inviteFriends(Long uid, UserInfo friendInfo, Date time) throws UserInfoException, GoldCornGetPriceException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.invite, time); |
| | | |
| | | Integer price = goldCornGetPriceService.getCountPrice(GoldCornGetType.invite, user, user.getSystem(), time, 1); |
| | | //价格为0时不加入记录 |
| | | if (price == 0) { |
| | | return new GoldCornMakeResultDTO(0, leftCount); |
| | | } |
| | | |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.invite, false, time, price, (long) price); |
| | | return new GoldCornMakeResultDTO(record.getCornNum(), leftCount - 1); |
| | | } |
| | | |
| | | @Override |
| | | public GoldCornMakeResultDTO extract(Long uid, Date time) throws UserInfoException, GoldCornGetPriceException, GoldCornMakeException, GoldCornGetFrequencyConfigException { |
| | | |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | | } |
| | | |
| | | //判断是否超出了次数限制 |
| | | long leftCount = frequencyVerify(user, GoldCornGetType.extract, time); |
| | | |
| | | Integer price = goldCornGetPriceService.getCountPrice(GoldCornGetType.extract, user, user.getSystem(), time, 1); |
| | | //价格为0时不加入记录 |
| | | if (price == 0) { |
| | | return new GoldCornMakeResultDTO(0, leftCount); |
| | | } |
| | | |
| | | GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.extract, false, time, price, (long) price); |
| | | return new GoldCornMakeResultDTO(record.getCornNum(), leftCount - 1); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.impl.goldcorn; |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornTaskTypeInfoException; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornTaskTypeInfoDao; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornTaskTypeInfoService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornTaskTypeInfoQuery; |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornTaskTypeInfoDao.DaoQuery; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | @Service |
| | | public class GoldCornTaskTypeInfoServiceImpl implements GoldCornTaskTypeInfoService { |
| | | |
| | | @Resource |
| | | private GoldCornTaskTypeInfoDao goldCornTaskTypeInfoDao; |
| | | |
| | | |
| | | private DaoQuery createDaoQuery(GoldCornTaskTypeInfoQuery goldCornTaskTypeInfoQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.system = goldCornTaskTypeInfoQuery.getSystem(); |
| | | daoQuery.type = goldCornTaskTypeInfoQuery.getType(); |
| | | daoQuery.show = goldCornTaskTypeInfoQuery.getShow(); |
| | | daoQuery.showTime = goldCornTaskTypeInfoQuery.getShowTime(); |
| | | return daoQuery; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornTaskTypeInfo> list(GoldCornTaskTypeInfoQuery goldCornTaskTypeInfoQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = createDaoQuery(goldCornTaskTypeInfoQuery); |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order[]{Sort.Order.asc("order")}); |
| | | return goldCornTaskTypeInfoDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long count(GoldCornTaskTypeInfoQuery goldCornTaskTypeInfoQuery) { |
| | | DaoQuery daoQuery = createDaoQuery(goldCornTaskTypeInfoQuery); |
| | | return goldCornTaskTypeInfoDao.count(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public GoldCornTaskTypeInfo get(String id) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(id)); |
| | | return goldCornTaskTypeInfoDao.findOne(query); |
| | | } |
| | | |
| | | @Override |
| | | public void add(GoldCornTaskTypeInfo goldCornTaskTypeInfo) throws GoldCornTaskTypeInfoException { |
| | | |
| | | if (goldCornTaskTypeInfo == null || goldCornTaskTypeInfo.getType() == null || goldCornTaskTypeInfo.getSystem() == null) { |
| | | throw new GoldCornTaskTypeInfoException(GoldCornTaskTypeInfoException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | | |
| | | if (goldCornTaskTypeInfo.getId() == null) { |
| | | goldCornTaskTypeInfo.setId(goldCornTaskTypeInfo.toId()); |
| | | } |
| | | |
| | | //查询主键ID是否存在 |
| | | if (goldCornTaskTypeInfoDao.get(goldCornTaskTypeInfo.getId()) != null) { |
| | | throw new GoldCornTaskTypeInfoException(GoldCornTaskTypeInfoException.CODE_EXIST, "已存在"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(goldCornTaskTypeInfo.getName())) { |
| | | goldCornTaskTypeInfo.setName(goldCornTaskTypeInfo.getType().getName()); |
| | | } |
| | | |
| | | if (goldCornTaskTypeInfo.getCreateTime() == null) { |
| | | goldCornTaskTypeInfo.setCreateTime(new Date()); |
| | | } |
| | | //保存 |
| | | goldCornTaskTypeInfoDao.save(goldCornTaskTypeInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void update(GoldCornTaskTypeInfo goldCornTaskTypeInfo) { |
| | | if (goldCornTaskTypeInfo.getUpdateTime() == null) { |
| | | goldCornTaskTypeInfo.setUpdateTime(new Date()); |
| | | } |
| | | //更新 |
| | | goldCornTaskTypeInfoDao.updateSelective(goldCornTaskTypeInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(List<String> idList) { |
| | | for (String id : idList) { |
| | | goldCornTaskTypeInfoDao.delete(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.query.team.TeamInviteRelationQuery; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | return teamInviteRelationMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void add(TeamInviteRelation teamInviteRelation) throws TeamInviteRelationException { |
| | | |
| | |
| | | |
| | | //保存 |
| | | teamInviteRelationMapper.insertSelective(teamInviteRelation); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | public GoldCornGetFrequencyConfig getConfig(SystemEnum system, GoldCornGetType type, Date time); |
| | | |
| | | |
| | | /** |
| | | * @return java.util.List<com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig> |
| | | * @author hxh |
| | | * @description 根据类型与系统查询 |
| | | * @date 14:15 2022/4/28 |
| | | * @param: typeList |
| | | * @param: system |
| | | **/ |
| | | public List<GoldCornGetFrequencyConfig> listByTypes(List<GoldCornGetType> typeList, SystemEnum system, Date date); |
| | | |
| | | |
| | | } |
| | |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetPriceService; |
| | |
| | | /** |
| | | * @return java.lang.Integer |
| | | * @author hxh |
| | | * @description 获取观看视频的单价(按分钟计价) |
| | | * @date 18:18 2022/4/26 |
| | | * @description 获取计数价格 |
| | | * @date 12:10 2022/4/28 |
| | | * @param: type |
| | | * @param: user |
| | | **/ |
| | | /** |
| | | * @return java.lang.Integer |
| | | * @author hxh |
| | | * @description 获取本次观看视频的价格 |
| | | * @date 18:23 2022/4/26 |
| | | * @param: user 用户信息 |
| | | * @param: date 观看的日期 |
| | | * @param: timeSeconds 观看的时长 |
| | | **/ |
| | | public Integer getWatchVideoPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException; |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.Integer |
| | | * @author hxh |
| | | * @description 获取本次阅读小说的价格 |
| | | * @date 18:28 2022/4/26 |
| | | * @param: user |
| | | * @param: system |
| | | * @param: date |
| | | * @param: timeSeconds |
| | | * @param: eventCount |
| | | **/ |
| | | public Integer getReadNovelPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException; |
| | | |
| | | public Integer getCountPrice(GoldCornGetType type, UserInfo user, SystemEnum system, Date date, long eventCount) throws GoldCornGetPriceException; |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 获取浏览新闻价格 |
| | | * @date 18:34 2022/4/26 |
| | | * @return java.util.Map<com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType , java.lang.Integer> |
| | | * @author hxh |
| | | * @description 获取计数价格列表 |
| | | * @date 13:55 2022/4/28 |
| | | * @param: typeList |
| | | * @param: user |
| | | * @param: system |
| | | * @param: date |
| | | * @param: num |
| | | * @return java.lang.Integer |
| | | **/ |
| | | public Integer getScanNewsPrice(UserInfo user, Date date, int num) throws GoldCornGetPriceException; |
| | | public Map<GoldCornGetType, GoldCornGetPrice> getCountPrice(List<GoldCornGetType> typeList, UserInfo user, SystemEnum system, Date date); |
| | | |
| | | |
| | | /** |
| | | * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice |
| | | * @author hxh |
| | | * @description 获取计数价格 |
| | | * @date 19:02 2022/4/28 |
| | | * @param: type |
| | | * @param: user |
| | | * @param: system |
| | | * @param: date |
| | | **/ |
| | | public GoldCornGetPrice getCountPrice(GoldCornGetType type, UserInfo user, SystemEnum system, Date date); |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | public long count(GoldCornGetRecordQuery goldCornGetRecordQuery); |
| | | |
| | | |
| | | /** |
| | | * |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * @return java.util.Map<java.lang.Long , java.math.BigDecimal> |
| | | * @return java.util.Map<java.lang.Long , java.math.BigDecimal> |
| | | * @author hxh |
| | | * @description 统计FromUid产生的金币数量 |
| | | * @date 15:36 2022/4/8 |
| | |
| | | |
| | | |
| | | /** |
| | | * @return int |
| | | * @author hxh |
| | | * @description 获取连续任务的天数 |
| | | * @date 16:39 2022/4/21 |
| | | * @param: uid |
| | | * @param: type |
| | | * @param: deadDate |
| | | * @return int |
| | | **/ |
| | | public int getContinueDay(Long uid, GoldCornGetType type,Date deadDate); |
| | | public int getContinueDay(Long uid, GoldCornGetType type, Date deadDate); |
| | | |
| | | |
| | | /** |
| | | * @return long |
| | | * @author hxh |
| | | * @description 统计事件数量 |
| | | * @date 10:32 2022/4/28 |
| | | * @param: goldCornGetRecordQuery |
| | | **/ |
| | | public Map<GoldCornGetType,Long> sumEventCount(GoldCornGetRecordQuery goldCornGetRecordQuery); |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.dto.goldcorn.GoldCornMakeResultDTO; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | |
| | | * @param: isDouble 是否加倍 |
| | | * @param: time 发生时间 |
| | | **/ |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date time, Integer price) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException; |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date time, Integer price, Long eventCount) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException; |
| | | |
| | | |
| | | /** |
| | |
| | | **/ |
| | | public boolean isSignIn(Long uid, Date date); |
| | | |
| | | public long frequencyVerify(UserInfo user, GoldCornGetType type, Date time) throws GoldCornGetFrequencyConfigException, GoldCornMakeException; |
| | | |
| | | |
| | | /** |
| | | * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord |
| | |
| | | * @param: time |
| | | * @param: timeSeconds |
| | | **/ |
| | | public Integer watchVideo(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | public GoldCornMakeResultDTO watchVideo(Long uid, boolean isDouble, Date time, long timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: time |
| | | * @param: timeSeconds |
| | | **/ |
| | | public Integer readNovel(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | public GoldCornMakeResultDTO readNovel(Long uid, boolean isDouble, Date time, long timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: time |
| | | * @param: num |
| | | **/ |
| | | public Integer scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | public GoldCornMakeResultDTO scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | |
| | | |
| | | /** |
| | | * @return com.yeshi.makemoney.app.dto.goldcorn.GoldCornMakeResultDTO |
| | | * @author hxh |
| | | * @description /邀请好友 |
| | | * @date 18:55 2022/4/28 |
| | | * @param: uid |
| | | * @param: friendInfo |
| | | * @param: time |
| | | **/ |
| | | public GoldCornMakeResultDTO inviteFriends(Long uid, UserInfo friendInfo, Date time) throws UserInfoException, GoldCornGetPriceException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 提现 |
| | | * @date 18:55 2022/4/28 |
| | | * @param: uid |
| | | * @param: time |
| | | * @return com.yeshi.makemoney.app.dto.goldcorn.GoldCornMakeResultDTO |
| | | **/ |
| | | public GoldCornMakeResultDTO extract(Long uid, Date time) throws UserInfoException, GoldCornGetPriceException, GoldCornMakeException, GoldCornGetFrequencyConfigException; |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornTaskTypeInfoException; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | import java.util.List; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornTaskTypeInfoService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornTaskTypeInfoQuery; |
| | | |
| | | |
| | | public interface GoldCornTaskTypeInfoService { |
| | | |
| | | /** |
| | | * 获取列表 |
| | | * @param goldCornTaskTypeInfoQuery |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<GoldCornTaskTypeInfo> list(GoldCornTaskTypeInfoQuery goldCornTaskTypeInfoQuery, int page, int pageSize) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public long count(GoldCornTaskTypeInfoQuery goldCornTaskTypeInfoQuery) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public GoldCornTaskTypeInfo get(String id) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void add(GoldCornTaskTypeInfo goldCornTaskTypeInfo) throws GoldCornTaskTypeInfoException; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void update(GoldCornTaskTypeInfo goldCornTaskTypeInfo) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void delete(List<String> idList) ; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.manager; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.push.exception.BPushDeviceTokenException; |
| | | import com.ks.push.pojo.DO.BPushDeviceToken; |
| | | import com.ks.push.pojo.DO.PushPlatform; |
| | | import com.ks.push.service.BDeviceTokenService; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import com.yeshi.makemoney.app.vo.AcceptData; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PushManager |
| | | * @description: 推送管理器 |
| | | * @date 2022/4/29 17:33 |
| | | */ |
| | | @Component |
| | | public class PushManager { |
| | | |
| | | //@Reference(version = "1.0") |
| | | private BDeviceTokenService bdeviceTokenService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 保存token |
| | | * @date 17:36 2022/4/29 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: regId |
| | | **/ |
| | | public void saveToken(AcceptData acceptData, Long uid, String regId) throws BPushDeviceTokenException, ParamsException { |
| | | BPushDeviceToken token = new BPushDeviceToken(); |
| | | if (uid != null) { |
| | | token.setUid(uid + ""); |
| | | } |
| | | token.setType(PushPlatform.jpush); |
| | | token.setAppCode(systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.androidPushAppCode)); |
| | | token.setVersionCode(acceptData.getVersion()); |
| | | token.setToken(regId); |
| | | token.setDeviceId(acceptData.getUtdId()); |
| | | token.setBuildVersion(acceptData.getOsVersion()); |
| | | token.setBuildModel(acceptData.getDeviceType()); |
| | | token.setCreateTime(new Date()); |
| | | bdeviceTokenService.save(token); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 绑定用户ID |
| | | * @date 17:40 2022/4/29 |
| | | * @param: system |
| | | * @param: uid |
| | | * @param: deviceId |
| | | **/ |
| | | public void bindUid(SystemEnum system, Long uid, String deviceId) { |
| | | bdeviceTokenService.bindUid(systemConfigService.getValueCache(system, SystemConfigKey.androidPushAppCode), deviceId, uid + ""); |
| | | } |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 解绑用户ID |
| | | * @date 17:41 2022/4/29 |
| | | * @param: system |
| | | * @param: deviceId |
| | | **/ |
| | | public void unBind(SystemEnum system, String deviceId) { |
| | | bdeviceTokenService.unBindUid(systemConfigService.getValueCache(system, SystemConfigKey.androidPushAppCode), deviceId); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | private List<String> dayList; |
| | | |
| | | private Boolean doubles; |
| | | |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | | } |
| | |
| | | public void setDayList(List<String> dayList) { |
| | | this.dayList = dayList; |
| | | } |
| | | |
| | | public Boolean getDoubles() { |
| | | return doubles; |
| | | } |
| | | |
| | | public void setDoubles(Boolean doubles) { |
| | | this.doubles = doubles; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.query.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornTaskTypeInfoQuery { |
| | | //搜索关键词 |
| | | private String kw; |
| | | |
| | | private SystemEnum system; |
| | | |
| | | private Boolean show; |
| | | |
| | | private Date showTime; |
| | | |
| | | private GoldCornGetType type; |
| | | |
| | | private String getKw() { |
| | | return kw; |
| | | } |
| | | |
| | | private void setKw(String kw) { |
| | | this.kw = kw; |
| | | } |
| | | |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public Boolean getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(Boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public Date getShowTime() { |
| | | return showTime; |
| | | } |
| | | |
| | | public void setShowTime(Date showTime) { |
| | | this.showTime = showTime; |
| | | } |
| | | |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(GoldCornGetType type) { |
| | | this.type = type; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.utils; |
| | | |
| | | import com.google.zxing.WriterException; |
| | | import jdk.internal.util.xml.impl.Input; |
| | | import org.yeshi.utils.FileUtil; |
| | | import org.yeshi.utils.QRCodeUtil; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.InputStream; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | |
| | | private String id; |
| | | private SystemEnum system; |
| | | private GoldCornGetType type; |
| | | private Integer limitCount; |
| | | private Long limitCount; |
| | | private GoldCornGetFrequencyConfig.GoldCornGetFrequencyTimeUnit timeUnit; |
| | | private String validateTime; |
| | | private String remarks; |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getLimitCount() { |
| | | public Long getLimitCount() { |
| | | return limitCount; |
| | | } |
| | | |
| | | public void setLimitCount(Integer limitCount) { |
| | | public void setLimitCount(Long limitCount) { |
| | | this.limitCount = limitCount; |
| | | } |
| | | |
| | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornPriceCountType; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | private String id; |
| | | private GoldCornGetType type; |
| | | private GoldCornPriceCountType countType; |
| | | private Integer cornNum; |
| | | private String validateTime; |
| | | private BigDecimal teamGainRate; |
| | |
| | | entity.setTeamDivide("on".equalsIgnoreCase(teamDivide) ? true : false); |
| | | entity.setSystem(system); |
| | | entity.setType(type); |
| | | entity.setCountType(countType); |
| | | entity.setValidateTime(new Date(TimeUtil.convertToTimeTemp(validateTime, "yyyy-MM-dd HH:mm:ss"))); |
| | | return entity; |
| | | } |
| | |
| | | vo.setType(entity.getType()); |
| | | vo.setTeamDivide(entity.getTeamDivide() ? "on" : null); |
| | | vo.setTeamGainRate(entity.getTeamGainRate()); |
| | | vo.setCountType(entity.getCountType()); |
| | | vo.setValidateTime(TimeUtil.getGernalTime(entity.getValidateTime().getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | return vo; |
| | | } |
| | |
| | | public void setTeamDivide(String teamDivide) { |
| | | this.teamDivide = teamDivide; |
| | | } |
| | | |
| | | public GoldCornPriceCountType getCountType() { |
| | | return countType; |
| | | } |
| | | |
| | | public void setCountType(GoldCornPriceCountType countType) { |
| | | this.countType = countType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.admin.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornTaskTypeInfoAdminVO { |
| | | private String id; |
| | | private String name; |
| | | private String icon; |
| | | private SystemEnum system; |
| | | private GoldCornGetType type; |
| | | private String show; |
| | | private String startTime; |
| | | private String endTime; |
| | | private Integer order; |
| | | |
| | | public GoldCornTaskTypeInfo toEntity(SystemEnum system) { |
| | | GoldCornTaskTypeInfo entity = new GoldCornTaskTypeInfo(); |
| | | entity.setId(id); |
| | | entity.setName(name); |
| | | entity.setIcon(icon); |
| | | entity.setSystem(system); |
| | | entity.setType(type); |
| | | entity.setOrder(order); |
| | | entity.setShow("on".equalsIgnoreCase(show) ? true : false); |
| | | entity.setStartTime(new Date(TimeUtil.convertToTimeTemp(startTime, "yyyy-MM-dd HH:mm:ss"))); |
| | | entity.setEndTime(new Date(TimeUtil.convertToTimeTemp(endTime, "yyyy-MM-dd HH:mm:ss"))); |
| | | return entity; |
| | | } |
| | | |
| | | |
| | | public static GoldCornTaskTypeInfoAdminVO create(GoldCornTaskTypeInfo entity) { |
| | | GoldCornTaskTypeInfoAdminVO vo = new GoldCornTaskTypeInfoAdminVO(); |
| | | vo.setId(entity.getId()); |
| | | vo.setName(entity.getName()); |
| | | vo.setIcon(entity.getIcon()); |
| | | vo.setSystem(entity.getSystem()); |
| | | vo.setType(entity.getType()); |
| | | vo.setShow(entity.getShow() ? "on" : null); |
| | | vo.setOrder(entity.getOrder()); |
| | | vo.setStartTime(TimeUtil.getGernalTime(entity.getStartTime().getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | vo.setEndTime(TimeUtil.getGernalTime(entity.getEndTime().getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | return vo; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(GoldCornGetType type) { |
| | | this.type = type; |
| | | } |
| | | public String getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(String show) { |
| | | this.show = show; |
| | | } |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Integer getOrder() { |
| | | return order; |
| | | } |
| | | |
| | | public void setOrder(Integer order) { |
| | | this.order = order; |
| | | } |
| | | } |
| | |
| | | public class GoldCornDoTaskVO { |
| | | |
| | | private GoldCornGetType type; |
| | | private Boolean isDouble; |
| | | private Boolean doubles; |
| | | private Long finishTime; |
| | | //数量 |
| | | private Integer num; |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Boolean getDouble() { |
| | | return isDouble; |
| | | |
| | | public Boolean getDoubles() { |
| | | return doubles; |
| | | } |
| | | |
| | | public void setDouble(Boolean aDouble) { |
| | | isDouble = aDouble; |
| | | public void setDoubles(Boolean doubles) { |
| | | this.doubles = doubles; |
| | | } |
| | | |
| | | public Long getFinishTime() { |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.config.AppJumpType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornTaskVO |
| | | * @description: 任务列表输出 |
| | | * @date 2022/4/28 14:38 |
| | | */ |
| | | public class GoldCornTaskVO { |
| | | |
| | | private String icon; |
| | | private String name; |
| | | private String process; |
| | | private int price; |
| | | private String priceUnit; |
| | | private String actionName; |
| | | private boolean active; |
| | | private AppJumpType jumpType; |
| | | |
| | | public static GoldCornTaskVO create(GoldCornTaskTypeInfo task, GoldCornGetPrice price, GoldCornGetFrequencyConfig frequencyConfig, Long eventCount) { |
| | | eventCount = eventCount == null ? 0L : eventCount; |
| | | GoldCornTaskVO vo = new GoldCornTaskVO(); |
| | | vo.setIcon(task.getIcon()); |
| | | vo.setName(task.getName()); |
| | | |
| | | boolean finish = (frequencyConfig.getLimitCount() <= eventCount.longValue()); |
| | | vo.setActive(!finish); |
| | | |
| | | StringBuffer processBuffer = new StringBuffer(); |
| | | processBuffer.append("今日进度 ("); |
| | | if (task.getType() == GoldCornGetType.watchVideo) { |
| | | vo.setActionName("去完成"); |
| | | vo.setPrice(price.getCornNum()); |
| | | vo.setPriceUnit("金币/分钟"); |
| | | processBuffer.append(eventCount / 60); |
| | | processBuffer.append("/"); |
| | | processBuffer.append(frequencyConfig.getLimitCount() / 60); |
| | | processBuffer.append("分钟"); |
| | | |
| | | vo.setJumpType(AppJumpType.drawVideo); |
| | | } else if (task.getType() == GoldCornGetType.scanNews) { |
| | | vo.setActionName("看资讯"); |
| | | vo.setPrice(price.getCornNum()); |
| | | vo.setPriceUnit("金币/篇"); |
| | | processBuffer.append(eventCount); |
| | | processBuffer.append("/"); |
| | | processBuffer.append(frequencyConfig.getLimitCount()); |
| | | vo.setJumpType(AppJumpType.news); |
| | | } else if (task.getType() == GoldCornGetType.readNovel) { |
| | | vo.setActionName("看小说"); |
| | | vo.setPrice(price.getCornNum()); |
| | | vo.setPriceUnit("金币/分钟"); |
| | | processBuffer.append(eventCount / 60); |
| | | processBuffer.append("/"); |
| | | processBuffer.append(frequencyConfig.getLimitCount() / 60); |
| | | processBuffer.append("分钟"); |
| | | |
| | | vo.setJumpType(AppJumpType.novel); |
| | | } else if (task.getType() == GoldCornGetType.invite) { |
| | | vo.setActionName("去邀请"); |
| | | vo.setPrice(price.getCornNum()); |
| | | vo.setPriceUnit("金币/人"); |
| | | processBuffer.append(eventCount); |
| | | processBuffer.append("/"); |
| | | processBuffer.append(frequencyConfig.getLimitCount()); |
| | | |
| | | vo.setJumpType(AppJumpType.invite); |
| | | } else if (task.getType() == GoldCornGetType.extract) { |
| | | vo.setActionName("去提现"); |
| | | vo.setPrice(price.getCornNum()); |
| | | vo.setPriceUnit("金币/次"); |
| | | processBuffer.append(eventCount); |
| | | processBuffer.append("/"); |
| | | processBuffer.append(frequencyConfig.getLimitCount()); |
| | | |
| | | vo.setJumpType(AppJumpType.extract); |
| | | } |
| | | processBuffer.append(")"); |
| | | vo.setProcess(processBuffer.toString()); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getProcess() { |
| | | return process; |
| | | } |
| | | |
| | | public void setProcess(String process) { |
| | | this.process = process; |
| | | } |
| | | |
| | | public int getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(int price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public String getActionName() { |
| | | return actionName; |
| | | } |
| | | |
| | | public void setActionName(String actionName) { |
| | | this.actionName = actionName; |
| | | } |
| | | |
| | | public boolean isActive() { |
| | | return active; |
| | | } |
| | | |
| | | public void setActive(boolean active) { |
| | | this.active = active; |
| | | } |
| | | |
| | | public AppJumpType getJumpType() { |
| | | return jumpType; |
| | | } |
| | | |
| | | public void setJumpType(AppJumpType jumpType) { |
| | | this.jumpType = jumpType; |
| | | } |
| | | |
| | | public String getPriceUnit() { |
| | | return priceUnit; |
| | | } |
| | | |
| | | public void setPriceUnit(String priceUnit) { |
| | | this.priceUnit = priceUnit; |
| | | } |
| | | } |
| | |
| | | <?xml version='1.0' encoding='UTF-8'?> |
| | | <!DOCTYPE generator-config PUBLIC "-//yeshitv.com//DTD generator_code 1.0//EN" |
| | | "http://dtd.yeshitv.com/generator_code/1.3.dtd"> |
| | | <generator-config class="com.yeshi.makemoney.app.entity.team.UserSpreadImg"> |
| | | "http://dtd.yeshitv.com/generator_code/1.4.dtd"> |
| | | <generator-config class="com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo"> |
| | | |
| | | <dao package="com.yeshi.makemoney.app.dao.team"> |
| | | <dao package="com.yeshi.makemoney.app.dao.goldcorn"> |
| | | <queryList> |
| | | <query name="sourceMD5" type="equal"/> |
| | | <query name="uid" type="equal"/> |
| | | <query name="system" type="equal"/> |
| | | <query name="type" type="equal"/> |
| | | </queryList> |
| | | </dao> |
| | | |
| | | <service interPackage="com.yeshi.makemoney.app.service.inter.team" |
| | | implPackage="com.yeshi.makemoney.app.service.impl.team" |
| | | queryPackage="com.yeshi.makemoney.app.service.query.team"> |
| | | <exception package="com.yeshi.makemoney.app.exception.team" |
| | | <service interPackage="com.yeshi.makemoney.app.service.inter.goldcorn" |
| | | implPackage="com.yeshi.makemoney.app.service.impl.goldcorn" |
| | | queryPackage="com.yeshi.makemoney.app.service.query.goldcorn"> |
| | | <exception package="com.yeshi.makemoney.app.exception.goldcorn" |
| | | base="com.ks.lib.common.exception.BaseException"></exception> |
| | | </service> |
| | | |
| | | <admin> |
| | | <controller package="com.yeshi.makemoney.app.controller.admin.team" |
| | | mapping="/admin/api/team/spreadimg" |
| | | <controller package="com.yeshi.makemoney.app.controller.admin.goldcorn" |
| | | mapping="/admin/api/goldcorn/task" adminVOPackage="com.yeshi.makemoney.app.vo.admin.goldcorn" |
| | | jsonp="false"> |
| | | </controller> |
| | | <pages title="用户邀请图" |
| | | pageDir="D:/workspace/makemoney/server/MakeMoney/app/src/main/resources/static/team"> |
| | | <pages title="金币任务信息" |
| | | pageDir="D:/workspace/makemoney/server/MakeMoney/app/src/main/resources/static/goldcorn"> |
| | | <list> |
| | | <searchForm> |
| | | <columns> |
| | |
| | | </searchForm> |
| | | <columns> |
| | | <column property="id" title="ID" showType="TEXT"></column> |
| | | <column property="url" title="素材图" showType="IMG"></column> |
| | | <column property="name" title="任务名称" showType="TEXT"></column> |
| | | <column property="icon" title="任务图标" showType="IMG"></column> |
| | | <column property="type" title="任务类型" showType="TEXT"></column> |
| | | <column property="show" title="是否显示" showType="SWITCH"></column> |
| | | <column property="startTime" title="显示开始时间" showType="DATETIME"></column> |
| | | <column property="endTime" title="显示结束时间" showType="DATETIME"></column> |
| | |
| | | |
| | | <add> |
| | | |
| | | <column property="url" title="素材图"> |
| | | <column property="name" title="任务名称"> |
| | | <text inputType="TEXT"></text> |
| | | </column> |
| | | |
| | | <column property="type" title="任务类型"> |
| | | <select> |
| | | <api path="/admin/api/goldcorn/getTypeList"></api> |
| | | </select> |
| | | </column> |
| | | |
| | | |
| | | <column property="icon" title="图标"> |
| | | <img height="100"> |
| | | <api path="/admin/api/file/uploadImg"> |
| | | <params> |
| | | <value key="type">spreadimg</value> |
| | | <value key="type">goldcorn_task</value> |
| | | </params> |
| | | </api> |
| | | |
| | | </img> |
| | | </column> |
| | | |
| | | |
| | | <column property="show" title="是否显示"> |
| | | <switch></switch> |
| | |
| | | |
| | | <column property="startTime" title="显示开始时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime"></verify> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | <column property="endTime" title="显示结束时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime"></verify> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | |
| | | </add> |
| | | |
| | | <update> |
| | | <column property="url" title="素材图"> |
| | | <img height="100" enable="false"></img> |
| | | <column property="name" title="任务名称"> |
| | | <text inputType="TEXT"> |
| | | </text> |
| | | </column> |
| | | |
| | | <column property="type" title="任务类型"> |
| | | <select enable="false"> |
| | | <api path="/admin/api/goldcorn/getTypeList"></api> |
| | | </select> |
| | | </column> |
| | | |
| | | |
| | | <column property="icon" title="图标"> |
| | | <img height="100"> |
| | | <api path="/admin/api/file/uploadImg"> |
| | | <params> |
| | | <value key="type">goldcorn_task</value> |
| | | </params> |
| | | </api> |
| | | </img> |
| | | </column> |
| | | |
| | | |
| | | <column property="show" title="是否显示"> |
| | | <switch></switch> |
| | | </column> |
| | | |
| | | <column property="startTime" title="显示开始时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime"></verify> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | <column property="endTime" title="显示结束时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime"></verify> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | |
| | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 限制次数</label> |
| | | 限制次/秒数</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="limitCount" lay-verify="required|number" placeholder="请输入整数" |
| | | autocomplete="off" |
| | |
| | | //请求select的数据API |
| | | var params = {}; |
| | | |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | |
| | | }); |
| | | |
| | | var params = {}; |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 限制次数</label> |
| | | 限制次/秒数</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="limitCount" lay-verify="required|number" placeholder="请输入金币数量" |
| | | autocomplete="off" |
| | |
| | | var preRequestCount = 2 |
| | | var params = {}; |
| | | |
| | | ksapp.post('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.post('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | |
| | | <select name="type" lay-verify="required"> |
| | | </select></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 计数类型</label> |
| | | <div class="layui-input-block"> |
| | | <select name="countType" lay-verify="required"> |
| | | </select></div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 金币数量</label> |
| | | 金币数量(每次/分钟)</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="cornNum" lay-verify="required|number" placeholder="请输入金币数量" |
| | | autocomplete="off" |
| | |
| | | //请求select的数据API |
| | | var params = {}; |
| | | |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | |
| | | |
| | | }, function (res) { |
| | | }); |
| | | |
| | | |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getCountTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=countType]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].key + "'>"; |
| | | html += res.data[i].value + "</option>"; |
| | | $("select[name=countType]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }) |
| | | ; |
| | | </script> |
| | |
| | | |
| | | var params = {}; |
| | | |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 150, sort: false, title: "ID"}, |
| | | {field: 'type', width: 120, sort: false, title: "类型"}, |
| | | {field: 'countType', width: 120, sort: false, title: "计数形式"}, |
| | | {field: 'cornNum', width: 120, sort: false, title: "金币数量"}, |
| | | {field: 'teamGainRate', width: 120, sort: false, title: "团队增益比例"}, |
| | | { |
| | |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 类型</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="type" lay-verify="" placeholder="" autocomplete="off" disabled |
| | | <input type="text" name="type" lay-verify="" placeholder="" autocomplete="off" disabled="disabled" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 计数类型</label> |
| | | <div class="layui-input-block"> |
| | | <select name="countType" lay-verify="required"> |
| | | </select></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 金币数量</label> |
| | | 金币数量(每次/分钟)</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="cornNum" lay-verify="required|number" placeholder="请输入金币数量" |
| | | autocomplete="off" |
| | |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | var preRequestCount = 1 |
| | | ksapp.post('/admin/api/goldcorn/price/getCountTypeList', {}, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=countType]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].key + "'>"; |
| | | html += res.data[i].value + "</option>"; |
| | | $("select[name=countType]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | preRequestCount--; |
| | | if (preRequestCount <= 0) { |
| | | //开始填充数据 |
| | | fillData(form) |
| | | } |
| | | |
| | | fillData(form) |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }) |
| | | ; |
| | | </script> |
| | |
| | | var requestCount = 0; |
| | | requestCount++; |
| | | var params = {}; |
| | | ksapp.postJSON('/admin/api/goldcorn/price/getPriceTypes', params, function (res) { |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>新增金币任务信息</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | </head> |
| | | <body> |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form" lay-filter="add"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 任务名称</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 任务类型</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type" lay-verify="required"> |
| | | </select></div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 排序值</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="order" lay-verify="number|required" placeholder="值越小越靠前" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 图标</label> |
| | | <div class="layui-input-block"> |
| | | |
| | | <img id="img_icon" style="display: block;margin-bottom: 10px; max-height:100px; "/> |
| | | <button type="button" class="layui-btn" id="upload_icon" style="margin-bottom: 5px"> |
| | | <i class="layui-icon"></i>上传图片 |
| | | </button> |
| | | <input class="layui-input" type="text" name="icon" placeholder="请输入图片链接"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 是否显示</label> |
| | | <div class="layui-input-block"> |
| | | <input type="checkbox" name="show" lay-skin="switch"></div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 显示开始时间</label> |
| | | <div class="layui-input-block"> |
| | | <input type="datetime" name="startTime" lay-verify="required|datetime" placeholder="" |
| | | autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 显示结束时间</label> |
| | | <div class="layui-input-block"> |
| | | <input type="datetime" name="endTime" lay-verify="required|datetime" placeholder="" |
| | | autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">确定</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | //初始化上传控件 |
| | | var uploadTool = { |
| | | callback: null, |
| | | chooseImage: {}, |
| | | uploadArray: new Array(), |
| | | init: function (upload) { |
| | | this.uploadArray = new Array(); |
| | | this.uploadArray.push(upload.render({ |
| | | elem: '#upload_icon', //绑定元素 |
| | | url: '/admin/api/file/uploadImg', //上传接口 |
| | | data: { |
| | | "type": "task", |
| | | }, |
| | | auto: false, |
| | | accept: 'images', |
| | | acceptMime: 'image/*', |
| | | field: "file_url", |
| | | choose: function (obj) { |
| | | //将每次选择的文件追加到文件队列 |
| | | var files = obj.pushFile(); |
| | | //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9) |
| | | obj.preview(function (index, file, result) { |
| | | console.log(index); //得到文件索引 |
| | | console.log(file); //得到文件对象 |
| | | console.log(result); //得到文件base64编码,比如图片 |
| | | $("#img_icon").attr("src", result); |
| | | //记录选中的文件 |
| | | uploadTool.chooseImage["icon"] = "1"; |
| | | }); |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); |
| | | }, |
| | | done: function (res, index, upload) { |
| | | layer.closeAll('loading'); //关闭loading |
| | | //上传完毕后删除 |
| | | if (res.code == 0) { |
| | | //获取链接 |
| | | $("input[name='icon']").val(res.data.url); |
| | | delete uploadTool.chooseImage["icon"]; |
| | | if (Object.keys(uploadTool.chooseImage).length == 0) { |
| | | //全部上传成功 |
| | | uploadTool.callback(true); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, |
| | | error: function (index, upload) { |
| | | layer.msg("图标上传出错"); |
| | | layer.closeAll('loading'); //关闭loading |
| | | } |
| | | })); |
| | | |
| | | }, |
| | | upload: function (result) { |
| | | if (this.uploadArray.length > 0 && Object.keys(this.chooseImage).length > 0) { |
| | | this.callback = result; |
| | | //同时上传 |
| | | for (var i = 0; i < this.uploadArray.length; i++) { |
| | | this.uploadArray[i].upload(); |
| | | } |
| | | } else { |
| | | result(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'layer', 'jquery', 'upload', 'laydate'], function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | upload = layui.upload, |
| | | laydate = layui.laydate; |
| | | |
| | | var verify = {}; |
| | | //自定义验证规则 |
| | | form.verify(verify); |
| | | |
| | | //渲染上传控件 |
| | | uploadTool.init(upload); |
| | | |
| | | laydate.render({ |
| | | elem: "input[name=startTime]", //指定元素 |
| | | type: 'datetime' |
| | | }); |
| | | laydate.render({ |
| | | elem: "input[name=endTime]", //指定元素 |
| | | type: 'datetime' |
| | | }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //转换json对象 |
| | | for (key in data.field) { |
| | | if (key.indexOf(".") > -1) { |
| | | var value = data.field[key]; |
| | | delete data.field[key]; |
| | | var onkeys = key.split("."); |
| | | //创建对象 |
| | | if (data.field[onkeys[0]] == undefined) { |
| | | data.field[onkeys[0]] = {}; |
| | | } |
| | | data.field[onkeys[0]][onkeys[1]] = value; |
| | | } |
| | | } |
| | | uploadTool.upload(function (hasFile) { |
| | | if (hasFile) { |
| | | //从新提交表单 |
| | | $("button[lay-filter=add]").click(); |
| | | return; |
| | | } |
| | | |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/goldcorn/task/add', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("增加成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | //关闭当前frame |
| | | xadmin.close(); |
| | | // 可以对父窗口进行刷新 |
| | | // xadmin.father_reload(); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }); |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | var params = {}; |
| | | |
| | | ksapp.postJSON('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].key + "'>"; |
| | | html += res.data[i].value + "</option>"; |
| | | $("select[name=type]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }) |
| | | ; |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>金币任务信息列表</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <link rel="stylesheet" href="../css/theme3049.min.css"> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | <script src="../js/utils.js"></script> |
| | | <style> |
| | | |
| | | tbody .layui-table-cell { |
| | | height: 50px; |
| | | line-height: 50px; |
| | | } |
| | | |
| | | |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div class="x-nav"> |
| | | <span class="layui-breadcrumb"> |
| | | <a href="">###</a> |
| | | <a> |
| | | <cite>###</cite></a> |
| | | </span> |
| | | <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" |
| | | onclick="location.reload()" title="刷新"> |
| | | <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i> |
| | | </a> |
| | | </div> |
| | | <div class="layui-fluid" id="app"> |
| | | <div class="layui-row layui-col-space15"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <form class="layui-form layui-col-space5"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="kw" lay-verify="" placeholder="内容关键词" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button id="search" class="layui-btn" lay-submit="" lay-filter="search"> |
| | | <i class="layui-icon"></i></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | <div class="layui-card-body "> |
| | | <table class="layui-table" id="table_list" lay-filter="app"> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </body> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" onclick="xadmin.open('添加金币任务信息','gold_corn_task_type_info_add.html',500,580)"><i |
| | | class="layui-icon"></i>添加 |
| | | </button> |
| | | <button class="layui-btn layui-btn-danger" lay-event="delete"> |
| | | <i class="layui-icon"></i> |
| | | 删除 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="修改" onclick="xadmin.open('修改金币任务信息','gold_corn_task_type_info_update.html?id={{d.id}}',500,580)" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="statusContainer"> |
| | | <div class="layui-btn-container"> |
| | | {{# if(d.status==0){ }} |
| | | <span class="layui-btn layui-btn-mini"> |
| | | 正常 |
| | | </span> |
| | | {{# }else{ }} |
| | | <span class="layui-btn layui-btn-danger layui-btn-mini"> |
| | | 已删除 |
| | | </span> |
| | | {{# } }} |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="imgshow"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <img src="{{d.}}"/> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app=null; |
| | | $(function () { |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '', |
| | | appList: [] |
| | | }, |
| | | watch: {}, |
| | | created: function () { |
| | | |
| | | }, |
| | | methods: { |
| | | init: function () { |
| | | //初始化 |
| | | layui.use(['laydate', 'form', 'table'], function () { |
| | | var laydate = layui.laydate, |
| | | form = layui.form, |
| | | table = layui.table; |
| | | //渲染日期输入框 |
| | | //搜索条件 |
| | | form.on('submit(search)', function (data) { |
| | | app.search(data.field); |
| | | return false; |
| | | }); |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: "/admin/api/goldcorn/task/list", |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 120, sort: false, title: "ID"}, |
| | | {field: 'name', width: 120, sort: false, title: "任务名称"}, |
| | | {field: 'icon', width: 120, sort: false, title: "任务图标",templet:function(res){ |
| | | return "<img src='"+res.icon+"' style='height:50px;'>"; |
| | | } |
| | | }, |
| | | {field: 'type', width: 120, sort: false, title: "任务类型"}, |
| | | {field: 'show', width: 80, sort: false, title: "是否显示",templet:function(res){ |
| | | if(res.show){ |
| | | return " <input type=\"checkbox\" checked='true' disabled lay-skin=\"switch\""; |
| | | }else{ |
| | | return " <input type=\"checkbox\" disabled lay-skin=\"switch\""; |
| | | } |
| | | } |
| | | }, |
| | | {field: 'startTime', width: 150, sort: false, title: "显示开始时间"}, |
| | | {field: 'endTime', width: 150, sort: false, title: "显示结束时间"}, |
| | | {field: 'createTime', width: 150, sort: false, title: "创建时间"}, |
| | | {field: 'updateTime', width: 150, sort: false, title: "修改时间"}, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#optContainer'}]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | | return; |
| | | if (res.data.list == null) |
| | | return; |
| | | console.log(res.data.list) |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | }, |
| | | error: function (e, msg) { |
| | | ksapp.tableError(e) |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | table.on('toolbar(app)', |
| | | function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch (obj.event) { |
| | | case 'delete': |
| | | var data = checkStatus.data; |
| | | if (data == null || data.length == 0) { |
| | | layer.msg("未选择选项"); |
| | | return; |
| | | } |
| | | var ids = new Array(); |
| | | for (var i = 0; i < data.length; i++) |
| | | ids.push(data[i].id); |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.deleteList(ids, function () { |
| | | layer.msg("删除成功"); |
| | | $("form").submit(); |
| | | }); |
| | | }); |
| | | |
| | | break; |
| | | }; |
| | | }); |
| | | //请求搜索表单中需要的数据 |
| | | $('#search').trigger("click"); |
| | | }); |
| | | |
| | | }, |
| | | delete: function (obj, index, id) { |
| | | var ids = new Array(); |
| | | ids.push(id); |
| | | app.deleteList(ids, function () { |
| | | $(obj).parents("tr").remove(); |
| | | layer.msg('已删除!', {icon: 1, time: 1000}); |
| | | }); |
| | | }, |
| | | deleteList: function (ids, success) { |
| | | ksapp.post("/admin/api/goldcorn/task/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | search: function (params) { |
| | | |
| | | var ps = {}; |
| | | for (var key in params) { |
| | | if (params[key].length > 0) { |
| | | ps[key] = params[key]; |
| | | } |
| | | } |
| | | //数据重载 |
| | | tableIns.reload({ |
| | | where: ps, |
| | | page: { |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | }); |
| | | app.init(); |
| | | }); |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | </script> |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>修改金币任务信息</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | </head> |
| | | <body> |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form" lay-filter="update"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 任务名称</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 任务类型</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type" lay-verify="required" disabled="disabled"> |
| | | </select></div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 排序值</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="order" lay-verify="number|required" placeholder="值越小越靠前" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 图标</label> |
| | | <div class="layui-input-block"> |
| | | |
| | | <img id="img_icon" style="display: block;margin-bottom: 10px; max-height:100px; "/> |
| | | <button type="button" class="layui-btn" id="upload_icon" style="margin-bottom: 5px"> |
| | | <i class="layui-icon"></i>上传图片 |
| | | </button> |
| | | <input class="layui-input" type="text" name="icon" placeholder="请输入图片链接"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 是否显示</label> |
| | | <div class="layui-input-block"> |
| | | <input type="checkbox" name="show" lay-skin="switch"></div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 显示开始时间</label> |
| | | <div class="layui-input-block"> |
| | | <input type="datetime" name="startTime" lay-verify="required|datetime" placeholder="" |
| | | autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 显示结束时间</label> |
| | | <div class="layui-input-block"> |
| | | <input type="datetime" name="endTime" lay-verify="required|datetime" placeholder="" |
| | | autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="update" lay-submit="">确定修改</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | //初始化上传控件 |
| | | var uploadTool = { |
| | | callback: null, |
| | | chooseImage: {}, |
| | | uploadArray: new Array(), |
| | | init: function (upload) { |
| | | this.uploadArray = new Array(); |
| | | this.uploadArray.push(upload.render({ |
| | | elem: '#upload_icon', //绑定元素 |
| | | url: '/admin/api/file/uploadImg', //上传接口 |
| | | data: { |
| | | "type": "null", |
| | | }, |
| | | auto: false, |
| | | accept: 'images', |
| | | acceptMime: 'image/*', |
| | | field: "file_url", |
| | | choose: function (obj) { |
| | | //将每次选择的文件追加到文件队列 |
| | | var files = obj.pushFile(); |
| | | //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9) |
| | | obj.preview(function (index, file, result) { |
| | | console.log(index); //得到文件索引 |
| | | console.log(file); //得到文件对象 |
| | | console.log(result); //得到文件base64编码,比如图片 |
| | | $("#img_icon").attr("src", result); |
| | | //记录选中的文件 |
| | | uploadTool.chooseImage["icon"] = "1"; |
| | | }); |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); |
| | | }, |
| | | done: function (res, index, upload) { |
| | | console.log("上传完成"); |
| | | layer.closeAll('loading'); //关闭loading |
| | | //上传完毕后删除 |
| | | if (res.code == 0) { |
| | | //获取链接 |
| | | $("input[name='icon']").val(res.data.url); |
| | | delete uploadTool.chooseImage["icon"]; |
| | | if (Object.keys(uploadTool.chooseImage).length == 0) { |
| | | //全部上传成功 |
| | | uploadTool.callback(true); |
| | | } |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, |
| | | error: function (index, upload) { |
| | | layer.msg("图标上传出错"); |
| | | layer.closeAll('loading'); //关闭loading |
| | | } |
| | | })); |
| | | |
| | | }, |
| | | upload: function (result) { |
| | | console.log("上传文件开始"); |
| | | if (this.uploadArray.length > 0&&Object.keys(this.chooseImage).length>0) { |
| | | console.log("有文件"); |
| | | this.callback = result; |
| | | //同时上传 |
| | | for (var i = 0; i < this.uploadArray.length; i++) { |
| | | this.uploadArray[i].upload(); |
| | | } |
| | | } else { |
| | | console.log("没有文件"); |
| | | result(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | //填充数据 |
| | | function fillData(form) { |
| | | var id = ksapp.getQueryParam("id"); |
| | | if (id) { |
| | | } else { |
| | | layer.msg("id为空"); |
| | | return; |
| | | } |
| | | |
| | | ksapp.post('/admin/api/goldcorn/task/get', {id: id}, function (res) { |
| | | if (res.code == 0) { |
| | | form.val("update", res.data); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | layer.msg("详情获取失败"); |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'layer', 'jquery', 'upload', 'laydate'], function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | upload = layui.upload, |
| | | laydate = layui.laydate; |
| | | |
| | | var verify = {}; |
| | | //自定义验证规则 |
| | | form.verify(verify); |
| | | |
| | | laydate.render({ |
| | | elem: "input[name=startTime]", //指定元素 |
| | | type: 'datetime' |
| | | }); |
| | | laydate.render({ |
| | | elem: "input[name=endTime]", //指定元素 |
| | | type: 'datetime' |
| | | }); |
| | | |
| | | //渲染上传控件 |
| | | uploadTool.init(upload); |
| | | |
| | | //填充表单数据 |
| | | //请求数据 |
| | | //form.data(); |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(update)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //转换json对象 |
| | | for (key in data.field) { |
| | | if (key.indexOf(".") > -1) { |
| | | var value = data.field[key]; |
| | | delete data.field[key]; |
| | | var onkeys = key.split("."); |
| | | //创建对象 |
| | | if (data.field[onkeys[0]] == undefined) { |
| | | data.field[onkeys[0]] = {}; |
| | | } |
| | | data.field[onkeys[0]][onkeys[1]] = value; |
| | | } |
| | | } |
| | | uploadTool.upload(function (hasFile) { |
| | | console.log("上传文件回调"); |
| | | if (hasFile) { |
| | | //从新提交表单 |
| | | $("button[lay-filter=update]").click(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | //发异步,把数据提交给php |
| | | var params = data.field; |
| | | params.id = ksapp.getQueryParam("id"); |
| | | |
| | | ksapp.post('/admin/api/goldcorn/task/update', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("修改成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | //关闭当前frame |
| | | xadmin.close(); |
| | | // 可以对父窗口进行刷新 |
| | | // xadmin.father_reload(); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }); |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | |
| | | var preRequestCount = 1 |
| | | var params = {}; |
| | | |
| | | ksapp.post('/admin/api/goldcorn/task/getTypeList', params, function (res) { |
| | | if (res.code == 0) { |
| | | //填充数据 |
| | | $("select[name=type]").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | var html = "<option value='" + res.data[i].key + "'>"; |
| | | html += res.data[i].value + "</option>"; |
| | | $("select[name=type]").append(html); |
| | | } |
| | | //重新渲染表单 |
| | | form.render(); |
| | | preRequestCount--; |
| | | if (preRequestCount <= 0) { |
| | | //开始填充数据 |
| | | fillData(form) |
| | | } |
| | | |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }) |
| | | ; |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | <cite>金币管理</cite> |
| | | <i class="iconfont nav_right"></i></a> |
| | | <ul class="sub-menu"> |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('金币任务','goldcorn/gold_corn_task_type_info_list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>金币任务</cite></a> |
| | | </li> |
| | | |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('金币汇率','goldcorn/gold_corn_money_exchange_rate_record_list.html')"> |
| | | <i class="iconfont"></i> |
| | |
| | | package test.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.Application; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetFrequencyConfigService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService; |
| | |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | record.setType(GoldCornGetType.readNovel); |
| | | record.setLevel(GoldCornGetRecord.LEVEL_OWN); |
| | | record.setDay("2022-04-07"); |
| | | record.setEventCount(1L); |
| | | goldCornGetRecordService.add(record); |
| | | } |
| | | |
| | |
| | | @Test |
| | | public void makeGoldCorn() { |
| | | try { |
| | | goldCornMakeService.addGoldCorn(22384L, GoldCornGetType.watchVideo,false,new Date(),null); |
| | | goldCornMakeService.addGoldCorn(22384L, GoldCornGetType.watchVideo, false, new Date(), null, 1L); |
| | | // goldCornMakeService.addGoldCorn(22380L,GoldCornGetType.readNovel,new Date()); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetPriceException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetFrequencyConfigException e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | @Test |
| | | public void settle(){ |
| | | goldCornSettleService.startSettle(new Date(System.currentTimeMillis()-1000*60*60*24L)); |
| | | public void settle() { |
| | | goldCornSettleService.startSettle(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L)); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private GoldCornGetFrequencyConfigService goldCornGetFrequencyConfigService; |
| | | |
| | | public void getFrequencys() { |
| | | List<GoldCornGetFrequencyConfig> list = goldCornGetFrequencyConfigService.listByTypes(Arrays.asList(new GoldCornGetType[]{GoldCornGetType.watchVideo, GoldCornGetType.readNovel, GoldCornGetType.scanNews}), SystemEnum.svmm, new Date()); |
| | | |
| | | } |
| | | |
| | | } |