From 92eadc582305983ae679ed80e5d9d9692bf4371b Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 09 May 2022 18:12:27 +0800 Subject: [PATCH] add score some interface --- src/main/java/cc/mrbird/febs/mall/controller/ApiScoreController.java | 47 +++++ src/main/java/cc/mrbird/febs/mall/entity/MallScoreSignRecord.java | 24 ++ src/main/java/cc/mrbird/febs/mall/controller/AdminScoreController.java | 33 +++ src/main/java/cc/mrbird/febs/mall/service/ICommonService.java | 2 src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java | 140 +++++++++++++++ src/main/java/cc/mrbird/febs/mall/dto/ScoreSettingDto.java | 23 ++ src/main/java/cc/mrbird/febs/common/enumerates/MoneyFlowTypeEnum.java | 7 src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java | 33 +++ src/main/java/cc/mrbird/febs/mall/vo/ScoreSignVo.java | 24 ++ src/main/java/cc/mrbird/febs/mall/mapper/MallScoreSignRecordMapper.java | 10 + src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java | 19 ++ src/main/resources/templates/febs/views/modules/score/setting.html | 113 ++++++++++++ src/main/resources/mapper/modules/MallScoreSignRecordMapper.xml | 12 + src/main/java/cc/mrbird/febs/mall/service/IScoreService.java | 10 + src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java | 20 ++ 15 files changed, 516 insertions(+), 1 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java new file mode 100644 index 0000000..8025645 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java @@ -0,0 +1,19 @@ +package cc.mrbird.febs.common.enumerates; + +import lombok.Data; +import lombok.Getter; + +@Getter +public enum DataDictionaryEnum { + + SCORE_SIGN_SETTING("SCORE_SETTING", "SCORE_SIGN_SETTING"); + + private String type; + + private String code; + + DataDictionaryEnum(String type, String code) { + this.type = type; + this.code = code; + } +} diff --git a/src/main/java/cc/mrbird/febs/common/enumerates/MoneyFlowTypeEnum.java b/src/main/java/cc/mrbird/febs/common/enumerates/MoneyFlowTypeEnum.java index 9a46f03..8a023ba 100644 --- a/src/main/java/cc/mrbird/febs/common/enumerates/MoneyFlowTypeEnum.java +++ b/src/main/java/cc/mrbird/febs/common/enumerates/MoneyFlowTypeEnum.java @@ -68,7 +68,12 @@ /** * 佣金转余额 */ - COMMISSION_TO_BALANCE(13); + COMMISSION_TO_BALANCE(13), + + /** + * 竞猜积分签到 + */ + SCORE_SIGN(14); private final int value; diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminScoreController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminScoreController.java new file mode 100644 index 0000000..ed40bb2 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminScoreController.java @@ -0,0 +1,33 @@ +package cc.mrbird.febs.mall.controller; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; +import cc.mrbird.febs.mall.dto.ScoreSettingDto; +import cc.mrbird.febs.mall.service.ICommonService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping(value = "/admin/score") +public class AdminScoreController { + + private final ICommonService commonService; + + @PostMapping(value = "/addSetting") + public FebsResponse addSetting(ScoreSettingDto scoreSettingDto) { + commonService.addDataDic(DataDictionaryEnum.SCORE_SIGN_SETTING.getType(), DataDictionaryEnum.SCORE_SIGN_SETTING.getCode(), scoreSettingDto, "积分签到设置"); + return new FebsResponse().success(); + } + +} diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiScoreController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiScoreController.java new file mode 100644 index 0000000..168bda1 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiScoreController.java @@ -0,0 +1,47 @@ +package cc.mrbird.febs.mall.controller; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.mall.service.ICommonService; +import cc.mrbird.febs.mall.service.IScoreService; +import cc.mrbird.febs.mall.vo.ScoreSignVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Slf4j +@Validated +@RestController +@CrossOrigin("*") +@RequiredArgsConstructor +@RequestMapping(value = "/api/score") +@Api(value = "ApiScoreController", tags = "积分接口类") +public class ApiScoreController { + + private final IScoreService scoreService; + + @ApiOperation(value = "积分签到", notes = "积分签到") + @ApiResponses({ + @ApiResponse(code = 200, message = "success", response = ScoreSignVo.class) + }) + @GetMapping(value = "/signSetting") + public FebsResponse signSetting() { + return new FebsResponse().success().data(scoreService.scoreSign()); + } + + @ApiOperation(value = "签到", notes = "签到") + @PostMapping(value = "/sign") + public FebsResponse sign() { + scoreService.sign(); + return new FebsResponse().success(); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java new file mode 100644 index 0000000..14ec623 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java @@ -0,0 +1,33 @@ +package cc.mrbird.febs.mall.controller; + +import cc.mrbird.febs.common.entity.FebsConstant; +import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; +import cc.mrbird.febs.common.utils.FebsUtil; +import cc.mrbird.febs.mall.dto.ScoreSettingDto; +import cc.mrbird.febs.mall.entity.DataDictionaryCustom; +import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller("scoreView") +@RequestMapping(FebsConstant.VIEW_PREFIX + "modules/score") +@RequiredArgsConstructor +public class ViewScoreController { + + private final DataDictionaryCustomMapper dataDictionaryCustomMapper; + + @GetMapping("setting") +// @RequiresPermissions("orderList:view") + public String setting(Model model) { + DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SCORE_SIGN_SETTING.getType(), DataDictionaryEnum.SCORE_SIGN_SETTING.getCode()); + if (dic != null) { + model.addAttribute("obj", JSONObject.parseObject(dic.getValue(), ScoreSettingDto.class)); + } + return FebsUtil.view("modules/score/setting"); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ScoreSettingDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ScoreSettingDto.java new file mode 100644 index 0000000..e9ca2a4 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/ScoreSettingDto.java @@ -0,0 +1,23 @@ +package cc.mrbird.febs.mall.dto; + +import lombok.Data; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Data +public class ScoreSettingDto { + + private Integer signInOne; + private Integer signInTwo; + private Integer signInThree; + private Integer signInFour; + private Integer signInFive; + private Integer signInSix; + private Integer signInSeven; + + private Integer signInTotal; + private Integer signInMore; + private Integer mostSignIn; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallScoreSignRecord.java b/src/main/java/cc/mrbird/febs/mall/entity/MallScoreSignRecord.java new file mode 100644 index 0000000..3b6cb16 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/MallScoreSignRecord.java @@ -0,0 +1,24 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Data +@TableName("mall_score_sign_record") +public class MallScoreSignRecord extends BaseEntity { + + private Long memberId; + + private Integer totalCnt; + + private Integer score; + + private Date signTime; +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallScoreSignRecordMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallScoreSignRecordMapper.java new file mode 100644 index 0000000..e4be297 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallScoreSignRecordMapper.java @@ -0,0 +1,10 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.MallScoreSignRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +public interface MallScoreSignRecordMapper extends BaseMapper<MallScoreSignRecord> { + + MallScoreSignRecord selectRecentSignRecord(@Param("memberId") Long memberId); +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java b/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java index bb78e28..508e71e 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java +++ b/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java @@ -15,4 +15,6 @@ List<DataDictionaryCustom> findDataDicByType(String type); List<AppVersion> findAppVersion(); + + void addDataDic(String type, String key, Object value, String description); } diff --git a/src/main/java/cc/mrbird/febs/mall/service/IScoreService.java b/src/main/java/cc/mrbird/febs/mall/service/IScoreService.java new file mode 100644 index 0000000..7a644e9 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/IScoreService.java @@ -0,0 +1,10 @@ +package cc.mrbird.febs.mall.service; + +import cc.mrbird.febs.mall.vo.ScoreSignVo; + +public interface IScoreService { + + ScoreSignVo scoreSign(); + + void sign(); +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java b/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java index 422b085..6f2fe47 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java @@ -8,6 +8,7 @@ import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; import cc.mrbird.febs.mall.service.ICommonService; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -53,4 +54,23 @@ public List<AppVersion> findAppVersion() { return appVersionMapper.selectList(null); } + + @Override + public void addDataDic(String type, String code, Object value, String description) { + DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code); + + String data = JSONObject.toJSONString(value); + if (dic != null) { + dic.setValue(data); + dataDictionaryCustomMapper.updateById(dic); + return; + } + + dic = new DataDictionaryCustom(); + dic.setCode(code); + dic.setType(type); + dic.setValue(data); + dic.setDescription(description); + dataDictionaryCustomMapper.insert(dic); + } } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java new file mode 100644 index 0000000..19c4605 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java @@ -0,0 +1,140 @@ +package cc.mrbird.febs.mall.service.impl; + +import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; +import cc.mrbird.febs.common.enumerates.FlowTypeEnum; +import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; +import cc.mrbird.febs.common.exception.FebsException; +import cc.mrbird.febs.common.utils.LoginUserUtil; +import cc.mrbird.febs.mall.dto.ScoreSettingDto; +import cc.mrbird.febs.mall.entity.DataDictionaryCustom; +import cc.mrbird.febs.mall.entity.MallMember; +import cc.mrbird.febs.mall.entity.MallMemberWallet; +import cc.mrbird.febs.mall.entity.MallScoreSignRecord; +import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; +import cc.mrbird.febs.mall.mapper.MallMemberWalletMapper; +import cc.mrbird.febs.mall.mapper.MallScoreSignRecordMapper; +import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; +import cc.mrbird.febs.mall.service.IMallMoneyFlowService; +import cc.mrbird.febs.mall.service.IScoreService; +import cc.mrbird.febs.mall.vo.ScoreSignVo; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class ScoreServiceImpl implements IScoreService { + + private final MallMemberWalletMapper mallMemberWalletMapper; + private final DataDictionaryCustomMapper dataDictionaryCustomMapper; + private final MallScoreSignRecordMapper mallScoreSignRecordMapper; + private final IMallMoneyFlowService mallMoneyFlowService; + private final IApiMallMemberWalletService walletService; + + @Override + public ScoreSignVo scoreSign() { + MallMember member = LoginUserUtil.getLoginUser(); + + MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(member.getId()); + + ScoreSignVo scoreSign = new ScoreSignVo(); + scoreSign.setMineScore(wallet.getPrizeScore().intValue()); + scoreSign.setHasSignDays(1); + + DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SCORE_SIGN_SETTING.getType(), DataDictionaryEnum.SCORE_SIGN_SETTING.getCode()); + + if (dic != null) { + scoreSign.setSetting(JSONObject.parseObject(dic.getValue(), ScoreSettingDto.class)); + } + return scoreSign; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void sign() { + MallMember member = LoginUserUtil.getLoginUser(); + + DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SCORE_SIGN_SETTING.getType(), DataDictionaryEnum.SCORE_SIGN_SETTING.getCode()); + if (dic == null) { + throw new FebsException("暂未设置积分"); + } + + MallScoreSignRecord mallScoreSignRecord = mallScoreSignRecordMapper.selectRecentSignRecord(member.getId()); + if (mallScoreSignRecord == null) { + mallScoreSignRecord = new MallScoreSignRecord(); + } + + System.out.println(DateUtil.between(mallScoreSignRecord.getSignTime(), new Date(), DateUnit.DAY)); + if (mallScoreSignRecord.getSignTime() != null && DateUtil.between(mallScoreSignRecord.getSignTime(), new Date(), DateUnit.DAY) == 0) { + throw new FebsException("今天已签到"); + } + + ScoreSettingDto scoreSetting = JSONObject.parseObject(dic.getValue(),ScoreSettingDto.class); + int days = mallScoreSignRecord.getTotalCnt() == null ? 1 : mallScoreSignRecord.getTotalCnt() + 1; + switch (days) { + case 1: + if (scoreSetting.getSignInOne() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInOne()); + break; + case 2: + if (scoreSetting.getSignInTwo() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInTwo()); + break; + case 3: + if (scoreSetting.getSignInThree() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInThree()); + break; + case 4: + if (scoreSetting.getSignInFour() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInFour()); + break; + case 5: + if (scoreSetting.getSignInFive() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInFive()); + break; + case 6: + if (scoreSetting.getSignInSix() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInSix()); + break; + case 7: + if (scoreSetting.getSignInSeven() == null) { + throw new FebsException("积分未设置"); + } + mallScoreSignRecord.setScore(scoreSetting.getSignInSeven()); + break; + } + + mallScoreSignRecord.setMemberId(member.getId()); + mallScoreSignRecord.setTotalCnt(days); + mallScoreSignRecord.setSignTime(new Date()); + mallScoreSignRecordMapper.insert(mallScoreSignRecord); + + BigDecimal amount = BigDecimal.valueOf(mallScoreSignRecord.getScore()); + walletService.add(amount, member.getId(), "prizeScore"); + mallMoneyFlowService.addMoneyFlow(member.getId(), amount, MoneyFlowTypeEnum.SCORE_SIGN.getValue(), null, FlowTypeEnum.PRIZE_SCORE.getValue()); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ScoreSignVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ScoreSignVo.java new file mode 100644 index 0000000..b72f21d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/ScoreSignVo.java @@ -0,0 +1,24 @@ +package cc.mrbird.febs.mall.vo; + +import cc.mrbird.febs.mall.dto.ScoreSettingDto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wzy + * @date 2022-05-09 + **/ +@Data +@ApiModel(value = "ScoreSignVo", description = "积分签到返回参数接口") +public class ScoreSignVo { + + @ApiModelProperty(value = "我的竞猜积分") + private Integer mineScore; + + @ApiModelProperty(value = "已连续签到") + private Integer hasSignDays; + + @ApiModelProperty(value = "签到积分设置") + private ScoreSettingDto setting; +} diff --git a/src/main/resources/mapper/modules/MallScoreSignRecordMapper.xml b/src/main/resources/mapper/modules/MallScoreSignRecordMapper.xml new file mode 100644 index 0000000..7519615 --- /dev/null +++ b/src/main/resources/mapper/modules/MallScoreSignRecordMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.MallScoreSignRecordMapper"> + + + <select id="selectRecentSignRecord" resultType="cc.mrbird.febs.mall.entity.MallScoreSignRecord"> + select *, max(sign_time) signTime from mall_score_sign_record + where member_id=#{memberId} + group by member_id + </select> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/score/setting.html b/src/main/resources/templates/febs/views/modules/score/setting.html new file mode 100644 index 0000000..0364e22 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/score/setting.html @@ -0,0 +1,113 @@ +<div class="layui-fluid layui-anim febs-anim" id="score-setting" lay-title="签到积分设置"> + <div class="layui-row layui-col-space8 febs-container"> + <form class="layui-form" action="" lay-filter="score-setting-form"> + <div class="layui-card"> + <div class="layui-card-body"> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到1天:</label> + <div class="layui-input-block"> + <input type="text" name="signInOne" lay-verify="number" th:value="${obj != null ? obj.signInOne : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到2天:</label> + <div class="layui-input-block"> + <input type="text" name="signInTwo" lay-verify="number" th:value="${obj != null ? obj.signInTwo : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到3天:</label> + <div class="layui-input-block"> + <input type="text" name="signInThree" lay-verify="number" th:value="${obj != null ? obj.signInThree : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到4天:</label> + <div class="layui-input-block"> + <input type="text" name="signInFour" lay-verify="number" th:value="${obj != null ? obj.signInFour : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到5天:</label> + <div class="layui-input-block"> + <input type="text" name="signInFive" lay-verify="number" th:value="${obj != null ? obj.signInFive : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到6天:</label> + <div class="layui-input-block"> + <input type="text" name="signInSix" lay-verify="number" th:value="${obj != null ? obj.signInSix : null}" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到7天:</label> + <div class="layui-input-block"> + <input type="text" name="signInSeven" lay-verify="number" th:value="${obj != null ? obj.signInSeven : null}" autocomplete="off" class="layui-input"> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label ">连续签到</label> + <div class="layui-input-inline" style="width: 120px"> + <input type="text" name="signInTotal" lay-verify="number" th:value="${obj != null ? obj.signInTotal : null}" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid">天,可获得额外</div> + <div class="layui-input-inline" style="width: 120px"> + <input type="text" name="signInMore" lay-verify="number" th:value="${obj != null ? obj.signInMore : null}" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid">竞猜积分</div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label ">最多可得积分:</label> + <div class="layui-input-block"> + <input type="text" name="mostSignIn" lay-verify="number" th:value="${obj != null ? obj.mostSignIn : null}" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + + <div class="layui-card-footer"> + <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="score-setting-form-submit" id="submit">保存</button> + </div> + </div> + </form> + +<!-- <div class="layui-form-item febs-hide">--> +<!-- <button class="layui-btn" lay-submit="" lay-filter="score-setting-form-submit" id="submit-form"></button>--> +<!-- <button type="reset" class="layui-btn" id="reset"></button>--> +<!-- </div>--> + </div> +</div> +<style> + .layui-form-label { + width: 120px; + } + + .layui-form-item .layui-input-block { + margin-left: 150px; + } + + .layui-table-form .layui-form-item { + margin-bottom: 20px !important; + } +</style> +<script data-th-inline="javascript" type="text/javascript"> + layui.use(['dropdown', 'jquery', 'validate', 'febs', 'form', 'eleTree'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + validate = layui.validate, + $view = $('#score-setting'); + + form.verify(validate); + form.render(); + + form.on('submit(score-setting-form-submit)', function (data) { + console.log(data); + febs.post(ctx + 'admin/score/addSetting', data.field, function (res) { + febs.alert.success('设置成功'); + }); + return false; + }); + }); +</script> \ No newline at end of file -- Gitblit v1.9.1