2个文件已删除
3 文件已重命名
13个文件已修改
4 文件已复制
87个文件已添加
| | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-vip</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-app</artifactId> |
New file |
| | |
| | | package com.ks.app.controller.admin.lijin; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.lijin.pojo.DO.LiJinProviderAccount; |
| | | import com.ks.lijin.service.LiJinProviderAccountService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/lijin/providerAccount") |
| | | public class LiJinProviderAccountAdminController { |
| | | |
| | | |
| | | @Reference(version = "1.0") |
| | | private LiJinProviderAccountService liJinProviderAccountService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "listByPage") |
| | | public Result listByPage(int page, int pageSize, LiJinProviderAccount t, HttpServletRequest request) { |
| | | try { |
| | | List<LiJinProviderAccount> list = liJinProviderAccountService.listByPage(page, pageSize, t); |
| | | long count = liJinProviderAccountService.count(t); |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | PageEntity pe = new PageEntity(page, pageSize, count, totalPage); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pe", pe); |
| | | map.put("list", list); |
| | | return ResultUtils.loadTrue(map); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("查询失败!"); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "add") |
| | | public Result add(LiJinProviderAccount t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderAccountService.insertSelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "modify") |
| | | public Result modify(LiJinProviderAccount t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderAccountService.updateByPrimaryKeySelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "delete") |
| | | public Result delete(String ids, HttpServletRequest request) { |
| | | try { |
| | | Gson gson = new Gson(); |
| | | List<Long> listId = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType()); |
| | | if (listId == null || listId.size() == 0) { |
| | | return ResultUtils.loadFalse("请选择删除的数据!"); |
| | | } |
| | | |
| | | for (Long id: listId) { |
| | | liJinProviderAccountService.delete(id); |
| | | } |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("删除失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
File was renamed from app/src/main/java/com/ks/app/controller/lijin/LiJinProviderAdminController.java |
| | |
| | | package com.ks.app.controller.lijin; |
| | | package com.ks.app.controller.admin.lijin; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import com.ks.lijin.service.LiJinProviderService; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | 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.StringUtil; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
New file |
| | |
| | | package com.ks.app.controller.admin.lijin; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import com.ks.lijin.pojo.DO.LiJinProviderLink; |
| | | import com.ks.lijin.service.LiJinProviderLinkService; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/lijin/providerLink") |
| | | public class LiJinProviderLinkAdminController { |
| | | |
| | | |
| | | @Reference(version = "1.0") |
| | | private LiJinProviderLinkService liJinProviderLinkService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "listByPage") |
| | | public Result listByPage(int page, int pageSize, LiJinProviderLink t, HttpServletRequest request) { |
| | | try { |
| | | List<LiJinProviderLink> list = liJinProviderLinkService.listByPage(page, pageSize, t); |
| | | long count = liJinProviderLinkService.count(t); |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | PageEntity pe = new PageEntity(page, pageSize, count, totalPage); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pe", pe); |
| | | map.put("list", list); |
| | | return ResultUtils.loadTrue(map); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("查询失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "add") |
| | | public Result add(LiJinProviderLink t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderLinkService.insertSelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "modify") |
| | | public Result modify(LiJinProviderLink t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderLinkService.updateByPrimaryKeySelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "delete") |
| | | public Result delete(String ids, HttpServletRequest request) { |
| | | try { |
| | | Gson gson = new Gson(); |
| | | List<Long> listId = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType()); |
| | | if (listId == null || listId.size() == 0) { |
| | | return ResultUtils.loadFalse("请选择删除的数据!"); |
| | | } |
| | | |
| | | for (Long id: listId) { |
| | | liJinProviderLinkService.delete(id); |
| | | } |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("删除失败!"); |
| | | } |
| | | } |
| | | |
| | | } |
copy from app/src/main/java/com/ks/app/controller/lijin/LiJinProviderAdminController.java
copy to app/src/main/java/com/ks/app/controller/admin/vip/VipComboAdminController.java
File was copied from app/src/main/java/com/ks/app/controller/lijin/LiJinProviderAdminController.java |
| | |
| | | package com.ks.app.controller.lijin; |
| | | package com.ks.app.controller.admin.vip; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import com.ks.lijin.service.LiJinProviderService; |
| | | import net.sf.json.JSONObject; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.service.VipComboService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | 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.StringUtil; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/lijin/provider") |
| | | public class LiJinProviderAdminController { |
| | | @RequestMapping("admin/api/vip/vipCombo") |
| | | public class VipComboAdminController { |
| | | |
| | | |
| | | @Reference(version = "1.0") |
| | | private LiJinProviderService liJinProviderService; |
| | | private VipComboService vipComboService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "listByPage") |
| | | public Result listByPage(int page, int pageSize, LiJinProvider provider, HttpServletRequest request) { |
| | | public Result listByPage(int page, int pageSize, VipCombo t, HttpServletRequest request) { |
| | | try { |
| | | List<LiJinProvider> list = liJinProviderService.listByPage(page, pageSize, provider); |
| | | long count = liJinProviderService.count(provider); |
| | | List<VipCombo> list = vipComboService.listByPage(page, pageSize, t); |
| | | long count = vipComboService.count(t); |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | PageEntity pe = new PageEntity(page, pageSize, count, totalPage); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "add") |
| | | public Result add(LiJinProvider t, HttpServletRequest request) { |
| | | public Result add(VipCombo t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderService.insertSelective(t); |
| | | vipComboService.insertSelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "modify") |
| | | public Result modify(LiJinProvider t, HttpServletRequest request) { |
| | | public Result modify(VipCombo t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderService.updateByPrimaryKeySelective(t); |
| | | vipComboService.updateByPrimaryKeySelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | for (Long id: listId) { |
| | | liJinProviderService.delete(id); |
| | | vipComboService.delete(id); |
| | | } |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
copy from app/src/main/java/com/ks/app/controller/lijin/LiJinProviderAdminController.java
copy to app/src/main/java/com/ks/app/controller/admin/vip/VipGradeAdminController.java
File was copied from app/src/main/java/com/ks/app/controller/lijin/LiJinProviderAdminController.java |
| | |
| | | package com.ks.app.controller.lijin; |
| | | package com.ks.app.controller.admin.vip; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import com.ks.lijin.service.LiJinProviderService; |
| | | import net.sf.json.JSONObject; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | import com.ks.vip.service.VipComboService; |
| | | import com.ks.vip.service.VipGradeService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | 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.StringUtil; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/lijin/provider") |
| | | public class LiJinProviderAdminController { |
| | | @RequestMapping("admin/api/vip/vipGrade") |
| | | public class VipGradeAdminController { |
| | | |
| | | |
| | | @Reference(version = "1.0") |
| | | private LiJinProviderService liJinProviderService; |
| | | private VipGradeService vipGradeService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "listByPage") |
| | | public Result listByPage(int page, int pageSize, LiJinProvider provider, HttpServletRequest request) { |
| | | public Result listByPage(int page, int pageSize, VipGrade t, HttpServletRequest request) { |
| | | try { |
| | | List<LiJinProvider> list = liJinProviderService.listByPage(page, pageSize, provider); |
| | | long count = liJinProviderService.count(provider); |
| | | List<VipGrade> list = vipGradeService.listByPage(page, pageSize, t); |
| | | long count = vipGradeService.count(t); |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | PageEntity pe = new PageEntity(page, pageSize, count, totalPage); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "add") |
| | | public Result add(LiJinProvider t, HttpServletRequest request) { |
| | | public Result add(VipGrade t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderService.insertSelective(t); |
| | | vipGradeService.insertSelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "modify") |
| | | public Result modify(LiJinProvider t, HttpServletRequest request) { |
| | | public Result modify(VipGrade t, HttpServletRequest request) { |
| | | try { |
| | | liJinProviderService.updateByPrimaryKeySelective(t); |
| | | vipGradeService.updateByPrimaryKeySelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | for (Long id: listId) { |
| | | liJinProviderService.delete(id); |
| | | vipGradeService.delete(id); |
| | | } |
| | | return ResultUtils.loadTrue(); |
| | | } catch (Exception e) { |
| | |
| | | return ResultUtils.loadFalse("删除失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "getValidList") |
| | | public Result getValidList(HttpServletRequest request) { |
| | | try { |
| | | List<VipGrade> validList = vipGradeService.getValidList(); |
| | | return ResultUtils.loadTrue(validList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | |
| | | |
| | | <script type="text/html" id="deleteContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="恢复" onclick="member_resume(this,{{d.LAY_INDEX }}, {{d.id}})" href="javascript:;"> |
| | | <a href="javascript:;" onclick="openLinkPage({{d.id}})"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | |
| | |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | </script> |
| | | |
| | | <script> |
| | | function openLinkPage(id) { |
| | | xadmin.open('添加党员','home.html',null,null,true); |
| | | |
| | | //重新调用打开list页面,并且刷新。 |
| | | // parent.xadmin.add_tab('home.html','list.action',true); |
| | | //关闭当前tab页面 必须后关闭。 |
| | | // xadmin.del_tab(); |
| | | } |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script type="text/html" id="statusContainer1"> |
| | |
| | | </script> |
| | | |
| | | |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <input type="checkbox" name="sex" value="{{d.state}}" lay-skin="switch" lay-text="启用|停用" lay-filter="sexDemo" {{ d.state== 1 ? 'checked': ''}} > |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | <script>layui.use('laydate', |
| | | |
| | | <script> |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | |
| | |
| | | }); |
| | | |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | |
| | | function member_resume(obj, index, id) { |
| | | layer.confirm('确认要恢复吗?', function (index) { |
| | | //发异步删除数据 |
| | | // $(obj).parents("tr").remove(); |
| | | layer.msg('已恢复!', {icon: 1, time: 1000}); |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | }); |
| | | |
| | | |
| | | //监听性别操作 |
| | | layui.form.on('switch(sexDemo)', function(obj){ |
| | | // app.update(data.id, params); |
| | | layer.tips(this.value + ' ' + this.name + ':'+ obj.elem.checked, obj.othis); |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</script> |
| | |
| | | <i class="iconfont nav_right"></i></a> |
| | | <ul class="sub-menu"> |
| | | <li> |
| | | <a onclick="xadmin.add_tab('供应商管理','app-list.html',true)"> |
| | | <a onclick="xadmin.add_tab('供应商管理','/views/lijin/provider-list.html',true)"> |
| | | <i class="iconfont"></i> |
| | | <cite>供应商管理</cite></a> |
| | | </li> |
| | |
| | | |
| | | <li> |
| | | <a href="javascript:;"> |
| | | <i class="iconfont left-nav-li" lay-tips="来源管理"></i> |
| | | <i class="iconfont left-nav-li" lay-tips="会员管理"></i> |
| | | <cite>会员管理</cite> |
| | | <i class="iconfont nav_right"></i></a> |
| | | <ul class="sub-menu"> |
| | | <li> |
| | | <a onclick="xadmin.add_tab('获取来源列表','source-get-list.html')"> |
| | | <a onclick="xadmin.add_tab('等级管理','/views/vip/grade-list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>会员管理</cite></a> |
| | | <cite>等级管理</cite></a> |
| | | </li> |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('消耗来源列表','source-consume-list.html')"> |
| | | <a onclick="xadmin.add_tab('套餐管理','/views/vip/combo-list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>套餐管理</cite></a> |
| | | </li> |
| | | <li> |
| | | <a onclick="xadmin.add_tab('订单管理','/views/vip/order-list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>订单管理</cite></a> |
| | | </li> |
| | |
| | | /** layui-v2.5.5 MIT License By https://www.layui.com */ |
| | | ;layui.define(["laytpl","laypage","layer","form","util"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=(layui.util,layui.hint()),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,y,e,t)}},c=function(){var e=this,t=e.config,i=t.id||t.index;return i&&(c.that[i]=e,c.config[i]=t),{config:t,reload:function(t){e.reload.call(e,t)},setColsWidth:function(){e.setColsWidth.call(e)},resize:function(){e.resize.call(e)}}},s=function(e){var t=c.config[e];return t||o.error("The ID option was not found in the table instance"),t||null},u=function(e,a,l,n){var o=e.templet?function(){return"function"==typeof e.templet?e.templet(l):i(t(e.templet).html()||String(a)).render(l)}():a;return n?t("<div>"+o+"</div>").text():o},y="table",h=".layui-table",f="layui-hide",p="layui-none",v="layui-table-view",m=".layui-table-tool",g=".layui-table-box",b=".layui-table-init",x=".layui-table-header",k=".layui-table-body",C=".layui-table-main",w=".layui-table-fixed",T=".layui-table-fixed-l",A=".layui-table-fixed-r",L=".layui-table-total",N=".layui-table-page",S=".layui-table-sort",W="layui-table-edit",_="layui-table-hover",E=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ','{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>',"<thead>","{{# layui.each(d.data.cols, function(i1, item1){ }}","<tr>","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),"{{# var isSort = !(item2.colGroup) && item2.sort; }}",'<th data-field="{{ item2.field||i2 }}" data-key="{{d.index}}-{{i1}}-{{i2}}" {{# if( item2.parentKey){ }}data-parentkey="{{ item2.parentKey }}"{{# } }} {{# if(item2.minWidth){ }}data-minwidth="{{item2.minWidth}}"{{# } }} '+t+' {{# if(item2.unresize || item2.colGroup){ }}data-unresize="true"{{# } }} class="{{# if(item2.hide){ }}layui-hide{{# } }}{{# if(isSort){ }} layui-unselect{{# } }}{{# if(!item2.field){ }} layui-table-col-special{{# } }}">','<div class="layui-table-cell laytable-cell-',"{{# if(item2.colGroup){ }}","group","{{# } else { }}","{{d.index}}-{{i1}}-{{i2}}",'{{# if(item2.type !== "normal"){ }}'," laytable-cell-{{ item2.type }}","{{# } }}","{{# } }}",'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>','{{# if(item2.type === "checkbox"){ }}','<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}>',"{{# } else { }}",'<span>{{item2.title||""}}</span>',"{{# if(isSort){ }}",'<span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span>',"{{# } }}","{{# } }}","</div>","</th>",e.fixed?"{{# }; }}":"","{{# }); }}","</tr>","{{# }); }}","</thead>","</table>"].join("")},z=['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ','{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>',"<tbody></tbody>","</table>"].join(""),H=['<div class="layui-form layui-border-box {{d.VIEW_CLASS}}" lay-filter="LAY-table-{{d.index}}" lay-id="{{ d.data.id }}" style="{{# if(d.data.width){ }}width:{{d.data.width}}px;{{# } }} {{# if(d.data.height){ }}height:{{d.data.height}}px;{{# } }}">',"{{# if(d.data.toolbar){ }}",'<div class="layui-table-tool">','<div class="layui-table-tool-temp"></div>','<div class="layui-table-tool-self"></div>',"</div>","{{# } }}",'<div class="layui-table-box">',"{{# if(d.data.loading){ }}",'<div class="layui-table-init" style="background-color: #fff;">','<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>',"</div>","{{# } }}","{{# var left, right; }}",'<div class="layui-table-header">',E(),"</div>",'<div class="layui-table-body layui-table-main">',z,"</div>","{{# if(left){ }}",'<div class="layui-table-fixed layui-table-fixed-l">','<div class="layui-table-header">',E({fixed:!0}),"</div>",'<div class="layui-table-body">',z,"</div>","</div>","{{# }; }}","{{# if(right){ }}",'<div class="layui-table-fixed layui-table-fixed-r">','<div class="layui-table-header">',E({fixed:"right"}),'<div class="layui-table-mend"></div>',"</div>",'<div class="layui-table-body">',z,"</div>","</div>","{{# }; }}","</div>","{{# if(d.data.totalRow){ }}",'<div class="layui-table-total">','<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ','{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>','<tbody><tr><td><div class="layui-table-cell" style="visibility: hidden;">Total</div></td></tr></tbody>',"</table>","</div>","{{# } }}","{{# if(d.data.page){ }}",'<div class="layui-table-page">','<div id="layui-table-page{{d.index}}"></div>',"</div>","{{# } }}","<style>","{{# layui.each(d.data.cols, function(i1, item1){","layui.each(item1, function(i2, item2){ }}",".laytable-cell-{{d.index}}-{{i1}}-{{i2}}{ ","{{# if(item2.width){ }}","width: {{item2.width}}px;","{{# } }}"," }","{{# });","}); }}","</style>","</div>"].join(""),R=t(window),F=t(document),j=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};j.prototype.config={limit:10,loading:!0,cellMinWidth:60,defaultToolbar:["filter","exports","print"],autoSort:!0,text:{none:"无数据"}},j.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id")||e.index,a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;a.height&&/^full-\d+$/.test(a.height)&&(e.fullHeightGap=a.height.split("-")[1],a.height=R.height()-e.fullHeightGap),e.setInit();var l=a.elem,n=l.next("."+v),o=e.elem=t(i(H).render({VIEW_CLASS:v,data:a,index:e.index}));if(a.index=e.index,e.key=a.id||a.index,n[0]&&n.remove(),l.after(o),e.layTool=o.find(m),e.layBox=o.find(g),e.layHeader=o.find(x),e.layMain=o.find(C),e.layBody=o.find(k),e.layFixed=o.find(w),e.layFixLeft=o.find(T),e.layFixRight=o.find(A),e.layTotal=o.find(L),e.layPage=o.find(N),e.renderToolbar(),e.fullSize(),a.cols.length>1){var r=e.layFixed.find(x).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},j.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,radio:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},j.prototype.setInit=function(e){var t=this,i=t.config;return i.clientWidth=i.width||function(){var e=function(t){var a,l;t=t||i.elem.parent(),a=t.width();try{l="none"===t.css("display")}catch(n){}return!t[0]||a&&!l?a:e(t.parent())};return e()}(),"width"===e?i.clientWidth:void layui.each(i.cols,function(e,a){layui.each(a,function(l,n){if(!n)return void a.splice(l,1);if(n.key=e+"-"+l,n.hide=n.hide||!1,n.colGroup||n.colspan>1){var o=0;layui.each(i.cols[e+1],function(t,i){i.HAS_PARENT||o>1&&o==n.colspan||(i.HAS_PARENT=!0,i.parentKey=e+"-"+l,o+=parseInt(i.colspan>1?i.colspan:1))}),n.colGroup=!0}t.initOpts(n)})})},j.prototype.renderToolbar=function(){var e=this,a=e.config,l=['<div class="layui-inline" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></div>','<div class="layui-inline" lay-event="update"><i class="layui-icon layui-icon-edit"></i></div>','<div class="layui-inline" lay-event="delete"><i class="layui-icon layui-icon-delete"></i></div>'].join(""),n=e.layTool.find(".layui-table-tool-temp");if("default"===a.toolbar)n.html(l);else if("string"==typeof a.toolbar){var o=t(a.toolbar).html()||"";o&&n.html(i(o).render(a))}var r={filter:{title:"筛选列",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"导出",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"打印",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}},d=[];"object"==typeof a.defaultToolbar&&layui.each(a.defaultToolbar,function(e,t){var i="string"==typeof t?r[t]:t;i&&d.push('<div class="layui-inline" title="'+i.title+'" lay-event="'+i.layEvent+'"><i class="layui-icon '+i.icon+'"></i></div>')}),e.layTool.find(".layui-table-tool-self").html(d.join(""))},j.prototype.setParentCol=function(e,t){var i=this,a=i.config,l=i.layHeader.find('th[data-key="'+a.index+"-"+t+'"]'),n=parseInt(l.attr("colspan"))||0;if(l[0]){var o=t.split("-"),r=a.cols[o[0]][o[1]];e?n--:n++,l.attr("colspan",n),l[n<1?"addClass":"removeClass"](f),r.colspan=n,r.hide=n<1;var d=l.data("parentkey");d&&i.setParentCol(e,d)}},j.prototype.setColsPatch=function(){var e=this,t=e.config;layui.each(t.cols,function(t,i){layui.each(i,function(t,i){i.hide&&e.setParentCol(i.hide,i.parentKey)})})},j.prototype.setColsWidth=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=e.setInit("width");e.eachCols(function(e,t){t.hide||i++}),o=o-function(){return"line"===t.skin||"nob"===t.skin?2:i+1}()-e.getScrollWidth(e.layMain[0])-1;var r=function(e){layui.each(t.cols,function(i,r){layui.each(r,function(i,d){var c=0,s=d.minWidth||t.cellMinWidth;return d?void(d.colGroup||d.hide||(e?l&&l<s&&(a--,c=s):(c=d.width||0,/\d+%$/.test(c)?(c=Math.floor(parseFloat(c)/100*o),c<s&&(c=s)):c||(d.width=c=0,a++)),d.hide&&(c=0),n+=c)):void r.splice(i,1)})}),o>n&&a&&(l=(o-n)/a)};r(),r(!0),e.autoColNums=a,e.eachCols(function(i,a){var n=a.minWidth||t.cellMinWidth;a.colGroup||a.hide||(0===a.width?e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(l>=n?l:n)+"px"}):/\d+%$/.test(a.width)&&e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(parseFloat(a.width)/100*o)+"px"}))});var d=e.layMain.width()-e.getScrollWidth(e.layMain[0])-e.layMain.children("table").outerWidth();if(e.autoColNums&&d>=-i&&d<=i){var c=function(t){var i;return t=t||e.layHeader.eq(0).find("thead th:last-child"),i=t.data("field"),!i&&t.prev()[0]?c(t.prev()):t},s=c(),u=s.data("key");e.getCssRule(u,function(t){var i=t.style.width||s.outerWidth();t.style.width=parseFloat(i)+d+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px")})}e.loading(!0)},j.prototype.resize=function(){var e=this;e.fullSize(),e.setColsWidth(),e.scrollPatch()},j.prototype.reload=function(e){var i=this;e=e||{},delete i.haveInit,e.data&&e.data.constructor===Array&&delete i.config.data,i.config=t.extend(!0,{},i.config,e),i.render()},j.prototype.errorView=function(e){var i=this,a=i.layMain.find("."+p),l=t('<div class="'+p+'">'+(e||"Error")+"</div>");a[0]&&(i.layNone.remove(),a.remove()),i.layFixed.addClass(f),i.layMain.find("tbody").html(""),i.layMain.append(i.layNone=l),d.cache[i.key]=[]},j.prototype.page=1,j.prototype.pullData=function(e){var i=this,a=i.config,l=a.request,n=a.response,o=function(){"object"==typeof a.initSort&&i.sort(a.initSort.field,a.initSort.type)};if(i.startTime=(new Date).getTime(),a.url){var r={};r[l.pageName]=e,r[l.limitName]=a.limit;var d=t.extend(r,a.where);a.contentType&&0==a.contentType.indexOf("application/json")&&(d=JSON.stringify(d)),i.loading(),t.ajax({type:a.method||"get",url:a.url,contentType:a.contentType,data:d,dataType:"json",headers:a.headers||{},success:function(t){"function"==typeof a.parseData&&(t=a.parseData(t)||t),t[n.statusName]!=n.statusCode?(i.renderForm(),i.errorView(t[n.msgName]||'返回的数据不符合规范,正确的成功状态码应为:"'+n.statusName+'": '+n.statusCode)):(i.renderData(t,e,t[n.countName]),o(),a.time=(new Date).getTime()-i.startTime+" ms"),i.setColsWidth(),"function"==typeof a.done&&a.done(t,e,t[n.countName])},error:function(e,t){i.errorView("数据接口请求异常:"+t),i.renderForm(),i.setColsWidth()}})}else if(a.data&&a.data.constructor===Array){var c={},s=e*a.limit-a.limit;c[n.dataName]=a.data.concat().splice(s,a.limit),c[n.countName]=a.data.length,i.renderData(c,e,c[n.countName]),o(),i.setColsWidth(),"function"==typeof a.done&&a.done(c,e,c[n.countName])}},j.prototype.eachCols=function(e){var t=this;return d.eachCols(null,e,t.config.cols),t},j.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,y=e[s.response.dataName]||[],h=[],v=[],m=[],g=function(){var e;return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(y,function(a,l){var o=[],y=[],p=[],g=a+s.limit*(n-1)+1;0!==l.length&&(r||(l[d.config.indexName]=a),c.eachCols(function(n,r){var c=r.field||n,h=s.index+"-"+r.key,v=l[c];if(void 0!==v&&null!==v||(v=""),!r.colGroup){var m=['<td data-field="'+c+'" data-key="'+h+'" '+function(){var e=[];return r.edit&&e.push('data-edit="'+r.edit+'"'),r.align&&e.push('align="'+r.align+'"'),r.templet&&e.push('data-content="'+v+'"'),r.toolbar&&e.push('data-off="true"'),r.event&&e.push('lay-event="'+r.event+'"'),r.style&&e.push('style="'+r.style+'"'),r.minWidth&&e.push('data-minwidth="'+r.minWidth+'"'),e.join(" ")}()+' class="'+function(){var e=[];return r.hide&&e.push(f),r.field||e.push("layui-table-col-special"),e.join(" ")}()+'">','<div class="layui-table-cell laytable-cell-'+function(){return"normal"===r.type?h:h+" laytable-cell-"+r.type}()+'">'+function(){var n=t.extend(!0,{LAY_INDEX:g},l),o=d.config.checkName;switch(r.type){case"checkbox":return'<input type="checkbox" name="layTableCheckbox" lay-skin="primary" '+function(){return r[o]?(l[o]=r[o],r[o]?"checked":""):n[o]?"checked":""}()+">";case"radio":return n[o]&&(e=a),'<input type="radio" name="layTableRadio_'+s.index+'" '+(n[o]?"checked":"")+' lay-type="layTableRadio">';case"numbers":return g}return r.toolbar?i(t(r.toolbar).html()||"").render(n):u(r,v,n)}(),"</div></td>"].join("");o.push(m),r.fixed&&"right"!==r.fixed&&y.push(m),"right"===r.fixed&&p.push(m)}}),h.push('<tr data-index="'+a+'">'+o.join("")+"</tr>"),v.push('<tr data-index="'+a+'">'+y.join("")+"</tr>"),m.push('<tr data-index="'+a+'">'+p.join("")+"</tr>"))}),c.layBody.scrollTop(0),c.layMain.find("."+p).remove(),c.layMain.find("tbody").html(h.join("")),c.layFixLeft.find("tbody").html(v.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),"number"==typeof e&&c.setThisRowChecked(e),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,l.close(c.tipsIndex),s.HAS_SET_COLS_PATCH||c.setColsPatch(),void(s.HAS_SET_COLS_PATCH=!0))};return d.cache[c.key]=y,c.layPage[0==o||0===y.length&&1==n?"addClass":"removeClass"](f),r?g():0===y.length?(c.renderForm(),c.errorView(s.text.none)):(c.layFixed.removeClass(f),g(),c.renderTotal(y),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'<i class="layui-icon"></i>',next:'<i class="layui-icon"></i>',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr))}},s.page),s.page.count=o,a.render(s.page))))},j.prototype.renderTotal=function(e){var t=this,i=t.config,a={};if(i.totalRow){layui.each(e,function(e,i){0!==i.length&&t.eachCols(function(e,t){var l=t.field||e,n=i[l];t.totalRow&&(a[l]=(a[l]||0)+(parseFloat(n)||0))})}),t.dataTotal={};var l=[];t.eachCols(function(e,n){var o=n.field||e,r=function(){var e=n.totalRowText||"",t=parseFloat(a[o]).toFixed(2),i={};return i[o]=t,t=u(n,t,i),n.totalRow?t||e:e}(),d=['<td data-field="'+o+'" data-key="'+i.index+"-"+n.key+'" '+function(){var e=[];return n.align&&e.push('align="'+n.align+'"'),n.style&&e.push('style="'+n.style+'"'),n.minWidth&&e.push('data-minwidth="'+n.minWidth+'"'),e.join(" ")}()+' class="'+function(){var e=[];return n.hide&&e.push(f),n.field||e.push("layui-table-col-special"),e.join(" ")}()+'">','<div class="layui-table-cell laytable-cell-'+function(){var e=i.index+"-"+n.key;return"normal"===n.type?e:e+" laytable-cell-"+n.type}()+'">'+r,"</div></td>"].join("");n.field&&(t.dataTotal[o]=r),l.push(d)}),t.layTotal.find("tbody").html("<tr>"+l.join("")+"</tr>")}},j.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},j.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},j.prototype.setThisRowChecked=function(e){var t=this,i=(t.config,"layui-table-click"),a=t.layBody.find('tr[data-index="'+e+'"]');a.addClass(i).siblings("tr").removeClass(i)},j.prototype.sort=function(e,i,a,l){var n,r,c=this,s={},u=c.config,h=u.elem.attr("lay-filter"),f=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field"),p=e.data("key");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var v=c.layHeader.find("th .laytable-cell-"+p).find(S);c.layHeader.find("th").find(S).removeAttr("lay-sort"),v.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},u.autoSort&&("asc"===i?r=layui.sort(f,n):"desc"===i?r=layui.sort(f,n,!0):(r=layui.sort(f,d.config.indexName),delete c.sortKey)),s[u.response.dataName]=r||f,c.renderData(s,c.page,c.count,!0),l&&layui.event.call(e,y,"sort("+h+")",{field:n,type:i})},j.prototype.loading=function(e){var i=this,a=i.config;a.loading&&(e?(i.layInit&&i.layInit.remove(),delete i.layInit,i.layBox.find(b).remove()):(i.layInit=t(['<div class="layui-table-init">','<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>',"</div>"].join("")),i.layBox.append(i.layInit)))},j.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},j.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},j.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(i,a){if(a.selectorText===".laytable-cell-"+e)return t(a),!0})},j.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=R.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),a&&(e=parseFloat(a)-(t.layHeader.outerHeight()||38),i.toolbar&&(e-=t.layTool.outerHeight()||50),i.totalRow&&(e-=t.layTotal.outerHeight()||40),i.page&&(e-=t.layPage.outerHeight()||41),t.layMain.css("height",e-2))},j.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},j.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=(e.getScrollWidth(e.layMain[0]),i.outerWidth()-e.layMain.width()),o=function(e){if(a&&l){if(e=e.eq(0),!e.find(".layui-table-patch")[0]){var i=t('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>');i.find("div").css({width:a}),e.find("tr").append(i)}}else e.find(".layui-table-patch").remove()};o(e.layHeader),o(e.layTotal);var r=e.layMain.height(),d=r-l;e.layFixed.find(k).css("height",i.height()>=d?d:"auto"),e.layFixRight[n>0?"removeClass":"addClass"](f),e.layFixRight.css("right",a-1)},j.prototype.events=function(){var e,i=this,a=i.config,o=t("body"),c={},s=i.layHeader.find("th"),h=".layui-table-cell",p=a.elem.attr("lay-filter");i.layTool.on("click","*[lay-event]",function(e){var o=t(this),c=o.attr("lay-event"),s=function(e){var l=t(e.list),n=t('<ul class="layui-table-tool-panel"></ul>');n.html(l),a.height&&n.css("max-height",a.height-(i.layTool.outerHeight()||50)),o.find(".layui-table-tool-panel")[0]||o.append(n),i.renderForm(),n.on("click",function(e){layui.stope(e)}),e.done&&e.done(n,l)};switch(layui.stope(e),F.trigger("table.tool.panel.remove"),l.close(i.tipsIndex),c){case"LAYTABLE_COLS":s({list:function(){var e=[];return i.eachCols(function(t,i){i.field&&"normal"==i.type&&e.push('<li><input type="checkbox" name="'+i.field+'" data-key="'+i.key+'" data-parentkey="'+(i.parentKey||"")+'" lay-skin="primary" '+(i.hide?"":"checked")+' title="'+(i.title||i.field)+'" lay-filter="LAY_TABLE_TOOL_COLS"></li>')}),e.join("")}(),done:function(){n.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var l=t(e.elem),n=this.checked,o=l.data("key"),r=l.data("parentkey");layui.each(a.cols,function(e,t){layui.each(t,function(t,l){if(e+"-"+t===o){var d=l.hide;l.hide=!n,i.elem.find('*[data-key="'+a.index+"-"+o+'"]')[n?"removeClass":"addClass"](f),d!=l.hide&&i.setParentCol(!n,r),i.resize()}})})})}});break;case"LAYTABLE_EXPORT":r.ie?l.tips("导出功能不支持 IE,请用 Chrome 等高级浏览器导出",this,{tips:3}):s({list:function(){return['<li data-type="csv">导出到 Csv 文件</li>','<li data-type="xls">导出到 Excel 文件</li>'].join("")}(),done:function(e,l){l.on("click",function(){var e=t(this).data("type");d.exportFile.call(i,a.id,null,e)})}});break;case"LAYTABLE_PRINT":var u=window.open("打印窗口","_blank"),h=["<style>","body{font-size: 12px; color: #666;}","table{width: 100%; border-collapse: collapse; border-spacing: 0;}","th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc; text-align: left; font-size: 12px; color: #666;}","a{color: #666; text-decoration:none;}","*.layui-hide{display: none}","</style>"].join(""),v=t(i.layHeader.html());v.append(i.layMain.find("table").html()),v.append(i.layTotal.find("table").html()),v.find("th.layui-table-patch").remove(),v.find(".layui-table-col-special").remove(),u.document.write(h+v.prop("outerHTML")),u.document.close(),u.print(),u.close()}layui.event.call(this,y,"toolbar("+p+")",t.extend({event:c,config:a},{}))}),s.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var l=t(this);if(c.allowResize){var n=l.data("key");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],i.getCssRule(n,function(e){var t=e.style.width||l.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=l.data("minwidth")||a.cellMinWidth})}}),F.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var a=c.ruleWidth+t.clientX-c.offset[0];a<c.minWidth&&(a=c.minWidth),c.rule.style.width=a+"px",l.close(i.tipsIndex)}e=1}}).on("mouseup",function(t){c.resizeStart&&(c={},o.css("cursor",""),i.scrollPatch()),2===e&&(e=null)}),s.on("click",function(a){var l,n=t(this),o=n.find(S),r=o.attr("lay-sort");return o[0]&&1!==e?(l="asc"===r?"desc":"desc"===r?null:"asc",void i.sort(n,l,null,!0)):e=2}).find(S+" .layui-edge ").on("click",function(e){var a=t(this),l=a.index(),n=a.parents("th").eq(0).data("field");layui.stope(e),0===l?i.sort(n,"asc",null,!0):i.sort(n,"desc",null,!0)});var v=function(e){var a=t(this),l=a.parents("tr").eq(0).data("index"),n=i.layBody.find('tr[data-index="'+l+'"]'),o=d.cache[i.key]||[];return o=o[l]||{},t.extend({tr:n,data:d.clearCacheKey(o),del:function(){d.cache[i.key][l]=[],n.remove(),i.scrollPatch()},update:function(e){e=e||{},layui.each(e,function(e,t){if(e in o){var a,l=n.children('td[data-field="'+e+'"]');o[e]=t,i.eachCols(function(t,i){i.field==e&&i.templet&&(a=i.templet)}),l.children(h).html(u({templet:a},t,o)),l.data("content",t)}})}},e)};i.elem.on("click",'input[name="layTableCheckbox"]+',function(){var e=t(this).prev(),a=i.layBody.find('input[name="layTableCheckbox"]'),l=e.parents("tr").eq(0).data("index"),n=e[0].checked,o="layTableAllChoose"===e.attr("lay-filter");o?(a.each(function(e,t){t.checked=n,i.setCheckData(e,n)}),i.syncCheckAll(),i.renderForm("checkbox")):(i.setCheckData(l,n),i.syncCheckAll()),layui.event.call(e[0],y,"checkbox("+p+")",v.call(e[0],{checked:n,type:o?"all":"one"}))}),i.elem.on("click",'input[lay-type="layTableRadio"]+',function(){var e=t(this).prev(),a=e[0].checked,l=d.cache[i.key],n=e.parents("tr").eq(0).data("index");layui.each(l,function(e,t){n===e?t.LAY_CHECKED=!0:delete t.LAY_CHECKED}),i.setThisRowChecked(n),layui.event.call(this,y,"radio("+p+")",v.call(this,{checked:a}))}),i.layBody.on("mouseenter","tr",function(){var e=t(this),a=e.index();e.data("off")||i.layBody.find("tr:eq("+a+")").addClass(_)}).on("mouseleave","tr",function(){var e=t(this),a=e.index();e.data("off")||i.layBody.find("tr:eq("+a+")").removeClass(_)}).on("click","tr",function(){m.call(this,"row")}).on("dblclick","tr",function(){m.call(this,"rowDouble")});var m=function(e){var i=t(this);i.data("off")||layui.event.call(this,y,e+"("+p+")",v.call(i.children("td")[0]))};i.layBody.on("change","."+W,function(){var e=t(this),a=this.value,l=e.parent().data("field"),n=e.parents("tr").eq(0).data("index"),o=d.cache[i.key][n];o[l]=a,layui.event.call(this,y,"edit("+p+")",v.call(this,{value:a,field:l}))}).on("blur","."+W,function(){var e,a=t(this),l=this,n=a.parent().data("field"),o=a.parents("tr").eq(0).data("index"),r=d.cache[i.key][o];i.eachCols(function(t,i){i.field==n&&i.templet&&(e=i.templet)}),a.siblings(h).html(function(t){return u({templet:e},t,r)}(l.value)),a.parent().data("content",l.value),a.remove()}),i.layBody.on("click","td",function(e){var i=t(this),a=(i.data("field"),i.data("edit")),l=i.children(h);if(!i.data("off")&&a){var n=t('<input class="layui-input '+W+'">');return n[0].value=i.data("content")||l.text(),i.find("."+W)[0]||i.append(n),n.focus(),void layui.stope(e)}}).on("mouseenter","td",function(){b.call(this)}).on("mouseleave","td",function(){b.call(this,"hide")});var g="layui-table-grid-down",b=function(e){var i=t(this),a=i.children(h);if(!i.data("off"))if(e)i.find(".layui-table-grid-down").remove();else if(a.prop("scrollWidth")>a.outerWidth()){if(a.find("."+g)[0])return;i.append('<div class="'+g+'"><i class="layui-icon layui-icon-down"></i></div>')}};i.layBody.on("click","."+g,function(e){var n=t(this),o=n.parent(),d=o.children(h);i.tipsIndex=l.tips(['<div class="layui-table-tips-main" style="margin-top: -'+(d.height()+16)+"px;"+function(){return"sm"===a.size?"padding: 4px 15px; font-size: 12px;":"lg"===a.size?"padding: 14px 15px;":""}()+'">',d.html(),"</div>",'<i class="layui-icon layui-table-tips-c layui-icon-close"></i>'].join(""),d[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:i.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}),layui.stope(e)}),i.layBody.on("click","*[lay-event]",function(){var e=t(this),a=e.parents("tr").eq(0).data("index");layui.event.call(this,y,"tool("+p+")",v.call(this,{event:e.attr("lay-event")})),i.setThisRowChecked(a)}),i.layMain.on("scroll",function(){var e=t(this),a=e.scrollLeft(),n=e.scrollTop();i.layHeader.scrollLeft(a),i.layTotal.scrollLeft(a),i.layFixed.find(k).scrollTop(n),l.close(i.tipsIndex)}),R.on("resize",function(){i.resize()})},function(){F.on("click",function(){F.trigger("table.remove.tool.panel")}),F.on("table.remove.tool.panel",function(){t(".layui-table-tool-panel").remove()})}(),d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':h+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},c.that={},c.config={},d.eachCols=function(e,i,a){var l=c.config[e]||{},n=[],o=0;a=t.extend(!0,[],a||l.cols),layui.each(a,function(e,t){layui.each(t,function(t,i){if(i.colGroup){var l=0;o++,i.CHILD_COLS=[],layui.each(a[e+1],function(e,t){t.PARENT_COL_INDEX||l>1&&l==i.colspan||(t.PARENT_COL_INDEX=o,i.CHILD_COLS.push(t),l+=parseInt(t.colspan>1?t.colspan:1))})}i.PARENT_COL_INDEX||n.push(i)})});var r=function(e){layui.each(e||n,function(e,t){return t.CHILD_COLS?r(t.CHILD_COLS):void("function"==typeof i&&i(e,t))})};r()},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},d.exportFile=function(e,t,i){var a=this;t=t||d.clearCacheKey(d.cache[e]),i=i||"csv";var l=c.config[e]||{},n={csv:"text/csv",xls:"application/vnd.ms-excel"}[i],s=document.createElement("a");return r.ie?o.error("IE_NOT_SUPPORT_EXPORTS"):(s.href="data:"+n+";charset=utf-8,\ufeff"+encodeURIComponent(function(){var i=[],l=[],n=[];return layui.each(t,function(t,a){var n=[];"object"==typeof e?(layui.each(e,function(e,a){0==t&&i.push(a||"")}),layui.each(d.clearCacheKey(a),function(e,t){n.push('"'+(t||"")+'"')})):d.eachCols(e,function(e,l){if(l.field&&"normal"==l.type&&!l.hide){var o=a[l.field];void 0!==o&&null!==o||(o=""),0==t&&i.push(l.title||""),n.push('"'+u(l,o,a,"text")+'"')}}),l.push(n.join(","))}),layui.each(a.dataTotal,function(e,t){n.push(t)}),i.join(",")+"\r\n"+l.join("\r\n")+"\r\n"+n.join(",")}()),s.download=(l.title||"table_"+(l.index||""))+"."+i,document.body.appendChild(s),s.click(),void document.body.removeChild(s))},d.resize=function(e){if(e){var t=s(e);if(!t)return;c.that[e].resize()}else layui.each(c.that,function(){this.resize()})},d.reload=function(e,t){var i=s(e);if(i){var a=c.that[e];return a.reload(t),c.call(a)}},d.render=function(e){var t=new j(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(y,d)}); |
| | | ;layui.define(["laytpl", "laypage", "layer", "form", "util"], function (e) { |
| | | "use strict"; |
| | | var t = layui.$, i = layui.laytpl, a = layui.laypage, l = layui.layer, n = layui.form, |
| | | o = (layui.util, layui.hint()), r = layui.device(), d = { |
| | | config: {checkName: "LAY_CHECKED", indexName: "LAY_TABLE_INDEX"}, |
| | | cache: {}, |
| | | index: layui.table ? layui.table.index + 1e4 : 0, |
| | | set: function (e) { |
| | | var i = this; |
| | | return i.config = t.extend({}, i.config, e), i |
| | | }, |
| | | on: function (e, t) { |
| | | return layui.onevent.call(this, y, e, t) |
| | | } |
| | | }, c = function () { |
| | | var e = this, t = e.config, i = t.id || t.index; |
| | | return i && (c.that[i] = e, c.config[i] = t), { |
| | | config: t, reload: function (t) { |
| | | e.reload.call(e, t) |
| | | }, setColsWidth: function () { |
| | | e.setColsWidth.call(e) |
| | | }, resize: function () { |
| | | e.resize.call(e) |
| | | } |
| | | } |
| | | }, s = function (e) { |
| | | var t = c.config[e]; |
| | | return t || o.error("The ID option was not found in the table instance"), t || null |
| | | }, u = function (e, a, l, n) { |
| | | var o = e.templet ? function () { |
| | | return "function" == typeof e.templet ? e.templet(l) : i(t(e.templet).html() || String(a)).render(l) |
| | | }() : a; |
| | | return n ? t("<div>" + o + "</div>").text() : o |
| | | }, y = "table", h = ".layui-table", f = "layui-hide", p = "layui-none", v = "layui-table-view", |
| | | m = ".layui-table-tool", g = ".layui-table-box", b = ".layui-table-init", x = ".layui-table-header", |
| | | k = ".layui-table-body", C = ".layui-table-main", w = ".layui-table-fixed", T = ".layui-table-fixed-l", |
| | | A = ".layui-table-fixed-r", L = ".layui-table-total", N = ".layui-table-page", S = ".layui-table-sort", |
| | | W = "layui-table-edit", _ = "layui-table-hover", E = function (e) { |
| | | var t = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}'; |
| | | return e = e || {}, ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ', '{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>', "<thead>", "{{# layui.each(d.data.cols, function(i1, item1){ }}", "<tr>", "{{# layui.each(item1, function(i2, item2){ }}", '{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}', '{{# if(item2.fixed === "right"){ right = true; } }}', function () { |
| | | return e.fixed && "right" !== e.fixed ? '{{# if(item2.fixed && item2.fixed !== "right"){ }}' : "right" === e.fixed ? '{{# if(item2.fixed === "right"){ }}' : "" |
| | | }(), "{{# var isSort = !(item2.colGroup) && item2.sort; }}", '<th data-field="{{ item2.field||i2 }}" data-key="{{d.index}}-{{i1}}-{{i2}}" {{# if( item2.parentKey){ }}data-parentkey="{{ item2.parentKey }}"{{# } }} {{# if(item2.minWidth){ }}data-minwidth="{{item2.minWidth}}"{{# } }} ' + t + ' {{# if(item2.unresize || item2.colGroup){ }}data-unresize="true"{{# } }} class="{{# if(item2.hide){ }}layui-hide{{# } }}{{# if(isSort){ }} layui-unselect{{# } }}{{# if(!item2.field){ }} layui-table-col-special{{# } }}">', '<div class="layui-table-cell laytable-cell-', "{{# if(item2.colGroup){ }}", "group", "{{# } else { }}", "{{d.index}}-{{i1}}-{{i2}}", '{{# if(item2.type !== "normal"){ }}', " laytable-cell-{{ item2.type }}", "{{# } }}", "{{# } }}", '" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>', '{{# if(item2.type === "checkbox"){ }}', '<input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}>', "{{# } else { }}", '<span>{{item2.title||""}}</span>', "{{# if(isSort){ }}", '<span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span>', "{{# } }}", "{{# } }}", "</div>", "</th>", e.fixed ? "{{# }; }}" : "", "{{# }); }}", "</tr>", "{{# }); }}", "</thead>", "</table>"].join("") |
| | | }, |
| | | z = ['<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ', '{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>', "<tbody></tbody>", "</table>"].join(""), |
| | | H = ['<div class="layui-form layui-border-box {{d.VIEW_CLASS}}" lay-filter="LAY-table-{{d.index}}" lay-id="{{ d.data.id }}" style="{{# if(d.data.width){ }}width:{{d.data.width}}px;{{# } }} {{# if(d.data.height){ }}height:{{d.data.height}}px;{{# } }}">', "{{# if(d.data.toolbar){ }}", '<div class="layui-table-tool">', '<div class="layui-table-tool-temp"></div>', '<div class="layui-table-tool-self"></div>', "</div>", "{{# } }}", '<div class="layui-table-box">', "{{# if(d.data.loading){ }}", '<div class="layui-table-init" style="background-color: #fff;">', '<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>', "</div>", "{{# } }}", "{{# var left, right; }}", '<div class="layui-table-header">', E(), "</div>", '<div class="layui-table-body layui-table-main">', z, "</div>", "{{# if(left){ }}", '<div class="layui-table-fixed layui-table-fixed-l">', '<div class="layui-table-header">', E({fixed: !0}), "</div>", '<div class="layui-table-body">', z, "</div>", "</div>", "{{# }; }}", "{{# if(right){ }}", '<div class="layui-table-fixed layui-table-fixed-r">', '<div class="layui-table-header">', E({fixed: "right"}), '<div class="layui-table-mend"></div>', "</div>", '<div class="layui-table-body">', z, "</div>", "</div>", "{{# }; }}", "</div>", "{{# if(d.data.totalRow){ }}", '<div class="layui-table-total">', '<table cellspacing="0" cellpadding="0" border="0" class="layui-table" ', '{{# if(d.data.skin){ }}lay-skin="{{d.data.skin}}"{{# } }} {{# if(d.data.size){ }}lay-size="{{d.data.size}}"{{# } }} {{# if(d.data.even){ }}lay-even{{# } }}>', '<tbody><tr><td><div class="layui-table-cell" style="visibility: hidden;">Total</div></td></tr></tbody>', "</table>", "</div>", "{{# } }}", "{{# if(d.data.page){ }}", '<div class="layui-table-page">', '<div id="layui-table-page{{d.index}}"></div>', "</div>", "{{# } }}", "<style>", "{{# layui.each(d.data.cols, function(i1, item1){", "layui.each(item1, function(i2, item2){ }}", ".laytable-cell-{{d.index}}-{{i1}}-{{i2}}{ ", "{{# if(item2.width){ }}", "width: {{item2.width}}px;", "{{# } }}", " }", "{{# });", "}); }}", "</style>", "</div>"].join(""), |
| | | R = t(window), F = t(document), j = function (e) { |
| | | var i = this; |
| | | i.index = ++d.index, i.config = t.extend({}, i.config, d.config, e), i.render() |
| | | }; |
| | | j.prototype.config = { |
| | | limit: 10, |
| | | loading: !0, |
| | | cellMinWidth: 60, |
| | | defaultToolbar: ["filter", "exports", "print"], |
| | | autoSort: !0, |
| | | text: {none: "无数据"} |
| | | }, j.prototype.render = function () { |
| | | var e = this, a = e.config; |
| | | if (a.elem = t(a.elem), a.where = a.where || {}, a.id = a.id || a.elem.attr("id") || e.index, a.request = t.extend({ |
| | | pageName: "page", |
| | | limitName: "limit" |
| | | }, a.request), a.response = t.extend({ |
| | | statusName: "code", |
| | | statusCode: 0, |
| | | msgName: "msg", |
| | | dataName: "data", |
| | | countName: "count" |
| | | }, a.response), "object" == typeof a.page && (a.limit = a.page.limit || a.limit, a.limits = a.page.limits || a.limits, e.page = a.page.curr = a.page.curr || 1, delete a.page.elem, delete a.page.jump), !a.elem[0]) return e; |
| | | a.height && /^full-\d+$/.test(a.height) && (e.fullHeightGap = a.height.split("-")[1], a.height = R.height() - e.fullHeightGap), e.setInit(); |
| | | var l = a.elem, n = l.next("." + v), o = e.elem = t(i(H).render({VIEW_CLASS: v, data: a, index: e.index})); |
| | | if (a.index = e.index, e.key = a.id || a.index, n[0] && n.remove(), l.after(o), e.layTool = o.find(m), e.layBox = o.find(g), e.layHeader = o.find(x), e.layMain = o.find(C), e.layBody = o.find(k), e.layFixed = o.find(w), e.layFixLeft = o.find(T), e.layFixRight = o.find(A), e.layTotal = o.find(L), e.layPage = o.find(N), e.renderToolbar(), e.fullSize(), a.cols.length > 1) { |
| | | var r = e.layFixed.find(x).find("th"); |
| | | r.height(e.layHeader.height() - 1 - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))) |
| | | } |
| | | e.pullData(e.page), e.events() |
| | | }, j.prototype.initOpts = function (e) { |
| | | var t = this, i = (t.config, {checkbox: 48, radio: 48, space: 15, numbers: 40}); |
| | | e.checkbox && (e.type = "checkbox"), e.space && (e.type = "space"), e.type || (e.type = "normal"), "normal" !== e.type && (e.unresize = !0, e.width = e.width || i[e.type]) |
| | | }, j.prototype.setInit = function (e) { |
| | | var t = this, i = t.config; |
| | | return i.clientWidth = i.width || function () { |
| | | var e = function (t) { |
| | | var a, l; |
| | | t = t || i.elem.parent(), a = t.width(); |
| | | try { |
| | | l = "none" === t.css("display") |
| | | } catch (n) { |
| | | } |
| | | return !t[0] || a && !l ? a : e(t.parent()) |
| | | }; |
| | | return e() |
| | | }(), "width" === e ? i.clientWidth : void layui.each(i.cols, function (e, a) { |
| | | layui.each(a, function (l, n) { |
| | | if (!n) return void a.splice(l, 1); |
| | | if (n.key = e + "-" + l, n.hide = n.hide || !1, n.colGroup || n.colspan > 1) { |
| | | var o = 0; |
| | | layui.each(i.cols[e + 1], function (t, i) { |
| | | i.HAS_PARENT || o > 1 && o == n.colspan || (i.HAS_PARENT = !0, i.parentKey = e + "-" + l, o += parseInt(i.colspan > 1 ? i.colspan : 1)) |
| | | }), n.colGroup = !0 |
| | | } |
| | | t.initOpts(n) |
| | | }) |
| | | }) |
| | | }, j.prototype.renderToolbar = function () { |
| | | var e = this, a = e.config, |
| | | l = ['<div class="layui-inline" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></div>', '<div class="layui-inline" lay-event="update"><i class="layui-icon layui-icon-edit"></i></div>', '<div class="layui-inline" lay-event="delete"><i class="layui-icon layui-icon-delete"></i></div>'].join(""), |
| | | n = e.layTool.find(".layui-table-tool-temp"); |
| | | if ("default" === a.toolbar) n.html(l); else if ("string" == typeof a.toolbar) { |
| | | var o = t(a.toolbar).html() || ""; |
| | | o && n.html(i(o).render(a)) |
| | | } |
| | | var r = { |
| | | filter: {title: "筛选列", layEvent: "LAYTABLE_COLS", icon: "layui-icon-cols"}, |
| | | exports: {title: "导出", layEvent: "LAYTABLE_EXPORT", icon: "layui-icon-export"}, |
| | | print: {title: "打印", layEvent: "LAYTABLE_PRINT", icon: "layui-icon-print"} |
| | | }, d = []; |
| | | "object" == typeof a.defaultToolbar && layui.each(a.defaultToolbar, function (e, t) { |
| | | var i = "string" == typeof t ? r[t] : t; |
| | | i && d.push('<div class="layui-inline" title="' + i.title + '" lay-event="' + i.layEvent + '"><i class="layui-icon ' + i.icon + '"></i></div>') |
| | | }), e.layTool.find(".layui-table-tool-self").html(d.join("")) |
| | | }, j.prototype.setParentCol = function (e, t) { |
| | | var i = this, a = i.config, l = i.layHeader.find('th[data-key="' + a.index + "-" + t + '"]'), |
| | | n = parseInt(l.attr("colspan")) || 0; |
| | | if (l[0]) { |
| | | var o = t.split("-"), r = a.cols[o[0]][o[1]]; |
| | | e ? n-- : n++, l.attr("colspan", n), l[n < 1 ? "addClass" : "removeClass"](f), r.colspan = n, r.hide = n < 1; |
| | | var d = l.data("parentkey"); |
| | | d && i.setParentCol(e, d) |
| | | } |
| | | }, j.prototype.setColsPatch = function () { |
| | | var e = this, t = e.config; |
| | | layui.each(t.cols, function (t, i) { |
| | | layui.each(i, function (t, i) { |
| | | i.hide && e.setParentCol(i.hide, i.parentKey) |
| | | }) |
| | | }) |
| | | }, j.prototype.setColsWidth = function () { |
| | | var e = this, t = e.config, i = 0, a = 0, l = 0, n = 0, o = e.setInit("width"); |
| | | e.eachCols(function (e, t) { |
| | | t.hide || i++ |
| | | }), o = o - function () { |
| | | return "line" === t.skin || "nob" === t.skin ? 2 : i + 1 |
| | | }() - e.getScrollWidth(e.layMain[0]) - 1; |
| | | var r = function (e) { |
| | | layui.each(t.cols, function (i, r) { |
| | | layui.each(r, function (i, d) { |
| | | var c = 0, s = d.minWidth || t.cellMinWidth; |
| | | return d ? void (d.colGroup || d.hide || (e ? l && l < s && (a--, c = s) : (c = d.width || 0, /\d+%$/.test(c) ? (c = Math.floor(parseFloat(c) / 100 * o), c < s && (c = s)) : c || (d.width = c = 0, a++)), d.hide && (c = 0), n += c)) : void r.splice(i, 1) |
| | | }) |
| | | }), o > n && a && (l = (o - n) / a) |
| | | }; |
| | | r(), r(!0), e.autoColNums = a, e.eachCols(function (i, a) { |
| | | var n = a.minWidth || t.cellMinWidth; |
| | | a.colGroup || a.hide || (0 === a.width ? e.getCssRule(t.index + "-" + a.key, function (e) { |
| | | e.style.width = Math.floor(l >= n ? l : n) + "px" |
| | | }) : /\d+%$/.test(a.width) && e.getCssRule(t.index + "-" + a.key, function (e) { |
| | | e.style.width = Math.floor(parseFloat(a.width) / 100 * o) + "px" |
| | | })) |
| | | }); |
| | | var d = e.layMain.width() - e.getScrollWidth(e.layMain[0]) - e.layMain.children("table").outerWidth(); |
| | | if (e.autoColNums && d >= -i && d <= i) { |
| | | var c = function (t) { |
| | | var i; |
| | | return t = t || e.layHeader.eq(0).find("thead th:last-child"), i = t.data("field"), !i && t.prev()[0] ? c(t.prev()) : t |
| | | }, s = c(), u = s.data("key"); |
| | | e.getCssRule(u, function (t) { |
| | | var i = t.style.width || s.outerWidth(); |
| | | t.style.width = parseFloat(i) + d + "px", e.layMain.height() - e.layMain.prop("clientHeight") > 0 && (t.style.width = parseFloat(t.style.width) - 1 + "px") |
| | | }) |
| | | } |
| | | e.loading(!0) |
| | | }, j.prototype.resize = function () { |
| | | var e = this; |
| | | e.fullSize(), e.setColsWidth(), e.scrollPatch() |
| | | }, j.prototype.reload = function (e) { |
| | | var i = this; |
| | | e = e || {}, delete i.haveInit, e.data && e.data.constructor === Array && delete i.config.data, i.config = t.extend(!0, {}, i.config, e), i.render() |
| | | }, j.prototype.errorView = function (e) { |
| | | var i = this, a = i.layMain.find("." + p), l = t('<div class="' + p + '">' + (e || "Error") + "</div>"); |
| | | a[0] && (i.layNone.remove(), a.remove()), i.layFixed.addClass(f), i.layMain.find("tbody").html(""), i.layMain.append(i.layNone = l), d.cache[i.key] = [] |
| | | }, j.prototype.page = 1, j.prototype.pullData = function (e) { |
| | | var i = this, a = i.config, l = a.request, n = a.response, o = function () { |
| | | "object" == typeof a.initSort && i.sort(a.initSort.field, a.initSort.type) |
| | | }; |
| | | if (i.startTime = (new Date).getTime(), a.url) { |
| | | var r = {}; |
| | | r[l.pageName] = e, r[l.limitName] = a.limit; |
| | | var d = t.extend(r, a.where); |
| | | a.contentType && 0 == a.contentType.indexOf("application/json") && (d = JSON.stringify(d)), i.loading(), t.ajax({ |
| | | type: a.method || "get", |
| | | url: a.url, |
| | | contentType: a.contentType, |
| | | data: d, |
| | | dataType: "json", |
| | | headers: a.headers || {}, |
| | | success: function (t) { |
| | | "function" == typeof a.parseData && (t = a.parseData(t) || t), t[n.statusName] != n.statusCode ? (i.renderForm(), i.errorView(t[n.msgName] || '返回的数据不符合规范,正确的成功状态码应为:"' + n.statusName + '": ' + n.statusCode)) : (i.renderData(t, e, t[n.countName]), o(), a.time = (new Date).getTime() - i.startTime + " ms"), i.setColsWidth(), "function" == typeof a.done && a.done(t, e, t[n.countName]) |
| | | }, |
| | | error: function (e, t) { |
| | | i.errorView("数据接口请求异常:" + t), i.renderForm(), i.setColsWidth() |
| | | } |
| | | }) |
| | | } else if (a.data && a.data.constructor === Array) { |
| | | var c = {}, s = e * a.limit - a.limit; |
| | | c[n.dataName] = a.data.concat().splice(s, a.limit), c[n.countName] = a.data.length, i.renderData(c, e, c[n.countName]), o(), i.setColsWidth(), "function" == typeof a.done && a.done(c, e, c[n.countName]) |
| | | } |
| | | }, j.prototype.eachCols = function (e) { |
| | | var t = this; |
| | | return d.eachCols(null, e, t.config.cols), t |
| | | }, j.prototype.renderData = function (e, n, o, r) { |
| | | var c = this, s = c.config, y = e[s.response.dataName] || [], h = [], v = [], m = [], g = function () { |
| | | var e; |
| | | return !r && c.sortKey ? c.sort(c.sortKey.field, c.sortKey.sort, !0) : (layui.each(y, function (a, l) { |
| | | var o = [], y = [], p = [], g = a + s.limit * (n - 1) + 1; |
| | | 0 !== l.length && (r || (l[d.config.indexName] = a), c.eachCols(function (n, r) { |
| | | var c = r.field || n, h = s.index + "-" + r.key, v = l[c]; |
| | | if (void 0 !== v && null !== v || (v = ""), !r.colGroup) { |
| | | var m = ['<td data-field="' + c + '" data-key="' + h + '" ' + function () { |
| | | var e = []; |
| | | return r.edit && e.push('data-edit="' + r.edit + '"'), r.align && e.push('align="' + r.align + '"'), r.templet && e.push('data-content="' + v + '"'), r.toolbar && e.push('data-off="true"'), r.event && e.push('lay-event="' + r.event + '"'), r.style && e.push('style="' + r.style + '"'), r.minWidth && e.push('data-minwidth="' + r.minWidth + '"'), e.join(" ") |
| | | }() + ' class="' + function () { |
| | | var e = []; |
| | | return r.hide && e.push(f), r.field || e.push("layui-table-col-special"), e.join(" ") |
| | | }() + '">', '<div class="layui-table-cell laytable-cell-' + function () { |
| | | return "normal" === r.type ? h : h + " laytable-cell-" + r.type |
| | | }() + '">' + function () { |
| | | var n = t.extend(!0, {LAY_INDEX: g}, l), o = d.config.checkName; |
| | | switch (r.type) { |
| | | case"checkbox": |
| | | return '<input type="checkbox" name="layTableCheckbox" lay-skin="primary" ' + function () { |
| | | return r[o] ? (l[o] = r[o], r[o] ? "checked" : "") : n[o] ? "checked" : "" |
| | | }() + ">"; |
| | | case"radio": |
| | | return n[o] && (e = a), '<input type="radio" name="layTableRadio_' + s.index + '" ' + (n[o] ? "checked" : "") + ' lay-type="layTableRadio">'; |
| | | case"numbers": |
| | | return g |
| | | } |
| | | return r.toolbar ? i(t(r.toolbar).html() || "").render(n) : u(r, v, n) |
| | | }(), "</div></td>"].join(""); |
| | | o.push(m), r.fixed && "right" !== r.fixed && y.push(m), "right" === r.fixed && p.push(m) |
| | | } |
| | | }), h.push('<tr data-index="' + a + '">' + o.join("") + "</tr>"), v.push('<tr data-index="' + a + '">' + y.join("") + "</tr>"), m.push('<tr data-index="' + a + '">' + p.join("") + "</tr>")) |
| | | }), c.layBody.scrollTop(0), c.layMain.find("." + p).remove(), c.layMain.find("tbody").html(h.join("")), c.layFixLeft.find("tbody").html(v.join("")), c.layFixRight.find("tbody").html(m.join("")), c.renderForm(), "number" == typeof e && c.setThisRowChecked(e), c.syncCheckAll(), c.haveInit ? c.scrollPatch() : setTimeout(function () { |
| | | c.scrollPatch() |
| | | }, 50), c.haveInit = !0, l.close(c.tipsIndex), s.HAS_SET_COLS_PATCH || c.setColsPatch(), void (s.HAS_SET_COLS_PATCH = !0)) |
| | | }; |
| | | return d.cache[c.key] = y, c.layPage[0 == o || 0 === y.length && 1 == n ? "addClass" : "removeClass"](f), r ? g() : 0 === y.length ? (c.renderForm(), c.errorView(s.text.none)) : (c.layFixed.removeClass(f), g(), c.renderTotal(y), void (s.page && (s.page = t.extend({ |
| | | elem: "layui-table-page" + s.index, |
| | | count: o, |
| | | limit: s.limit, |
| | | limits: s.limits || [10, 20, 30, 40, 50, 60, 70, 80, 90], |
| | | groups: 3, |
| | | layout: ["prev", "page", "next", "skip", "count", "limit"], |
| | | prev: '<i class="layui-icon"></i>', |
| | | next: '<i class="layui-icon"></i>', |
| | | jump: function (e, t) { |
| | | t || (c.page = e.curr, s.limit = e.limit, c.pullData(e.curr)) |
| | | } |
| | | }, s.page), s.page.count = o, a.render(s.page)))) |
| | | }, j.prototype.renderTotal = function (e) { |
| | | var t = this, i = t.config, a = {}; |
| | | if (i.totalRow) { |
| | | layui.each(e, function (e, i) { |
| | | 0 !== i.length && t.eachCols(function (e, t) { |
| | | var l = t.field || e, n = i[l]; |
| | | t.totalRow && (a[l] = (a[l] || 0) + (parseFloat(n) || 0)) |
| | | }) |
| | | }), t.dataTotal = {}; |
| | | var l = []; |
| | | t.eachCols(function (e, n) { |
| | | var o = n.field || e, r = function () { |
| | | var e = n.totalRowText || "", t = parseFloat(a[o]).toFixed(2), i = {}; |
| | | return i[o] = t, t = u(n, t, i), n.totalRow ? t || e : e |
| | | }(), d = ['<td data-field="' + o + '" data-key="' + i.index + "-" + n.key + '" ' + function () { |
| | | var e = []; |
| | | return n.align && e.push('align="' + n.align + '"'), n.style && e.push('style="' + n.style + '"'), n.minWidth && e.push('data-minwidth="' + n.minWidth + '"'), e.join(" ") |
| | | }() + ' class="' + function () { |
| | | var e = []; |
| | | return n.hide && e.push(f), n.field || e.push("layui-table-col-special"), e.join(" ") |
| | | }() + '">', '<div class="layui-table-cell laytable-cell-' + function () { |
| | | var e = i.index + "-" + n.key; |
| | | return "normal" === n.type ? e : e + " laytable-cell-" + n.type |
| | | }() + '">' + r, "</div></td>"].join(""); |
| | | n.field && (t.dataTotal[o] = r), l.push(d) |
| | | }), t.layTotal.find("tbody").html("<tr>" + l.join("") + "</tr>") |
| | | } |
| | | }, j.prototype.getColElem = function (e, t) { |
| | | var i = this, a = i.config; |
| | | return e.eq(0).find(".laytable-cell-" + (a.index + "-" + t) + ":eq(0)") |
| | | }, j.prototype.renderForm = function (e) { |
| | | n.render(e, "LAY-table-" + this.index) |
| | | }, j.prototype.setThisRowChecked = function (e) { |
| | | var t = this, i = (t.config, "layui-table-click"), a = t.layBody.find('tr[data-index="' + e + '"]'); |
| | | a.addClass(i).siblings("tr").removeClass(i) |
| | | }, j.prototype.sort = function (e, i, a, l) { |
| | | var n, r, c = this, s = {}, u = c.config, h = u.elem.attr("lay-filter"), f = d.cache[c.key]; |
| | | "string" == typeof e && c.layHeader.find("th").each(function (i, a) { |
| | | var l = t(this), o = l.data("field"); |
| | | if (o === e) return e = l, n = o, !1 |
| | | }); |
| | | try { |
| | | var n = n || e.data("field"), p = e.data("key"); |
| | | if (c.sortKey && !a && n === c.sortKey.field && i === c.sortKey.sort) return; |
| | | var v = c.layHeader.find("th .laytable-cell-" + p).find(S); |
| | | c.layHeader.find("th").find(S).removeAttr("lay-sort"), v.attr("lay-sort", i || null), c.layFixed.find("th") |
| | | } catch (m) { |
| | | return o.error("Table modules: Did not match to field") |
| | | } |
| | | c.sortKey = { |
| | | field: n, |
| | | sort: i |
| | | }, u.autoSort && ("asc" === i ? r = layui.sort(f, n) : "desc" === i ? r = layui.sort(f, n, !0) : (r = layui.sort(f, d.config.indexName), delete c.sortKey)), s[u.response.dataName] = r || f, c.renderData(s, c.page, c.count, !0), l && layui.event.call(e, y, "sort(" + h + ")", { |
| | | field: n, |
| | | type: i |
| | | }) |
| | | }, j.prototype.loading = function (e) { |
| | | var i = this, a = i.config; |
| | | a.loading && (e ? (i.layInit && i.layInit.remove(), delete i.layInit, i.layBox.find(b).remove()) : (i.layInit = t(['<div class="layui-table-init">', '<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>', "</div>"].join("")), i.layBox.append(i.layInit))) |
| | | }, j.prototype.setCheckData = function (e, t) { |
| | | var i = this, a = i.config, l = d.cache[i.key]; |
| | | l[e] && l[e].constructor !== Array && (l[e][a.checkName] = t) |
| | | }, j.prototype.syncCheckAll = function () { |
| | | var e = this, t = e.config, i = e.layHeader.find('input[name="layTableCheckbox"]'), a = function (i) { |
| | | return e.eachCols(function (e, a) { |
| | | "checkbox" === a.type && (a[t.checkName] = i) |
| | | }), i |
| | | }; |
| | | i[0] && (d.checkStatus(e.key).isAll ? (i[0].checked || (i.prop("checked", !0), e.renderForm("checkbox")), a(!0)) : (i[0].checked && (i.prop("checked", !1), e.renderForm("checkbox")), a(!1))) |
| | | }, j.prototype.getCssRule = function (e, t) { |
| | | var i = this, a = i.elem.find("style")[0], l = a.sheet || a.styleSheet || {}, n = l.cssRules || l.rules; |
| | | layui.each(n, function (i, a) { |
| | | if (a.selectorText === ".laytable-cell-" + e) return t(a), !0 |
| | | }) |
| | | }, j.prototype.fullSize = function () { |
| | | var e, t = this, i = t.config, a = i.height; |
| | | t.fullHeightGap && (a = R.height() - t.fullHeightGap, a < 135 && (a = 135), t.elem.css("height", a)), a && (e = parseFloat(a) - (t.layHeader.outerHeight() || 38), i.toolbar && (e -= t.layTool.outerHeight() || 50), i.totalRow && (e -= t.layTotal.outerHeight() || 40), i.page && (e -= t.layPage.outerHeight() || 41), t.layMain.css("height", e - 2)) |
| | | }, j.prototype.getScrollWidth = function (e) { |
| | | var t = 0; |
| | | return e ? t = e.offsetWidth - e.clientWidth : (e = document.createElement("div"), e.style.width = "100px", e.style.height = "100px", e.style.overflowY = "scroll", document.body.appendChild(e), t = e.offsetWidth - e.clientWidth, document.body.removeChild(e)), t |
| | | }, j.prototype.scrollPatch = function () { |
| | | var e = this, i = e.layMain.children("table"), a = e.layMain.width() - e.layMain.prop("clientWidth"), |
| | | l = e.layMain.height() - e.layMain.prop("clientHeight"), |
| | | n = (e.getScrollWidth(e.layMain[0]), i.outerWidth() - e.layMain.width()), o = function (e) { |
| | | if (a && l) { |
| | | if (e = e.eq(0), !e.find(".layui-table-patch")[0]) { |
| | | var i = t('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>'); |
| | | i.find("div").css({width: a}), e.find("tr").append(i) |
| | | } |
| | | } else e.find(".layui-table-patch").remove() |
| | | }; |
| | | o(e.layHeader), o(e.layTotal); |
| | | var r = e.layMain.height(), d = r - l; |
| | | e.layFixed.find(k).css("height", i.height() >= d ? d : "auto"), e.layFixRight[n > 0 ? "removeClass" : "addClass"](f), e.layFixRight.css("right", a - 1) |
| | | }, j.prototype.events = function () { |
| | | var e, i = this, a = i.config, o = t("body"), c = {}, s = i.layHeader.find("th"), h = ".layui-table-cell", |
| | | p = a.elem.attr("lay-filter"); |
| | | i.layTool.on("click", "*[lay-event]", function (e) { |
| | | var o = t(this), c = o.attr("lay-event"), s = function (e) { |
| | | var l = t(e.list), n = t('<ul class="layui-table-tool-panel"></ul>'); |
| | | n.html(l), a.height && n.css("max-height", a.height - (i.layTool.outerHeight() || 50)), o.find(".layui-table-tool-panel")[0] || o.append(n), i.renderForm(), n.on("click", function (e) { |
| | | layui.stope(e) |
| | | }), e.done && e.done(n, l) |
| | | }; |
| | | switch (layui.stope(e), F.trigger("table.tool.panel.remove"), l.close(i.tipsIndex), c) { |
| | | case"LAYTABLE_COLS": |
| | | s({ |
| | | list: function () { |
| | | var e = []; |
| | | return i.eachCols(function (t, i) { |
| | | i.field && "normal" == i.type && e.push('<li><input type="checkbox" name="' + i.field + '" data-key="' + i.key + '" data-parentkey="' + (i.parentKey || "") + '" lay-skin="primary" ' + (i.hide ? "" : "checked") + ' title="' + (i.title || i.field) + '" lay-filter="LAY_TABLE_TOOL_COLS"></li>') |
| | | }), e.join("") |
| | | }(), done: function () { |
| | | n.on("checkbox(LAY_TABLE_TOOL_COLS)", function (e) { |
| | | var l = t(e.elem), n = this.checked, o = l.data("key"), r = l.data("parentkey"); |
| | | layui.each(a.cols, function (e, t) { |
| | | layui.each(t, function (t, l) { |
| | | if (e + "-" + t === o) { |
| | | var d = l.hide; |
| | | l.hide = !n, i.elem.find('*[data-key="' + a.index + "-" + o + '"]')[n ? "removeClass" : "addClass"](f), d != l.hide && i.setParentCol(!n, r), i.resize() |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | }); |
| | | break; |
| | | case"LAYTABLE_EXPORT": |
| | | r.ie ? l.tips("导出功能不支持 IE,请用 Chrome 等高级浏览器导出", this, {tips: 3}) : s({ |
| | | list: function () { |
| | | return ['<li data-type="csv">导出到 Csv 文件</li>', '<li data-type="xls">导出到 Excel 文件</li>'].join("") |
| | | }(), done: function (e, l) { |
| | | l.on("click", function () { |
| | | var e = t(this).data("type"); |
| | | d.exportFile.call(i, a.id, null, e) |
| | | }) |
| | | } |
| | | }); |
| | | break; |
| | | case"LAYTABLE_PRINT": |
| | | var u = window.open("打印窗口", "_blank"), |
| | | h = ["<style>", "body{font-size: 12px; color: #666;}", "table{width: 100%; border-collapse: collapse; border-spacing: 0;}", "th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc; text-align: left; font-size: 12px; color: #666;}", "a{color: #666; text-decoration:none;}", "*.layui-hide{display: none}", "</style>"].join(""), |
| | | v = t(i.layHeader.html()); |
| | | v.append(i.layMain.find("table").html()), v.append(i.layTotal.find("table").html()), v.find("th.layui-table-patch").remove(), v.find(".layui-table-col-special").remove(), u.document.write(h + v.prop("outerHTML")), u.document.close(), u.print(), u.close() |
| | | } |
| | | layui.event.call(this, y, "toolbar(" + p + ")", t.extend({event: c, config: a}, {})) |
| | | }), s.on("mousemove", function (e) { |
| | | var i = t(this), a = i.offset().left, l = e.clientX - a; |
| | | i.data("unresize") || c.resizeStart || (c.allowResize = i.width() - l <= 10, o.css("cursor", c.allowResize ? "col-resize" : "")) |
| | | }).on("mouseleave", function () { |
| | | t(this); |
| | | c.resizeStart || o.css("cursor", "") |
| | | }).on("mousedown", function (e) { |
| | | var l = t(this); |
| | | if (c.allowResize) { |
| | | var n = l.data("key"); |
| | | e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], i.getCssRule(n, function (e) { |
| | | var t = e.style.width || l.outerWidth(); |
| | | c.rule = e, c.ruleWidth = parseFloat(t), c.minWidth = l.data("minwidth") || a.cellMinWidth |
| | | }) |
| | | } |
| | | }), F.on("mousemove", function (t) { |
| | | if (c.resizeStart) { |
| | | if (t.preventDefault(), c.rule) { |
| | | var a = c.ruleWidth + t.clientX - c.offset[0]; |
| | | a < c.minWidth && (a = c.minWidth), c.rule.style.width = a + "px", l.close(i.tipsIndex) |
| | | } |
| | | e = 1 |
| | | } |
| | | }).on("mouseup", function (t) { |
| | | c.resizeStart && (c = {}, o.css("cursor", ""), i.scrollPatch()), 2 === e && (e = null) |
| | | }), s.on("click", function (a) { |
| | | var l, n = t(this), o = n.find(S), r = o.attr("lay-sort"); |
| | | return o[0] && 1 !== e ? (l = "asc" === r ? "desc" : "desc" === r ? null : "asc", void i.sort(n, l, null, !0)) : e = 2 |
| | | }).find(S + " .layui-edge ").on("click", function (e) { |
| | | var a = t(this), l = a.index(), n = a.parents("th").eq(0).data("field"); |
| | | layui.stope(e), 0 === l ? i.sort(n, "asc", null, !0) : i.sort(n, "desc", null, !0) |
| | | }); |
| | | var v = function (e) { |
| | | var a = t(this), l = a.parents("tr").eq(0).data("index"), n = i.layBody.find('tr[data-index="' + l + '"]'), |
| | | o = d.cache[i.key] || []; |
| | | return o = o[l] || {}, t.extend({ |
| | | tr: n, data: d.clearCacheKey(o), del: function () { |
| | | d.cache[i.key][l] = [], n.remove(), i.scrollPatch() |
| | | }, update: function (e) { |
| | | e = e || {}, layui.each(e, function (e, t) { |
| | | if (e in o) { |
| | | var a, l = n.children('td[data-field="' + e + '"]'); |
| | | o[e] = t, i.eachCols(function (t, i) { |
| | | i.field == e && i.templet && (a = i.templet) |
| | | }), l.children(h).html(u({templet: a}, t, o)), l.data("content", t) |
| | | } |
| | | }) |
| | | } |
| | | }, e) |
| | | }; |
| | | i.elem.on("click", 'input[name="layTableCheckbox"]+', function () { |
| | | var e = t(this).prev(), a = i.layBody.find('input[name="layTableCheckbox"]'), |
| | | l = e.parents("tr").eq(0).data("index"), n = e[0].checked, |
| | | o = "layTableAllChoose" === e.attr("lay-filter"); |
| | | o ? (a.each(function (e, t) { |
| | | t.checked = n, i.setCheckData(e, n) |
| | | }), i.syncCheckAll(), i.renderForm("checkbox")) : (i.setCheckData(l, n), i.syncCheckAll()), layui.event.call(e[0], y, "checkbox(" + p + ")", v.call(e[0], { |
| | | checked: n, |
| | | type: o ? "all" : "one" |
| | | })) |
| | | }), i.elem.on("click", 'input[lay-type="layTableRadio"]+', function () { |
| | | var e = t(this).prev(), a = e[0].checked, l = d.cache[i.key], n = e.parents("tr").eq(0).data("index"); |
| | | layui.each(l, function (e, t) { |
| | | n === e ? t.LAY_CHECKED = !0 : delete t.LAY_CHECKED |
| | | }), i.setThisRowChecked(n), layui.event.call(this, y, "radio(" + p + ")", v.call(this, {checked: a})) |
| | | }), i.layBody.on("mouseenter", "tr", function () { |
| | | var e = t(this), a = e.index(); |
| | | e.data("off") || i.layBody.find("tr:eq(" + a + ")").addClass(_) |
| | | }).on("mouseleave", "tr", function () { |
| | | var e = t(this), a = e.index(); |
| | | e.data("off") || i.layBody.find("tr:eq(" + a + ")").removeClass(_) |
| | | }).on("click", "tr", function () { |
| | | m.call(this, "row") |
| | | }).on("dblclick", "tr", function () { |
| | | m.call(this, "rowDouble") |
| | | }); |
| | | var m = function (e) { |
| | | var i = t(this); |
| | | i.data("off") || layui.event.call(this, y, e + "(" + p + ")", v.call(i.children("td")[0])) |
| | | }; |
| | | i.layBody.on("change", "." + W, function () { |
| | | var e = t(this), a = this.value, l = e.parent().data("field"), n = e.parents("tr").eq(0).data("index"), |
| | | o = d.cache[i.key][n]; |
| | | o[l] = a, layui.event.call(this, y, "edit(" + p + ")", v.call(this, {value: a, field: l})) |
| | | }).on("blur", "." + W, function () { |
| | | var e, a = t(this), l = this, n = a.parent().data("field"), o = a.parents("tr").eq(0).data("index"), |
| | | r = d.cache[i.key][o]; |
| | | i.eachCols(function (t, i) { |
| | | i.field == n && i.templet && (e = i.templet) |
| | | }), a.siblings(h).html(function (t) { |
| | | return u({templet: e}, t, r) |
| | | }(l.value)), a.parent().data("content", l.value), a.remove() |
| | | }), i.layBody.on("click", "td", function (e) { |
| | | var i = t(this), a = (i.data("field"), i.data("edit")), l = i.children(h); |
| | | if (!i.data("off") && a) { |
| | | var n = t('<input class="layui-input ' + W + '">'); |
| | | return n[0].value = i.data("content") || l.text(), i.find("." + W)[0] || i.append(n), n.focus(), void layui.stope(e) |
| | | } |
| | | }).on("mouseenter", "td", function () { |
| | | b.call(this) |
| | | }).on("mouseleave", "td", function () { |
| | | b.call(this, "hide") |
| | | }); |
| | | var g = "layui-table-grid-down", b = function (e) { |
| | | var i = t(this), a = i.children(h); |
| | | if (!i.data("off")) if (e) i.find(".layui-table-grid-down").remove(); else if (a.prop("scrollWidth") > a.outerWidth()) { |
| | | if (a.find("." + g)[0]) return; |
| | | i.append('<div class="' + g + '"><i class="layui-icon layui-icon-down"></i></div>') |
| | | } |
| | | }; |
| | | i.layBody.on("click", "." + g, function (e) { |
| | | var n = t(this), o = n.parent(), d = o.children(h); |
| | | i.tipsIndex = l.tips(['<div class="layui-table-tips-main" style="margin-top: -' + (d.height() + 16) + "px;" + function () { |
| | | return "sm" === a.size ? "padding: 4px 15px; font-size: 12px;" : "lg" === a.size ? "padding: 14px 15px;" : "" |
| | | }() + '">', d.html(), "</div>", '<i class="layui-icon layui-table-tips-c layui-icon-close"></i>'].join(""), d[0], { |
| | | tips: [3, ""], |
| | | time: -1, |
| | | anim: -1, |
| | | maxWidth: r.ios || r.android ? 300 : i.elem.width() / 2, |
| | | isOutAnim: !1, |
| | | skin: "layui-table-tips", |
| | | success: function (e, t) { |
| | | e.find(".layui-table-tips-c").on("click", function () { |
| | | l.close(t) |
| | | }) |
| | | } |
| | | }), layui.stope(e) |
| | | }), i.layBody.on("click", "*[lay-event]", function () { |
| | | var e = t(this), a = e.parents("tr").eq(0).data("index"); |
| | | layui.event.call(this, y, "tool(" + p + ")", v.call(this, {event: e.attr("lay-event")})), i.setThisRowChecked(a) |
| | | }), i.layMain.on("scroll", function () { |
| | | var e = t(this), a = e.scrollLeft(), n = e.scrollTop(); |
| | | i.layHeader.scrollLeft(a), i.layTotal.scrollLeft(a), i.layFixed.find(k).scrollTop(n), l.close(i.tipsIndex) |
| | | }), R.on("resize", function () { |
| | | i.resize() |
| | | }) |
| | | }, function () { |
| | | F.on("click", function () { |
| | | F.trigger("table.remove.tool.panel") |
| | | }), F.on("table.remove.tool.panel", function () { |
| | | t(".layui-table-tool-panel").remove() |
| | | }) |
| | | }(), d.init = function (e, i) { |
| | | i = i || {}; |
| | | var a = this, l = t(e ? 'table[lay-filter="' + e + '"]' : h + "[lay-data]"), |
| | | n = "Table element property lay-data configuration item has a syntax error: "; |
| | | return l.each(function () { |
| | | var a = t(this), l = a.attr("lay-data"); |
| | | try { |
| | | l = new Function("return " + l)() |
| | | } catch (r) { |
| | | o.error(n + l) |
| | | } |
| | | var c = [], s = t.extend({ |
| | | elem: this, |
| | | cols: [], |
| | | data: [], |
| | | skin: a.attr("lay-skin"), |
| | | size: a.attr("lay-size"), |
| | | even: "string" == typeof a.attr("lay-even") |
| | | }, d.config, i, l); |
| | | e && a.hide(), a.find("thead>tr").each(function (e) { |
| | | s.cols[e] = [], t(this).children().each(function (i) { |
| | | var a = t(this), l = a.attr("lay-data"); |
| | | try { |
| | | l = new Function("return " + l)() |
| | | } catch (r) { |
| | | return o.error(n + l) |
| | | } |
| | | var d = t.extend({ |
| | | title: a.text(), |
| | | colspan: a.attr("colspan") || 0, |
| | | rowspan: a.attr("rowspan") || 0 |
| | | }, l); |
| | | d.colspan < 2 && c.push(d), s.cols[e].push(d) |
| | | }) |
| | | }), a.find("tbody>tr").each(function (e) { |
| | | var i = t(this), a = {}; |
| | | i.children("td").each(function (e, i) { |
| | | var l = t(this), n = l.data("field"); |
| | | if (n) return a[n] = l.html() |
| | | }), layui.each(c, function (e, t) { |
| | | var l = i.children("td").eq(e); |
| | | a[t.field] = l.html() |
| | | }), s.data[e] = a |
| | | }), d.render(s) |
| | | }), a |
| | | }, c.that = {}, c.config = {}, d.eachCols = function (e, i, a) { |
| | | var l = c.config[e] || {}, n = [], o = 0; |
| | | a = t.extend(!0, [], a || l.cols), layui.each(a, function (e, t) { |
| | | layui.each(t, function (t, i) { |
| | | if (i.colGroup) { |
| | | var l = 0; |
| | | o++, i.CHILD_COLS = [], layui.each(a[e + 1], function (e, t) { |
| | | t.PARENT_COL_INDEX || l > 1 && l == i.colspan || (t.PARENT_COL_INDEX = o, i.CHILD_COLS.push(t), l += parseInt(t.colspan > 1 ? t.colspan : 1)) |
| | | }) |
| | | } |
| | | i.PARENT_COL_INDEX || n.push(i) |
| | | }) |
| | | }); |
| | | var r = function (e) { |
| | | layui.each(e || n, function (e, t) { |
| | | return t.CHILD_COLS ? r(t.CHILD_COLS) : void ("function" == typeof i && i(e, t)) |
| | | }) |
| | | }; |
| | | r() |
| | | }, d.checkStatus = function (e) { |
| | | var t = 0, i = 0, a = [], l = d.cache[e] || []; |
| | | return layui.each(l, function (e, l) { |
| | | return l.constructor === Array ? void i++ : void (l[d.config.checkName] && (t++, a.push(d.clearCacheKey(l)))) |
| | | }), {data: a, isAll: !!l.length && t === l.length - i} |
| | | }, d.exportFile = function (e, t, i) { |
| | | var a = this; |
| | | t = t || d.clearCacheKey(d.cache[e]), i = i || "csv"; |
| | | var l = c.config[e] || {}, n = {csv: "text/csv", xls: "application/vnd.ms-excel"}[i], |
| | | s = document.createElement("a"); |
| | | return r.ie ? o.error("IE_NOT_SUPPORT_EXPORTS") : (s.href = "data:" + n + ";charset=utf-8,\ufeff" + encodeURIComponent(function () { |
| | | var i = [], l = [], n = []; |
| | | return layui.each(t, function (t, a) { |
| | | var n = []; |
| | | "object" == typeof e ? (layui.each(e, function (e, a) { |
| | | 0 == t && i.push(a || "") |
| | | }), layui.each(d.clearCacheKey(a), function (e, t) { |
| | | n.push('"' + (t || "") + '"') |
| | | })) : d.eachCols(e, function (e, l) { |
| | | if (l.field && "normal" == l.type && !l.hide) { |
| | | var o = a[l.field]; |
| | | void 0 !== o && null !== o || (o = ""), 0 == t && i.push(l.title || ""), n.push('"' + u(l, o, a, "text") + '"') |
| | | } |
| | | }), l.push(n.join(",")) |
| | | }), layui.each(a.dataTotal, function (e, t) { |
| | | n.push(t) |
| | | }), i.join(",") + "\r\n" + l.join("\r\n") + "\r\n" + n.join(",") |
| | | }()), s.download = (l.title || "table_" + (l.index || "")) + "." + i, document.body.appendChild(s), s.click(), void document.body.removeChild(s)) |
| | | }, d.resize = function (e) { |
| | | if (e) { |
| | | var t = s(e); |
| | | if (!t) return; |
| | | c.that[e].resize() |
| | | } else layui.each(c.that, function () { |
| | | this.resize() |
| | | }) |
| | | }, d.reload = function (e, t) { |
| | | var i = s(e); |
| | | if (i) { |
| | | var a = c.that[e]; |
| | | return a.reload(t), c.call(a) |
| | | } |
| | | }, d.render = function (e) { |
| | | var t = new j(e); |
| | | return c.call(t) |
| | | }, d.clearCacheKey = function (e) { |
| | | return e = t.extend({}, e), delete e[d.config.checkName], delete e[d.config.indexName], e |
| | | }, d.init(), e(y, d) |
| | | }); |
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 type="text/javascript" src="../../js/http.js" 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"> |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="name" class="layui-form-label"> |
| | | <span class="x-red">*</span>供应商名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="name" name="name" required="" lay-verify="name" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="loginName" class="layui-form-label"> |
| | | <span class="x-red">*</span>登录名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="loginName" name="loginName" required="" lay-verify="loginName" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="password" class="layui-form-label"> |
| | | 密码</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="password" name="password" required="" lay-verify="password" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="linkman" class="layui-form-label"> |
| | | 联系人</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="linkman" name="linkman" required="" lay-verify="linkman" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="phone" class="layui-form-label"> |
| | | 联系电话</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="phone" name="phone" lay-verify="phone" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="mail" class="layui-form-label"> |
| | | 联系邮箱</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="mail" name="mail" required="" lay-verify="mail" |
| | | 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>layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | | // if (value.length < 3) { |
| | | // return '应用名称至少得3个字符啊'; |
| | | // } |
| | | // }, |
| | | // appcode: [/^([A-Za-z0-9]|\-|_)+$/, '应用标识只能包含 数字、英文字符、_ 、-'], |
| | | // desc: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '简介最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // remarks: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '备注最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // |
| | | // }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/lijin/provider/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; |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/vue.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../js/xadmin.js"></script> |
| | | <script type="text/javascript" src="../../js/http.js" 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]--> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-view .layui-table th{ |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </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"> |
| | | <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" id="searchForm"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start" |
| | | :value="start"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end" |
| | | :value="end"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="appname" placeholder="请输入应用名称" :value="key" autocomplete="off" |
| | | class="layui-input"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="sreach"> |
| | | <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('添加用户','provider-add.html',500,480)"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-xs" onclick="openAccountPage({{d.id}})">账号管理</a> |
| | | <a class="layui-btn layui-btn-xs" onclick="openLinkPage({{d.id}})">链接管理</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | function openAccountPage(id) { |
| | | xadmin.open('账号管理','providerAccount-list.html?pid='+ id,null,null,true); |
| | | } |
| | | |
| | | function openLinkPage(id) { |
| | | xadmin.open('链接管理','providerLink-list.html?pid='+ id,null,null,true); |
| | | } |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script type="text/html" id="dateFomat"> |
| | | <div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#start' //指定元素 |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#end' //指定元素 |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | var app = null; |
| | | layui.use('table', function () { |
| | | //搜索表单的vue赋值 |
| | | app = new Vue({ |
| | | el: "#searchForm", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '' |
| | | }, |
| | | methods: { |
| | | 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/lijin/provider/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/lijin/provider/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | | layer.msg(e.msg); |
| | | }, function (e) { |
| | | |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | app.key = ksapp.getQueryParam("appname") != null ? ksapp.getQueryParam("appname") : ''; |
| | | app.start = ksapp.getQueryParam("start"); |
| | | app.end = ksapp.getQueryParam("end"); |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/lijin/provider/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | |
| | | |
| | | table.render({ |
| | | elem: '#table_list', |
| | | url: url, |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 80, title: "状态", templet: "#switchTpl"}, |
| | | {field: 'name',edit: 'text', width: 120, sort: true, title: "供应商"}, |
| | | {field: 'linkman', edit: 'text', width: 150, title: "联系人"}, |
| | | {field: 'phone', edit: 'text', width: 200, title: "联系电话"}, |
| | | {field: 'mail', edit: 'text', width: 200, title: "邮件地址"}, |
| | | {field: 'loginName', edit: 'text', width: 120,title: "登录名"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间", templet:"#dateFomat"}, |
| | | {fixed: 'right', width: 250, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | | ], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.pe.totalCount, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //监听单元格编辑 |
| | | table.on('edit(app)', |
| | | function (obj) { |
| | | var value = obj.value, //得到修改后的值 |
| | | data = obj.data, //得到所在行所有键值 |
| | | field = obj.field; //得到字段 |
| | | //修改接口 |
| | | var params = {id: data.id}; |
| | | params[field] = value; |
| | | app.update(data.id, params); |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | 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; |
| | | } |
| | | app.deleteList(); |
| | | break; |
| | | }; |
| | | }); |
| | | |
| | | |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/http.js" 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"> |
| | | <input type="hidden" name="providerId" id="providerId"/> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 应用备注</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="accountName" class="layui-form-label"> |
| | | <span class="x-red">*</span>账号名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="accountName" name="accountName" required="" lay-verify="accountName" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="appKey" class="layui-form-label"> |
| | | <span class="x-red">*</span>appKey</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="appKey" name="appKey" required="" lay-verify="appKey" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="appSecret" class="layui-form-label"> |
| | | appSecret</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="appSecret" name="appSecret" required="" lay-verify="appSecret" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="linkman" class="layui-form-label"> |
| | | 联系人</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="linkman" name="linkman" required="" lay-verify="linkman" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="maxMoney" class="layui-form-label"> |
| | | 每日最大金额</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="maxMoney" name="maxMoney" lay-verify="maxMoney" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="maxNumber" class="layui-form-label"> |
| | | 每日最大商品数</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="maxNumber" name="maxNumber" required="" lay-verify="maxNumber" |
| | | 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="" style="margin: 0px 50px">增加</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | var providerId= GetQueryString("pid"); // 上级did |
| | | //封装GetQueryString()方法来获取URL后面的value值 |
| | | function GetQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return decodeURI(r[2]); |
| | | return null; |
| | | } |
| | | |
| | | $("#providerId").val(providerId); |
| | | |
| | | |
| | | |
| | | layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/lijin/providerAccount/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; |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/vue.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../js/xadmin.js"></script> |
| | | <script type="text/javascript" src="../../js/http.js" 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]--> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-view .layui-table th{ |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </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"> |
| | | <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" id="searchForm"> |
| | | <input type="hidden" name="providerId" id="providerId"/> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start" |
| | | :value="start"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end" |
| | | :value="end"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" id="key" name="key" placeholder="请输入应用名称" :value="key" autocomplete="off" |
| | | class="layui-input"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button class="layui-btn">搜索</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | <div class="demoTable"> |
| | | 搜索ID: |
| | | <div class="layui-inline"> |
| | | <input class="layui-input" name="id" id="demoReload" autocomplete="off"> |
| | | </div> |
| | | <button class="layui-btn" data-type="reload">搜索</button> |
| | | </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="openAddViews()"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script> |
| | | var providerId= GetQueryString("pid"); // 上级did |
| | | |
| | | //封装GetQueryString()方法来获取URL后面的value值 |
| | | function GetQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return decodeURI(r[2]); |
| | | return null; |
| | | } |
| | | |
| | | if (providerId != null && providerId != undefined) { |
| | | alert(1000); |
| | | $("#providerId").val(providerId); |
| | | } else { |
| | | providerId = $("#providerId").val(); |
| | | alert(2000); |
| | | } |
| | | |
| | | |
| | | function openAddViews() { |
| | | xadmin.open('新增链接信息','providerAccount-add.html?pid='+ providerId,500,480); |
| | | } |
| | | |
| | | |
| | | var app = null; |
| | | layui.use('table', function () { |
| | | //搜索表单的vue赋值 |
| | | app = new Vue({ |
| | | el: "#searchVue", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '' |
| | | }, |
| | | methods: { |
| | | 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/lijin/providerAccount/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/lijin/providerAccount/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | | layer.msg(e.msg); |
| | | }, function (e) { |
| | | |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // app.key = ksapp.getQueryParam("appname") != null ? ksapp.getQueryParam("appname") : ''; |
| | | // app.start = ksapp.getQueryParam("start"); |
| | | // app.end = ksapp.getQueryParam("end"); |
| | | |
| | | app.key = $("#key").val(); |
| | | // app.start = ksapp.getQueryParam("start"); |
| | | // app.end = ksapp.getQueryParam("end"); |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/lijin/providerAccount/listByPage"; |
| | | // var url = "/admin/api/lijin/providerAccount/listByPage?key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | // if (providerId != null && providerId != undefined) { |
| | | // url = url + "&providerId=" + providerId; |
| | | // } |
| | | |
| | | // var data = new FormData("#searchForm"); |
| | | // var formData = new FormData($('#searchForm')[0]); |
| | | // var formData = $('#searchForm').serializeArray(); |
| | | // Array.push('pageSize', 20); |
| | | // formData.append('pageSize', 20); |
| | | // formData.append('page', 1); |
| | | |
| | | table.render({ |
| | | id: 'testReload', |
| | | elem: '#table_list', |
| | | url: url, |
| | | where: {'page': 1, 'pageSize': 20, 'key':app.key }, //如果无需传递额外参数,可不加该参数page=1&pageSize=20 |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 95, title: "状态", templet: "#switchTpl"}, |
| | | {field: 'accountName',edit: 'text', width: 200, sort: true, title: "账号名称"}, |
| | | {field: 'appKey', edit: 'text', width: 200, title: "APPKey"}, |
| | | {field: 'appSecret', edit: 'text', width: 200, title: "APPSecret"}, |
| | | {field: 'maxMoney', edit: 'text', width: 120, title: "每日最大金额"}, |
| | | {field: 'maxNumber', edit: 'text', width: 120,title: "每日最大商品数"}, |
| | | {field: 'todayConsumeMoney', width: 120, title: "今日已用金额"}, |
| | | {field: 'todayConsumeNumber', width: 120,title: "今日已用商品数"}, |
| | | {fixed: 'right', width: 150, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | | |
| | | ], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.pe.totalCount, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | |
| | | |
| | | //监听单元格编辑 |
| | | table.on('edit(app)', |
| | | function (obj) { |
| | | var value = obj.value, //得到修改后的值 |
| | | data = obj.data, //得到所在行所有键值 |
| | | field = obj.field; //得到字段 |
| | | //修改接口 |
| | | var params = {id: data.id}; |
| | | params[field] = value; |
| | | app.update(data.id, params); |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | 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; |
| | | } |
| | | app.deleteList(); |
| | | break; |
| | | }; |
| | | }); |
| | | |
| | | |
| | | // var $ = layui.$, active = { |
| | | // reload: function(){ |
| | | // var dataForm = $('#searchForm').serialize(); |
| | | // |
| | | // //执行重载 |
| | | // table.reload('testReload', { |
| | | // page: { |
| | | // curr: 1 //重新从第 1 页开始 |
| | | // } |
| | | // }); |
| | | // } |
| | | // }; |
| | | // $('.demoTable .layui-btn').on('click', function(){ |
| | | // var type = $(this).data('type'); |
| | | // active[type] ? active[type].call(this) : ''; |
| | | // }); |
| | | |
| | | |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/http.js" 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"> |
| | | <input type="hidden" name="providerId" id="providerId"/> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_link" class="layui-form-label"> |
| | | <span class="x-red">*</span>链接</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="L_link" name="link" required="" lay-verify="link" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="type" class="layui-form-label"> |
| | | <span class="x-red">*</span>链接类型</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="type" name="type" class="layui-select"> |
| | | <option value="TB">淘宝</option> |
| | | <option value="JD">京东</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="money" class="layui-form-label"> |
| | | <span class="x-red">*</span>礼金金额</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="money" name="money" required="" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="effectTime" class="layui-form-label"> |
| | | <span class="x-red">*</span>生效时间</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="effectTime" name="effectTime" autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="expireTime" class="layui-form-label"> |
| | | 到期时间</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="expireTime" name="expireTime" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="" style="margin: 0px 50px">增加</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <script> |
| | | |
| | | var providerId= GetQueryString("pid"); // 上级did |
| | | //封装GetQueryString()方法来获取URL后面的value值 |
| | | function GetQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return decodeURI(r[2]); |
| | | return null; |
| | | } |
| | | |
| | | $("#providerId").val(providerId); |
| | | |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#expireTime' //指定元素 |
| | | ,trigger: 'click' |
| | | ,type: 'datetime' |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#effectTime' //指定元素 |
| | | ,trigger: 'click' // 解决闪退 |
| | | ,type: 'datetime' |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | |
| | | <script>layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | | // if (value.length < 3) { |
| | | // return '应用名称至少得3个字符啊'; |
| | | // } |
| | | // }, |
| | | // appcode: [/^([A-Za-z0-9]|\-|_)+$/, '应用标识只能包含 数字、英文字符、_ 、-'], |
| | | // desc: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '简介最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // remarks: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '备注最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // |
| | | // }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/lijin/providerLink/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; |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/vue.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../js/xadmin.js"></script> |
| | | <script type="text/javascript" src="../../js/http.js" 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]--> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-view .layui-table th{ |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </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"> |
| | | <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" id="searchForm"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start" |
| | | :value="start"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end" |
| | | :value="end"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="appname" placeholder="请输入应用名称" :value="key" autocomplete="off" |
| | | class="layui-input"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="sreach"> |
| | | <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> |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#start' //指定元素 |
| | | ,trigger: 'click' |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#end' //指定元素 |
| | | ,trigger: 'click' |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" onclick="openAddViews()"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="switchState"> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="effectTimeFomat"> |
| | | <div>{{layui.util.toDateString(d.effectTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="expireTimeFomat"> |
| | | <div>{{layui.util.toDateString(d.expireTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="dateFomat"> |
| | | <div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | var providerId= GetQueryString("pid"); // 上级did |
| | | |
| | | //封装GetQueryString()方法来获取URL后面的value值 |
| | | function GetQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return decodeURI(r[2]); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | function openAddViews() { |
| | | xadmin.open('新增链接信息','providerLink-add.html?pid='+ providerId,500,480); |
| | | } |
| | | |
| | | |
| | | var app = null; |
| | | layui.use('table', function () { |
| | | //搜索表单的vue赋值 |
| | | app = new Vue({ |
| | | el: "#searchForm", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '' |
| | | }, |
| | | methods: { |
| | | 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/lijin/providerLink/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/lijin/providerLink/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | | layer.msg(e.msg); |
| | | }, function (e) { |
| | | |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | app.key = ksapp.getQueryParam("appname") != null ? ksapp.getQueryParam("appname") : ''; |
| | | app.start = ksapp.getQueryParam("start"); |
| | | app.end = ksapp.getQueryParam("end"); |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/lijin/providerLink/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | if (providerId != null && providerId != undefined) { |
| | | url = url + "&providerId="+ providerId; |
| | | } |
| | | |
| | | |
| | | table.render({ |
| | | elem: '#table_list', |
| | | url: url, |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 95, title: "状态", templet: "#switchState"}, |
| | | {field: 'link',edit: 'text',width: 250, overflow: 'hidden', title: "链接"}, |
| | | {field: 'type', edit: 'text', sort: true, width: 100, title: "链接类型"}, |
| | | {field: 'money', edit: 'text', width: 100, title: "礼金金额"}, |
| | | {field: 'effectTime', edit: 'text', width: 140, title: "生效时间" , templet:"#effectTimeFomat"}, |
| | | {field: 'expireTime', edit: 'text', width: 140,title: "到期时间", templet:"#expireTimeFomat"}, |
| | | {field: 'updateTime', sort: true, width: 140, title: "修改时间", templet:"#dateFomat"}, |
| | | {fixed: 'right', width: 100, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | | ], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.pe.totalCount, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //监听单元格编辑 |
| | | table.on('edit(app)', |
| | | function (obj) { |
| | | var value = obj.value, //得到修改后的值 |
| | | data = obj.data, //得到所在行所有键值 |
| | | field = obj.field; //得到字段 |
| | | //修改接口 |
| | | var params = {id: data.id}; |
| | | params[field] = value; |
| | | app.update(data.id, params); |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | 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; |
| | | } |
| | | app.deleteList(); |
| | | break; |
| | | }; |
| | | }); |
| | | |
| | | |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/http.js" 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"> |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="gradeId" class="layui-form-label"> |
| | | 所属等级</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="gradeId" name="gradeId" class="layui-select"> |
| | | <option value="0">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="name" class="layui-form-label"> |
| | | <span class="x-red">*</span>套餐名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="name" name="name" required="" lay-verify="name" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="icon" class="layui-form-label"> |
| | | <span class="x-red">*</span>套餐图标</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="icon" name="icon" required="" lay-verify="icon" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="originalPrice" class="layui-form-label"> |
| | | 原价</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="originalPrice" name="originalPrice" required="" lay-verify="originalPrice" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="discount" class="layui-form-label"> |
| | | 折扣</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="discount" name="discount" required="" lay-verify="discount" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="discountPrice" class="layui-form-label"> |
| | | 折扣价</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="discountPrice" name="discountPrice" required="" lay-verify="discountPrice" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="validDays" class="layui-form-label"> |
| | | 有效天数</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="validDays" name="validDays" lay-verify="validDays" |
| | | 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>layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | | // if (value.length < 3) { |
| | | // return '应用名称至少得3个字符啊'; |
| | | // } |
| | | // }, |
| | | // appcode: [/^([A-Za-z0-9]|\-|_)+$/, '应用标识只能包含 数字、英文字符、_ 、-'], |
| | | // desc: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '简介最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // remarks: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '备注最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // |
| | | // }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/vip/vipCombo/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; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | $.ajax({ |
| | | type:"GET", |
| | | url:"admin/api/vip/vipGrade/getValidList", |
| | | dataType:"json", |
| | | success:function(data){ |
| | | |
| | | }, |
| | | error:function(jqXHR){ |
| | | alert("请求失败!"); |
| | | } |
| | | }); |
| | | } |
| | | </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 type="text/javascript" src="../../js/vue.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../js/xadmin.js"></script> |
| | | <script type="text/javascript" src="../../js/http.js" 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]--> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-view .layui-table th{ |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </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"> |
| | | <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" id="searchForm"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start" |
| | | :value="start"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end" |
| | | :value="end"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="appname" placeholder="请输入应用名称" :value="key" autocomplete="off" |
| | | class="layui-input"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="sreach"> |
| | | <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('添加套餐','combo-add.html',500,480)"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script type="text/html" id="dateFomat"> |
| | | <div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#start' //指定元素 |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#end' //指定元素 |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | var app = null; |
| | | layui.use('table', function () { |
| | | //搜索表单的vue赋值 |
| | | app = new Vue({ |
| | | el: "#searchForm", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '' |
| | | }, |
| | | methods: { |
| | | 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/vip/vipCombo/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/vip/vipCombo/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | | layer.msg(e.msg); |
| | | }, function (e) { |
| | | |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | app.key = ksapp.getQueryParam("appname") != null ? ksapp.getQueryParam("appname") : ''; |
| | | app.start = ksapp.getQueryParam("start"); |
| | | app.end = ksapp.getQueryParam("end"); |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/vip/vipCombo/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | |
| | | |
| | | table.render({ |
| | | elem: '#table_list', |
| | | url: url, |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 80, title: "状态", templet: "#switchTpl"}, |
| | | {field: 'gradeId', edit: 'text', width: 150, title: "等级名称"}, |
| | | {field: 'name',edit: 'text', width: 120, sort: true, title: "套餐名称"}, |
| | | {field: 'icon', edit: 'text', width: 150, title: "套餐图标"}, |
| | | {field: 'originalPrice', edit: 'text', width: 200, title: "原价"}, |
| | | {field: 'discount', edit: 'text', width: 200, title: "折扣"}, |
| | | {field: 'discountPrice', edit: 'text', width: 120,title: "折扣价"}, |
| | | {field: 'validDays', edit: 'text', width: 120,title: "有效天数"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间", templet:"#dateFomat"}, |
| | | {fixed: 'right', width: 250, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | | ], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.pe.totalCount, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //监听单元格编辑 |
| | | table.on('edit(app)', |
| | | function (obj) { |
| | | var value = obj.value, //得到修改后的值 |
| | | data = obj.data, //得到所在行所有键值 |
| | | field = obj.field; //得到字段 |
| | | //修改接口 |
| | | var params = {id: data.id}; |
| | | params[field] = value; |
| | | app.update(data.id, params); |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | 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; |
| | | } |
| | | app.deleteList(); |
| | | break; |
| | | }; |
| | | }); |
| | | |
| | | |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/http.js" 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"> |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="name" class="layui-form-label"> |
| | | <span class="x-red">*</span>等级名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="name" name="name" required="" lay-verify="name" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="icon" class="layui-form-label"> |
| | | <span class="x-red">*</span>等级图标</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="icon" name="icon" required="" lay-verify="icon" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="sort" class="layui-form-label"> |
| | | 等级序号</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="sort" name="sort" required="" lay-verify="sort" |
| | | 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>layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | | // if (value.length < 3) { |
| | | // return '应用名称至少得3个字符啊'; |
| | | // } |
| | | // }, |
| | | // appcode: [/^([A-Za-z0-9]|\-|_)+$/, '应用标识只能包含 数字、英文字符、_ 、-'], |
| | | // desc: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '简介最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // remarks: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '备注最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // |
| | | // }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/vip/vipGrade/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; |
| | | }); |
| | | |
| | | });</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 type="text/javascript" src="../../js/vue.min.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../js/xadmin.js"></script> |
| | | <script type="text/javascript" src="../../js/http.js" 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]--> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-view .layui-table th{ |
| | | overflow:hidden; |
| | | } |
| | | |
| | | .layui-table-view .layui-table { |
| | | width: 100%; |
| | | } |
| | | </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"> |
| | | <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" id="searchForm"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="开始日" name="start" id="start" |
| | | :value="start"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input class="layui-input" autocomplete="off" placeholder="截止日" name="end" id="end" |
| | | :value="end"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="appname" placeholder="请输入应用名称" :value="key" autocomplete="off" |
| | | class="layui-input"></div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="sreach"> |
| | | <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('添加等级','grade-add.html',500,480)"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | <script type="text/html" id="dateFomat"> |
| | | <div>{{layui.util.toDateString(d.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" lay-filter="stateBox" {{ d.state== 1 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use('laydate', |
| | | function () { |
| | | var laydate = layui.laydate; |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#start' //指定元素 |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#end' //指定元素 |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | var app = null; |
| | | layui.use('table', function () { |
| | | //搜索表单的vue赋值 |
| | | app = new Vue({ |
| | | el: "#searchForm", |
| | | data: { |
| | | key: '', |
| | | start: '', |
| | | end: '' |
| | | }, |
| | | methods: { |
| | | 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/vip/vipGrade/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/vip/vipGrade/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | | layer.msg(e.msg); |
| | | }, function (e) { |
| | | |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | app.key = ksapp.getQueryParam("appname") != null ? ksapp.getQueryParam("appname") : ''; |
| | | app.start = ksapp.getQueryParam("start"); |
| | | app.end = ksapp.getQueryParam("end"); |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/vip/vipGrade/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | |
| | | |
| | | table.render({ |
| | | elem: '#table_list', |
| | | url: url, |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 80, title: "状态", templet: "#switchTpl"}, |
| | | {field: 'gradeId', edit: 'text', width: 150, title: "等级名称"}, |
| | | {field: 'name',edit: 'text', width: 120, sort: true, title: "等级图标"}, |
| | | {field: 'icon', edit: 'text', width: 150, title: "等级序号"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间", templet:"#dateFomat"}, |
| | | {fixed: 'right', width: 250, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | | ], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.pe.totalCount, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | //监听单元格编辑 |
| | | table.on('edit(app)', |
| | | function (obj) { |
| | | var value = obj.value, //得到修改后的值 |
| | | data = obj.data, //得到所在行所有键值 |
| | | field = obj.field; //得到字段 |
| | | //修改接口 |
| | | var params = {id: data.id}; |
| | | params[field] = value; |
| | | app.update(data.id, params); |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | 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; |
| | | } |
| | | app.deleteList(); |
| | | break; |
| | | }; |
| | | }); |
| | | |
| | | |
| | | //监听状态操作 |
| | | layui.form.on('switch(stateBox)', function(obj){ |
| | | var state = 0; |
| | | if (obj.elem.checked) { |
| | | state = 1; |
| | | } |
| | | var params = {id: this.value, state: state}; |
| | | app.update(this.value, params); |
| | | }); |
| | | |
| | | });</script> |
| | | </html> |
| | |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>taobao</groupId> |
| | | <artifactId>taobao</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/src/main/libs/taobao-sdk-java-auto_1533536267316-20180829.jar</systemPath> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- https://mvnrepository.com/artifact/dom4j/dom4j --> |
| | | <dependency> |
| | | <groupId>dom4j</groupId> |
New file |
| | |
| | | package com.ks.lijin.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LiJinException extends BaseException { |
| | | |
| | | public static final int CODE_TLJ_UN_PAID = 100; |
| | | // 商品支持创建红包 |
| | | public static final int CODE_TLJ_FORBIDDEN = 101; |
| | | // 官方账户余额不足 |
| | | public static final int CODE_TLJ_NO_MONEY = 102; |
| | | |
| | | |
| | | public LiJinException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public LiJinException() { |
| | | super(); |
| | | } |
| | | |
| | | |
| | | //屏蔽堆栈信息 |
| | | @Override |
| | | public synchronized Throwable fillInStackTrace() { |
| | | return this; |
| | | } |
| | | } |
File was renamed from facade-lijin/src/main/java/com/ks/lijin/exception/LuckyActivityAwardException.java |
| | |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LuckyActivityAwardException extends BaseException { |
| | | public class LiJinExpendRecordException extends BaseException { |
| | | |
| | | public LuckyActivityAwardException(int code, String msg) { |
| | | public LiJinExpendRecordException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
New file |
| | |
| | | package com.ks.lijin.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class TaoKeApiException extends BaseException { |
| | | // 淘宝APPkey的请求限制 |
| | | public static final int CODE_APPKEY_LIMIT = 1; |
| | | // 无可用app |
| | | public static final int CODE_NO_USE = 2; |
| | | // api请求错误 |
| | | public static final int CODE_API_ERROR = 3; |
| | | // 其他错误 |
| | | public static final int CODE_OTHER = 4; |
| | | |
| | | |
| | | |
| | | |
| | | private int code; |
| | | private String msg; |
| | | |
| | | private Map<String, String> params; |
| | | |
| | | public Map<String, String> getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(Map<String, String> params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public TaoKeApiException() { |
| | | |
| | | } |
| | | |
| | | public TaoKeApiException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public TaoKeApiException(int code, String msg, Map<String, String> params) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.params = params; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return String.format("错误码为:%s 错误信息为:%s", code + "", msg); |
| | | } |
| | | //屏蔽堆栈信息 |
| | | @Override |
| | | public synchronized Throwable fillInStackTrace() { |
| | | return this; |
| | | } |
| | | } |
| | |
| | | package com.ks.lijin.pojo.DO; |
| | | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | |
| | | @Column(name = "lk_type") |
| | | private String type; |
| | | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @Column(name = "lk_effect_time") |
| | | private Date effectTime; |
| | | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @Column(name = "lk_expire_time") |
| | | private Date expireTime; |
| | | |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | public class LiJinCreateParam { |
| | | |
| | | // 用户id |
| | | private String uid; |
| | | // 商品id |
| | | private Long goodsId; |
| | | // 礼金标题 |
| | | private String title; |
| | | // 礼金数量 |
| | | private int num; |
| | | // 单个金额 |
| | | private BigDecimal money; |
| | | |
| | | private Date sendStartTime; |
| | | private Date sendEndTime; |
| | | private Date useStartTime; |
| | | private Date useEndTime; |
| | | private String pid; |
| | | |
| | | |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public int getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(int num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Date getSendStartTime() { |
| | | return sendStartTime; |
| | | } |
| | | |
| | | public void setSendStartTime(Date sendStartTime) { |
| | | this.sendStartTime = sendStartTime; |
| | | } |
| | | |
| | | public Date getSendEndTime() { |
| | | return sendEndTime; |
| | | } |
| | | |
| | | public void setSendEndTime(Date sendEndTime) { |
| | | this.sendEndTime = sendEndTime; |
| | | } |
| | | |
| | | public Date getUseStartTime() { |
| | | return useStartTime; |
| | | } |
| | | |
| | | public void setUseStartTime(Date useStartTime) { |
| | | this.useStartTime = useStartTime; |
| | | } |
| | | |
| | | public Date getUseEndTime() { |
| | | return useEndTime; |
| | | } |
| | | |
| | | public void setUseEndTime(Date useEndTime) { |
| | | this.useEndTime = useEndTime; |
| | | } |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public Long getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Long goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public BigDecimal getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | this.money = money; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO.taobao; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | |
| | | public class CommonGoods { |
| | | public static int GOODS_TYPE_TB = 1;// 淘宝天猫 |
| | | public static int GOODS_TYPE_JD = 2;// 京东 |
| | | public static int GOODS_TYPE_PDD = 3;// 拼多多 |
| | | |
| | | public static int SHOP_TYPE_TB = 1;// 淘宝 |
| | | public static int SHOP_TYPE_TM = 2;// 天猫 |
| | | public static int SHOP_TYPE_JD = 20;// 京东 |
| | | public static int SHOP_TYPE_JD_SELF = 21;// 京东自营 |
| | | public static int SHOP_TYPE_PDD = 30;// 拼多多 |
| | | |
| | | public static int STATE_NORMAL = 0;// 正常 |
| | | public static int STATE_OFFLINE = 1;// 下线 |
| | | |
| | | private Long id; |
| | | private String title; |
| | | private Long goodsId;// 第三方商品ID |
| | | private Integer goodsType;// 第三方类型 |
| | | private Integer shopType; |
| | | private Long sellerId; |
| | | private String sellerName; |
| | | private Integer sales; |
| | | private BigDecimal rate; |
| | | private String picture; |
| | | private String pictureWhite; |
| | | private Integer state; |
| | | private BigDecimal price; |
| | | private String couponInfo; |
| | | private BigDecimal couponStartPrice; |
| | | private BigDecimal couponAmount; |
| | | private Integer couponLeftCount; |
| | | private Integer couponTotalCount; |
| | | private String videoCover; |
| | | private String videoUrl; |
| | | private Integer materialLibType;// 物料库类型 1-营销商品库 0-非营销商品库 |
| | | private String otherInfo; // 商品其他信息-json字符串 |
| | | |
| | | public CommonGoods() { |
| | | } |
| | | |
| | | public CommonGoods(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Long getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Long goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public Integer getMaterialLibType() { |
| | | return materialLibType; |
| | | } |
| | | |
| | | public void setMaterialLibType(Integer materialLibType) { |
| | | this.materialLibType = materialLibType; |
| | | } |
| | | |
| | | public Integer getGoodsType() { |
| | | return goodsType; |
| | | } |
| | | |
| | | public void setGoodsType(Integer goodsType) { |
| | | this.goodsType = goodsType; |
| | | } |
| | | |
| | | public Integer getShopType() { |
| | | return shopType; |
| | | } |
| | | |
| | | public void setShopType(Integer shopType) { |
| | | this.shopType = shopType; |
| | | } |
| | | |
| | | public Long getSellerId() { |
| | | return sellerId; |
| | | } |
| | | |
| | | public void setSellerId(Long sellerId) { |
| | | this.sellerId = sellerId; |
| | | } |
| | | |
| | | public String getSellerName() { |
| | | return sellerName; |
| | | } |
| | | |
| | | public void setSellerName(String sellerName) { |
| | | this.sellerName = sellerName; |
| | | } |
| | | |
| | | public Integer getSales() { |
| | | return sales; |
| | | } |
| | | |
| | | public void setSales(Integer sales) { |
| | | this.sales = sales; |
| | | } |
| | | |
| | | public BigDecimal getRate() { |
| | | return rate; |
| | | } |
| | | |
| | | public void setRate(BigDecimal rate) { |
| | | this.rate = rate; |
| | | } |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | | |
| | | public void setPicture(String picture) { |
| | | this.picture = picture; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public BigDecimal getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(BigDecimal price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public String getCouponInfo() { |
| | | return couponInfo; |
| | | } |
| | | |
| | | public void setCouponInfo(String couponInfo) { |
| | | this.couponInfo = couponInfo; |
| | | } |
| | | |
| | | public BigDecimal getCouponStartPrice() { |
| | | return couponStartPrice; |
| | | } |
| | | |
| | | public void setCouponStartPrice(BigDecimal couponStartPrice) { |
| | | this.couponStartPrice = couponStartPrice; |
| | | } |
| | | |
| | | public BigDecimal getCouponAmount() { |
| | | return couponAmount; |
| | | } |
| | | |
| | | public void setCouponAmount(BigDecimal couponAmount) { |
| | | this.couponAmount = couponAmount; |
| | | } |
| | | |
| | | public Integer getCouponLeftCount() { |
| | | return couponLeftCount; |
| | | } |
| | | |
| | | public void setCouponLeftCount(Integer couponLeftCount) { |
| | | this.couponLeftCount = couponLeftCount; |
| | | } |
| | | |
| | | public Integer getCouponTotalCount() { |
| | | return couponTotalCount; |
| | | } |
| | | |
| | | public void setCouponTotalCount(Integer couponTotalCount) { |
| | | this.couponTotalCount = couponTotalCount; |
| | | } |
| | | |
| | | public String getVideoCover() { |
| | | return videoCover; |
| | | } |
| | | |
| | | public void setVideoCover(String videoCover) { |
| | | this.videoCover = videoCover; |
| | | } |
| | | |
| | | public String getVideoUrl() { |
| | | return videoUrl; |
| | | } |
| | | |
| | | public void setVideoUrl(String videoUrl) { |
| | | this.videoUrl = videoUrl; |
| | | } |
| | | |
| | | public String getPictureWhite() { |
| | | return pictureWhite; |
| | | } |
| | | |
| | | public void setPictureWhite(String pictureWhite) { |
| | | this.pictureWhite = pictureWhite; |
| | | } |
| | | |
| | | public String getOtherInfo() { |
| | | return otherInfo; |
| | | } |
| | | |
| | | public void setOtherInfo(String otherInfo) { |
| | | this.otherInfo = otherInfo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO.taobao; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | |
| | | |
| | | public class TaoBaoGoodsBrief implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | private Long id; |
| | | private Integer rootCatId;// 0, 一级类目ID |
| | | |
| | | private Integer eventCreatorId;// 0, |
| | | |
| | | private Integer leafCatId;// 50011277, 子类目id |
| | | |
| | | private String debugInfo;// null, |
| | | |
| | | private Integer rootCatScore;// 0, |
| | | |
| | | private Long sellerId;// 卖家Id |
| | | |
| | | private Integer userType;// 0, |
| | | private String shopTitle;// 店铺名称 |
| | | |
| | | private String pictUrl;// 主图链接 |
| | | |
| | | private String pictUrlWhite;// 白底色图片链接 |
| | | |
| | | private String title;// 商品标题 |
| | | |
| | | private Long auctionId;// 商品ID |
| | | |
| | | private String couponLink;// 优惠券链�? |
| | | |
| | | private String couponLinkTaoToken;// |
| | | |
| | | private String couponActivityId;// |
| | | |
| | | private Integer biz30day;// 月销量 |
| | | |
| | | private BigDecimal tkRate;// 佣金比例 �?��100 |
| | | |
| | | private String nick;// "yoyo_808611", 店铺名称 |
| | | |
| | | private Integer includeDxjh;// 1:定向计划 |
| | | |
| | | private BigDecimal reservePrice;// 588, |
| | | |
| | | private BigDecimal tkCommFee;// 32.04, |
| | | |
| | | private BigDecimal totalFee;// 4814.43, |
| | | |
| | | private Integer totalNum;// 229, 库存数量 |
| | | |
| | | private BigDecimal zkPrice;// 无线价格,在售价 |
| | | private Integer dayLeft;// -17228, |
| | | |
| | | private String tk3rdRate;// null, |
| | | |
| | | private String auctionUrl;// 商品链接 |
| | | |
| | | private Double rlRate;// 69.72, |
| | | |
| | | private Integer hasRecommended;// 0, |
| | | private Integer hasSame;// 0, |
| | | |
| | | private Long sameItemPid;// "-232381821", |
| | | |
| | | private Integer couponTotalCount;// 优惠券�?�? |
| | | |
| | | private Integer couponLeftCount;// 优惠券剩余数�? |
| | | |
| | | private BigDecimal couponAmount;// 优惠金额 |
| | | |
| | | private String eventRate;// null, |
| | | private String couponShortLink;// 优惠券短�? |
| | | |
| | | private String couponInfo;// 优惠券信�? |
| | | |
| | | private BigDecimal couponStartFee;// 优惠券起始优�? |
| | | |
| | | private String couponEffectiveStartTime;// "2017-02-04",优惠券开始时�? |
| | | |
| | | private String couponEffectiveEndTime;// 优惠券结束时�? |
| | | |
| | | private String hasUmpBonus;// null, |
| | | |
| | | private String isBizActivity;// null, |
| | | |
| | | private String umpBonus;// null, |
| | | |
| | | private String rootCategoryName;// 一级分类名称 |
| | | |
| | | private String couponOriLink;// 优惠券原始链�? |
| | | |
| | | private String userTypeName;// 用户类型 |
| | | private String tkMktStatus; // 1:营销返利 |
| | | |
| | | private Integer totalSales;// 229, 淘客30天月推广量 |
| | | |
| | | private Integer state;// 0-正常 1-商品下架 |
| | | |
| | | private Integer materialLibType;//物料库类型 |
| | | |
| | | private String description;//推荐语 |
| | | |
| | | |
| | | private String leafName; // 子类目名称 |
| | | |
| | | private Integer isPrepay; // 是否加入消费者保障 1:是 0 否 |
| | | |
| | | private Integer shopDsr; // 店铺评分 |
| | | |
| | | private Integer ratesum; // 卖家等级 |
| | | |
| | | private Integer rfdRate; // 退款率是否低于行业均值 |
| | | |
| | | private Integer goodRate; // 好评率是否高于行业均值 |
| | | |
| | | private Integer payRate30; // 成交转化是否高于行业均值 |
| | | |
| | | private Integer freeShipment; // 是否包邮 |
| | | |
| | | private String salesCount; |
| | | |
| | | private List<String> imgList; |
| | | |
| | | private String dxjhInfo; |
| | | |
| | | private String provcity; |
| | | |
| | | |
| | | public TaoBaoGoodsBrief() { |
| | | this.eventCreatorId = 0; |
| | | this.hasRecommended = 0; |
| | | this.hasSame = 0; |
| | | this.rootCatId = 0; |
| | | this.rootCatScore = 0; |
| | | this.sameItemPid = 0L; |
| | | this.totalFee = new BigDecimal(0); |
| | | this.couponStartFee = new BigDecimal(0); |
| | | this.couponTotalCount = 0; |
| | | this.dayLeft = 0; |
| | | this.leafCatId = 0; |
| | | this.couponAmount = new BigDecimal(0); |
| | | this.rlRate = 0.0; |
| | | this.couponLeftCount = 0; |
| | | this.includeDxjh = 0; |
| | | |
| | | } |
| | | |
| | | public TaoBaoGoodsBrief(Long id) { |
| | | super(); |
| | | this.id = id; |
| | | } |
| | | |
| | | public TaoBaoGoodsBrief(String shopTitle) { |
| | | super(); |
| | | this.shopTitle = shopTitle; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getProvcity() { |
| | | return provcity; |
| | | } |
| | | |
| | | public void setProvcity(String provcity) { |
| | | this.provcity = provcity; |
| | | } |
| | | |
| | | public String getDxjhInfo() { |
| | | return dxjhInfo; |
| | | } |
| | | |
| | | public void setDxjhInfo(String dxjhInfo) { |
| | | this.dxjhInfo = dxjhInfo; |
| | | } |
| | | |
| | | public Integer getMaterialLibType() { |
| | | return materialLibType; |
| | | } |
| | | |
| | | public void setMaterialLibType(Integer materialLibType) { |
| | | this.materialLibType = materialLibType; |
| | | } |
| | | |
| | | |
| | | public List<String> getImgList() { |
| | | return imgList; |
| | | } |
| | | |
| | | public void setImgList(List<String> imgList) { |
| | | this.imgList = imgList; |
| | | } |
| | | |
| | | public Integer getRootCatId() { |
| | | return rootCatId; |
| | | } |
| | | |
| | | public void setRootCatId(Integer rootCatId) { |
| | | this.rootCatId = rootCatId; |
| | | } |
| | | |
| | | public Integer getEventCreatorId() { |
| | | return eventCreatorId; |
| | | } |
| | | |
| | | public void setEventCreatorId(Integer eventCreatorId) { |
| | | this.eventCreatorId = eventCreatorId; |
| | | } |
| | | |
| | | public Integer getLeafCatId() { |
| | | return leafCatId; |
| | | } |
| | | |
| | | public void setLeafCatId(Integer leafCatId) { |
| | | this.leafCatId = leafCatId; |
| | | } |
| | | |
| | | public String getDebugInfo() { |
| | | return debugInfo; |
| | | } |
| | | |
| | | public void setDebugInfo(String debugInfo) { |
| | | this.debugInfo = debugInfo; |
| | | } |
| | | |
| | | public Integer getRootCatScore() { |
| | | return rootCatScore; |
| | | } |
| | | |
| | | public void setRootCatScore(Integer rootCatScore) { |
| | | this.rootCatScore = rootCatScore; |
| | | } |
| | | |
| | | public Long getSellerId() { |
| | | return sellerId; |
| | | } |
| | | |
| | | public void setSellerId(Long sellerId) { |
| | | this.sellerId = sellerId; |
| | | } |
| | | |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public String getShopTitle() { |
| | | return shopTitle; |
| | | } |
| | | |
| | | public void setShopTitle(String shopTitle) { |
| | | this.shopTitle = shopTitle; |
| | | } |
| | | |
| | | public String getPictUrl() { |
| | | return pictUrl; |
| | | } |
| | | |
| | | public void setPictUrl(String pictUrl) { |
| | | this.pictUrl = pictUrl; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Long getAuctionId() { |
| | | return auctionId; |
| | | } |
| | | |
| | | public void setAuctionId(Long auctionId) { |
| | | this.auctionId = auctionId; |
| | | } |
| | | |
| | | public String getCouponLink() { |
| | | return couponLink; |
| | | } |
| | | |
| | | public void setCouponLink(String couponLink) { |
| | | this.couponLink = couponLink; |
| | | } |
| | | |
| | | public String getCouponLinkTaoToken() { |
| | | return couponLinkTaoToken; |
| | | } |
| | | |
| | | public void setCouponLinkTaoToken(String couponLinkTaoToken) { |
| | | this.couponLinkTaoToken = couponLinkTaoToken; |
| | | } |
| | | |
| | | public String getCouponActivityId() { |
| | | return couponActivityId; |
| | | } |
| | | |
| | | public void setCouponActivityId(String couponActivityId) { |
| | | this.couponActivityId = couponActivityId; |
| | | } |
| | | |
| | | public Integer getBiz30day() { |
| | | return biz30day; |
| | | } |
| | | |
| | | public void setBiz30day(Integer biz30day) { |
| | | this.biz30day = biz30day; |
| | | } |
| | | |
| | | public BigDecimal getTkRate() { |
| | | return tkRate; |
| | | } |
| | | |
| | | public void setTkRate(BigDecimal tkRate) { |
| | | this.tkRate = tkRate; |
| | | } |
| | | |
| | | public String getNick() { |
| | | return nick; |
| | | } |
| | | |
| | | public void setNick(String nick) { |
| | | this.nick = nick; |
| | | } |
| | | |
| | | public Integer getIncludeDxjh() { |
| | | return includeDxjh; |
| | | } |
| | | |
| | | public void setIncludeDxjh(Integer includeDxjh) { |
| | | this.includeDxjh = includeDxjh; |
| | | } |
| | | |
| | | public BigDecimal getTkCommFee() { |
| | | return tkCommFee; |
| | | } |
| | | |
| | | public BigDecimal getReservePrice() { |
| | | return reservePrice; |
| | | } |
| | | |
| | | public void setReservePrice(BigDecimal reservePrice) { |
| | | this.reservePrice = reservePrice; |
| | | } |
| | | |
| | | public BigDecimal getTotalFee() { |
| | | return totalFee; |
| | | } |
| | | |
| | | public void setTotalFee(BigDecimal totalFee) { |
| | | this.totalFee = totalFee; |
| | | } |
| | | |
| | | public void setTkCommFee(BigDecimal tkCommFee) { |
| | | this.tkCommFee = tkCommFee; |
| | | } |
| | | |
| | | public Integer getTotalNum() { |
| | | return totalNum; |
| | | } |
| | | |
| | | public void setTotalNum(Integer totalNum) { |
| | | this.totalNum = totalNum; |
| | | } |
| | | |
| | | public BigDecimal getZkPrice() { |
| | | return zkPrice; |
| | | } |
| | | |
| | | public void setZkPrice(BigDecimal zkPrice) { |
| | | this.zkPrice = zkPrice; |
| | | } |
| | | |
| | | public Integer getDayLeft() { |
| | | return dayLeft; |
| | | } |
| | | |
| | | public void setDayLeft(Integer dayLeft) { |
| | | this.dayLeft = dayLeft; |
| | | } |
| | | |
| | | public String getTk3rdRate() { |
| | | return tk3rdRate; |
| | | } |
| | | |
| | | public void setTk3rdRate(String tk3rdRate) { |
| | | this.tk3rdRate = tk3rdRate; |
| | | } |
| | | |
| | | public String getAuctionUrl() { |
| | | return auctionUrl; |
| | | } |
| | | |
| | | public void setAuctionUrl(String auctionUrl) { |
| | | this.auctionUrl = auctionUrl; |
| | | } |
| | | |
| | | public Double getRlRate() { |
| | | return rlRate; |
| | | } |
| | | |
| | | public void setRlRate(Double rlRate) { |
| | | this.rlRate = rlRate; |
| | | } |
| | | |
| | | public Integer getHasRecommended() { |
| | | return hasRecommended; |
| | | } |
| | | |
| | | public void setHasRecommended(Integer hasRecommended) { |
| | | this.hasRecommended = hasRecommended; |
| | | } |
| | | |
| | | public Integer getHasSame() { |
| | | return hasSame; |
| | | } |
| | | |
| | | public void setHasSame(Integer hasSame) { |
| | | this.hasSame = hasSame; |
| | | } |
| | | |
| | | public Long getSameItemPid() { |
| | | return sameItemPid; |
| | | } |
| | | |
| | | public void setSameItemPid(Long sameItemPid) { |
| | | this.sameItemPid = sameItemPid; |
| | | } |
| | | |
| | | public Integer getCouponTotalCount() { |
| | | return couponTotalCount; |
| | | } |
| | | |
| | | public void setCouponTotalCount(Integer couponTotalCount) { |
| | | this.couponTotalCount = couponTotalCount; |
| | | } |
| | | |
| | | public Integer getCouponLeftCount() { |
| | | return couponLeftCount; |
| | | } |
| | | |
| | | public void setCouponLeftCount(Integer couponLeftCount) { |
| | | this.couponLeftCount = couponLeftCount; |
| | | } |
| | | |
| | | public BigDecimal getCouponAmount() { |
| | | return couponAmount; |
| | | } |
| | | |
| | | public void setCouponAmount(BigDecimal couponAmount) { |
| | | this.couponAmount = couponAmount; |
| | | } |
| | | |
| | | public String getEventRate() { |
| | | return eventRate; |
| | | } |
| | | |
| | | public void setEventRate(String eventRate) { |
| | | this.eventRate = eventRate; |
| | | } |
| | | |
| | | public String getCouponShortLink() { |
| | | return couponShortLink; |
| | | } |
| | | |
| | | public void setCouponShortLink(String couponShortLink) { |
| | | this.couponShortLink = couponShortLink; |
| | | } |
| | | |
| | | public String getCouponInfo() { |
| | | return couponInfo; |
| | | } |
| | | |
| | | public void setCouponInfo(String couponInfo) { |
| | | this.couponInfo = couponInfo; |
| | | } |
| | | |
| | | public BigDecimal getCouponStartFee() { |
| | | return couponStartFee; |
| | | } |
| | | |
| | | public void setCouponStartFee(BigDecimal couponStartFee) { |
| | | this.couponStartFee = couponStartFee; |
| | | } |
| | | |
| | | public String getCouponEffectiveStartTime() { |
| | | return couponEffectiveStartTime; |
| | | } |
| | | |
| | | public void setCouponEffectiveStartTime(String couponEffectiveStartTime) { |
| | | this.couponEffectiveStartTime = couponEffectiveStartTime; |
| | | } |
| | | |
| | | public String getCouponEffectiveEndTime() { |
| | | return couponEffectiveEndTime; |
| | | } |
| | | |
| | | public void setCouponEffectiveEndTime(String couponEffectiveEndTime) { |
| | | this.couponEffectiveEndTime = couponEffectiveEndTime; |
| | | } |
| | | |
| | | public String getHasUmpBonus() { |
| | | return hasUmpBonus; |
| | | } |
| | | |
| | | public void setHasUmpBonus(String hasUmpBonus) { |
| | | this.hasUmpBonus = hasUmpBonus; |
| | | } |
| | | |
| | | public String getIsBizActivity() { |
| | | return isBizActivity; |
| | | } |
| | | |
| | | public void setIsBizActivity(String isBizActivity) { |
| | | this.isBizActivity = isBizActivity; |
| | | } |
| | | |
| | | public String getUmpBonus() { |
| | | return umpBonus; |
| | | } |
| | | |
| | | public void setUmpBonus(String umpBonus) { |
| | | this.umpBonus = umpBonus; |
| | | } |
| | | |
| | | public String getRootCategoryName() { |
| | | return rootCategoryName; |
| | | } |
| | | |
| | | public void setRootCategoryName(String rootCategoryName) { |
| | | this.rootCategoryName = rootCategoryName; |
| | | } |
| | | |
| | | public String getCouponOriLink() { |
| | | return couponOriLink; |
| | | } |
| | | |
| | | public void setCouponOriLink(String couponOriLink) { |
| | | this.couponOriLink = couponOriLink; |
| | | } |
| | | |
| | | public String getUserTypeName() { |
| | | return userTypeName; |
| | | } |
| | | |
| | | public void setUserTypeName(String userTypeName) { |
| | | this.userTypeName = userTypeName; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTkMktStatus() { |
| | | return tkMktStatus; |
| | | } |
| | | |
| | | public void setTkMktStatus(String tkMktStatus) { |
| | | this.tkMktStatus = tkMktStatus; |
| | | } |
| | | |
| | | public String getSalesCount() { |
| | | return salesCount; |
| | | } |
| | | |
| | | public void setSalesCount(String salesCount) { |
| | | this.salesCount = salesCount; |
| | | } |
| | | |
| | | |
| | | public Integer getIsPrepay() { |
| | | return isPrepay; |
| | | } |
| | | |
| | | public void setIsPrepay(Integer isPrepay) { |
| | | this.isPrepay = isPrepay; |
| | | } |
| | | |
| | | public Integer getShopDsr() { |
| | | return shopDsr; |
| | | } |
| | | |
| | | public void setShopDsr(Integer shopDsr) { |
| | | this.shopDsr = shopDsr; |
| | | } |
| | | |
| | | public Integer getRatesum() { |
| | | return ratesum; |
| | | } |
| | | |
| | | public void setRatesum(Integer ratesum) { |
| | | this.ratesum = ratesum; |
| | | } |
| | | |
| | | public Integer getRfdRate() { |
| | | return rfdRate; |
| | | } |
| | | |
| | | public void setRfdRate(Integer rfdRate) { |
| | | this.rfdRate = rfdRate; |
| | | } |
| | | |
| | | public Integer getGoodRate() { |
| | | return goodRate; |
| | | } |
| | | |
| | | public void setGoodRate(Integer goodRate) { |
| | | this.goodRate = goodRate; |
| | | } |
| | | |
| | | public Integer getPayRate30() { |
| | | return payRate30; |
| | | } |
| | | |
| | | public void setPayRate30(Integer payRate30) { |
| | | this.payRate30 = payRate30; |
| | | } |
| | | |
| | | public Integer getFreeShipment() { |
| | | return freeShipment; |
| | | } |
| | | |
| | | public void setFreeShipment(Integer freeShipment) { |
| | | this.freeShipment = freeShipment; |
| | | } |
| | | |
| | | |
| | | public String getLeafName() { |
| | | return leafName; |
| | | } |
| | | |
| | | public void setLeafName(String leafName) { |
| | | this.leafName = leafName; |
| | | } |
| | | |
| | | public Integer getTotalSales() { |
| | | return totalSales; |
| | | } |
| | | |
| | | public void setTotalSales(Integer totalSales) { |
| | | this.totalSales = totalSales; |
| | | } |
| | | |
| | | public String getPictUrlWhite() { |
| | | return pictUrlWhite; |
| | | } |
| | | |
| | | public void setPictUrlWhite(String pictUrlWhite) { |
| | | this.pictUrlWhite = pictUrlWhite; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO.taobao; |
| | | |
| | | /** |
| | | * 淘客的app信息 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class TaoKeAppInfo { |
| | | private String appKey; |
| | | private String appSecret; |
| | | private String pid; |
| | | private String adzoneId; |
| | | |
| | | |
| | | public TaoKeAppInfo() { |
| | | } |
| | | |
| | | public TaoKeAppInfo(String appKey, String appSecret) { |
| | | this.appKey = appKey; |
| | | this.appSecret = appSecret; |
| | | } |
| | | |
| | | public TaoKeAppInfo(String appKey, String appSecret, String pid) { |
| | | this.appKey = appKey; |
| | | this.appSecret = appSecret; |
| | | this.pid = pid; |
| | | } |
| | | |
| | | |
| | | public String getAdzoneId() { |
| | | return adzoneId; |
| | | } |
| | | |
| | | public void setAdzoneId(String adzoneId) { |
| | | this.adzoneId = adzoneId; |
| | | } |
| | | |
| | | public String getAppKey() { |
| | | return appKey; |
| | | } |
| | | |
| | | public void setAppKey(String appKey) { |
| | | this.appKey = appKey; |
| | | } |
| | | |
| | | public String getAppSecret() { |
| | | return appSecret; |
| | | } |
| | | |
| | | public void setAppSecret(String appSecret) { |
| | | this.appSecret = appSecret; |
| | | } |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO.taobao; |
| | | |
| | | public class TaoLiJinDTO { |
| | | private String rightsId; |
| | | private String sendUrl; |
| | | |
| | | public String getRightsId() { |
| | | return rightsId; |
| | | } |
| | | |
| | | public void setRightsId(String rightsId) { |
| | | this.rightsId = rightsId; |
| | | } |
| | | |
| | | public String getSendUrl() { |
| | | return sendUrl; |
| | | } |
| | | |
| | | public void setSendUrl(String sendUrl) { |
| | | this.sendUrl = sendUrl; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.Enums; |
| | | |
| | | public enum LinkTypeEnum { |
| | | |
| | | TB("淘宝"), |
| | | JD("京东"); |
| | | |
| | | private final String desc; |
| | | |
| | | private LinkTypeEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | |
| | | package com.ks.lijin.service; |
| | | |
| | | |
| | | import com.ks.lijin.exception.LiJinExpendRecordException; |
| | | import com.ks.lijin.pojo.DO.LiJinExpendRecord; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoBaoGoodsBrief; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public interface LiJinExpendRecordService { |
| | |
| | | public void save(LiJinExpendRecord t); |
| | | |
| | | public void delete(Long id); |
| | | |
| | | public LiJinExpendRecord createLiJin(Long uid, BigDecimal money, TaoBaoGoodsBrief goods) |
| | | throws LiJinExpendRecordException; |
| | | } |
| | |
| | | |
| | | |
| | | import com.ks.lijin.pojo.DO.LiJinProviderAccount; |
| | | import com.ks.lijin.pojo.DO.LiJinProviderLink; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | public List<LiJinProviderAccount> listByPage(int page, int pageSize, LiJinProviderAccount t); |
| | | |
| | | public void save(LiJinProviderAccount t); |
| | | public void insertSelective(LiJinProviderAccount provider); |
| | | |
| | | public void updateByPrimaryKeySelective(LiJinProviderAccount provider); |
| | | |
| | | public void delete(Long id); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import com.ks.lijin.pojo.DO.LiJinProviderLink; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<LiJinProviderLink> listByPage(int page, int pageSize, LiJinProviderLink providerLink); |
| | | |
| | | |
| | | public void save(LiJinProviderLink providerLink); |
| | | public void insertSelective(LiJinProviderLink provider); |
| | | |
| | | public void updateByPrimaryKeySelective(LiJinProviderLink provider); |
| | | |
| | | public void delete(Long id); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.utils.common; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class BigDecimalUtil { |
| | | |
| | | public static BigDecimal add(BigDecimal v1, BigDecimal v2) { |
| | | return v1.add(v2).setScale(2, BigDecimal.ROUND_DOWN); |
| | | } |
| | | |
| | | public static BigDecimal sub(BigDecimal b1, BigDecimal b2) { |
| | | return b1.subtract(b2).setScale(2, BigDecimal.ROUND_DOWN); |
| | | } |
| | | |
| | | public static BigDecimal mul(BigDecimal d1, BigDecimal d2) { // 进行乘法运算 |
| | | return d1.multiply(d2).setScale(2, BigDecimal.ROUND_DOWN); |
| | | } |
| | | |
| | | |
| | | public static BigDecimal div(BigDecimal d1, BigDecimal d2) {// 进行除法运算 |
| | | return d1.divide(d2,2, BigDecimal.ROUND_DOWN); |
| | | } |
| | | |
| | | public static BigDecimal div3(BigDecimal d1, BigDecimal d2) {// 进行除法运算 |
| | | return d1.divide(d2, 3, BigDecimal.ROUND_DOWN); |
| | | } |
| | | |
| | | public static BigDecimal getWithNoZera(BigDecimal num) {// 进行除法运算 |
| | | while (num.toString().endsWith("0") && num.toString().indexOf(".") > -1) { |
| | | num = new BigDecimal(num.toString().substring(0, num.toString().length()-1)); |
| | | return getWithNoZera(num); |
| | | } |
| | | return num; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.utils.taobao; |
| | | |
| | | |
| | | import com.ks.lijin.exception.LiJinException; |
| | | import com.ks.lijin.exception.TaoKeApiException; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoKeAppInfo; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoLiJinDTO; |
| | | import com.taobao.api.internal.util.StringUtils; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | import org.apache.commons.httpclient.params.HttpConnectionManagerParams; |
| | | import org.yeshi.utils.*; |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | //淘宝客API接口 |
| | | public class TaoKeApiUtil { |
| | | |
| | | private static long lastTime = 0; |
| | | private static Map<String, Integer> invalidMap = new HashMap<>(); |
| | | |
| | | // 淘礼金创建 |
| | | public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum, |
| | | Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime, TaoKeAppInfo app) |
| | | throws LiJinException, TaoKeApiException { |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.vegas.tlj.create"); |
| | | map.put("adzone_id", app.getPid().split("_")[3]); |
| | | map.put("item_id", auctionId + ""); |
| | | map.put("total_num", totalNum + ""); |
| | | map.put("name", name); |
| | | map.put("user_total_win_num_limit", "1"); |
| | | map.put("security_switch", "false"); |
| | | map.put("per_face", perface.toString()); |
| | | map.put("send_start_time", TimeUtil.getGernalTime(sendStartTime.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | if (sendEndTime != null) |
| | | map.put("send_end_time", TimeUtil.getGernalTime(sendEndTime.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | if (useEndTime != null) { |
| | | map.put("use_end_time", TimeUtil.getGernalTime(useEndTime.getTime(), "yyyy-MM-dd")); |
| | | map.put("use_end_time_mode", "2"); |
| | | } |
| | | |
| | | if (useStartTime != null) |
| | | map.put("use_start_time", TimeUtil.getGernalTime(useStartTime.getTime(), "yyyy-MM-dd")); |
| | | try { |
| | | String result = baseRequestForThreeTimes(map, app); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | System.out.println(json); |
| | | JSONObject root = json.optJSONObject("tbk_dg_vegas_tlj_create_response"); |
| | | if (root != null && root.optJSONObject("result") != null) { |
| | | |
| | | if (root.optJSONObject("result").optBoolean("success")) { |
| | | JSONObject modelJson = root.optJSONObject("result").optJSONObject("model"); |
| | | TaoLiJinDTO dto = new TaoLiJinDTO(); |
| | | dto.setRightsId(modelJson.optString("rights_id")); |
| | | dto.setSendUrl(modelJson.optString("send_url")); |
| | | return dto; |
| | | } else { |
| | | // 日志记录 TODO |
| | | } |
| | | |
| | | // 接口返回异常 |
| | | String msgCode = root.optJSONObject("result").optString("msg_code"); |
| | | if (!StringUtil.isNullOrEmpty(msgCode)) { |
| | | // TLJLogHelper.info(auctionId, root.toString());// 淘礼金异常信息记录 TODO |
| | | switch (msgCode) { |
| | | case "FAIL_BIZ_ITEM_FORBIDDEN": |
| | | throw new LiJinException(LiJinException.CODE_TLJ_FORBIDDEN, "该商品不支持创建淘礼金红包"); |
| | | case "FAIL_BIZ_ACCOUNT_UN_PAID": |
| | | throw new LiJinException(LiJinException.CODE_TLJ_UN_PAID, "您的淘礼金账户暂未创建,请前往资金管理页面充值"); |
| | | case "PRE_FREEZE_ASSET_ACCOUNT_ERROR": |
| | | throw new LiJinException(LiJinException.CODE_TLJ_NO_MONEY, "官方玩法钱包余额不足"); |
| | | default: |
| | | throw new TaoKeApiException(Integer.parseInt(msgCode), root.toString()); |
| | | } |
| | | } |
| | | } |
| | | } catch (LiJinException e) { |
| | | throw e; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static String baseRequestForThreeTimes(Map<String, String> params, TaoKeAppInfo app) { |
| | | JSONObject data = null; |
| | | int count = 0; |
| | | while (data == null && count < 3) { |
| | | count++; |
| | | try { |
| | | data = baseRequest(params, app); |
| | | } catch (TaoKeApiException e) { |
| | | // 记录现场 |
| | | // TaoKeLogHelper.error(e.getParams(), e.getMsg()); |
| | | } |
| | | } |
| | | if (data != null) |
| | | return data.toString(); |
| | | else |
| | | return new JSONObject().toString(); |
| | | } |
| | | |
| | | |
| | | public static JSONObject baseRequest(Map<String, String> param, TaoKeAppInfo app) throws TaoKeApiException { |
| | | Map<String, String> params = new HashMap<>(); |
| | | if (param != null) { |
| | | Iterator<String> its = param.keySet().iterator(); |
| | | while (its.hasNext()) { |
| | | String key = its.next(); |
| | | params.put(key, param.get(key)); |
| | | } |
| | | } |
| | | |
| | | // 获取有效的APPKey |
| | | if (app == null) { |
| | | throw new TaoKeApiException(TaoKeApiException.CODE_NO_USE, "无appkey可用"); |
| | | } |
| | | |
| | | // 签名 |
| | | params.put("app_key", app.getAppKey()); |
| | | params.put("sign_method", "md5"); |
| | | params.put("v", "2.0"); |
| | | params.put("timestamp", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | params.put("format", "json"); |
| | | if (!StringUtil.isNullOrEmpty(app.getAdzoneId())) |
| | | params.put("adzone_id", app.getAdzoneId()); |
| | | params.put("sign", getSign(params, "md5", app).toUpperCase()); |
| | | String result = taoKeGet(params); |
| | | JSONObject data = JSONObject.fromObject(result); |
| | | if (data != null) { |
| | | if (data.optJSONObject("error_response") != null && data.optJSONObject("error_response").optInt("code") == 7 |
| | | && "accesscontrol.limited-by-app-access-count" |
| | | .equalsIgnoreCase(data.optJSONObject("error_response").optString("sub_code"))) { |
| | | reportAppInvalid(app.getAppKey()); |
| | | throw new TaoKeApiException(TaoKeApiException.CODE_APPKEY_LIMIT, "淘宝请求限制:" + result, params); |
| | | } else if (data.optJSONObject("error_response") != null) { |
| | | throw new TaoKeApiException(TaoKeApiException.CODE_API_ERROR, result, params); |
| | | } |
| | | } else |
| | | throw new TaoKeApiException(TaoKeApiException.CODE_OTHER, ":" + result, params); |
| | | reValid(app.getAppKey()); |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * APPKey恢复可用 |
| | | * |
| | | * @param appKey |
| | | */ |
| | | static void reValid(String appKey) { |
| | | if (invalidMap == null) |
| | | return; |
| | | Integer count = invalidMap.get(appKey); |
| | | if (count != null && count > 0) |
| | | invalidMap.put(appKey, count - 1); |
| | | } |
| | | |
| | | /** |
| | | * 报告该APPKey不能用 |
| | | * |
| | | * @param appkey |
| | | */ |
| | | static void reportAppInvalid(String appkey) { |
| | | if (invalidMap == null) |
| | | return; |
| | | // 错误三次后再真正上报 |
| | | if (invalidMap.get(appkey) == null) |
| | | invalidMap.put(appkey, 1); |
| | | else |
| | | invalidMap.put(appkey, invalidMap.get(appkey) + 1); |
| | | |
| | | if (invalidMap.get(appkey) < 4) |
| | | return; |
| | | invalidMap.put(appkey, 0); |
| | | HttpUtil.get("http://193.112.35.168:8091/tb/taoke/reportappcannotuse?appkey=" + appkey); |
| | | lastTime = 0; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取签名参数 |
| | | * |
| | | * @param params |
| | | * @param signMethod |
| | | * @param app |
| | | * @return |
| | | */ |
| | | public static String getSign(Map<String, String> params, String signMethod, TaoKeAppInfo app) { |
| | | // 第一步:检查参数是否已经排序 |
| | | String[] keys = params.keySet().toArray(new String[0]); |
| | | Arrays.sort(keys); |
| | | |
| | | // 第二步:把所有参数名和参数值串在一起 |
| | | StringBuilder query = new StringBuilder(); |
| | | if ("md5".equals(signMethod)) { |
| | | query.append(app.getAppSecret()); |
| | | } |
| | | for (String key : keys) { |
| | | String value = params.get(key); |
| | | if (StringUtils.areNotEmpty(key, value)) { |
| | | query.append(key).append(value); |
| | | } |
| | | } |
| | | |
| | | query.append(app.getAppSecret()); |
| | | return StringUtil.Md5(query.toString()); |
| | | } |
| | | |
| | | |
| | | public static String taoKeGet(Map<String, String> params) { |
| | | String result = get("https://eco.taobao.com/router/rest", params, false); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static String get(String url, Map<String, String> params, boolean proxy) { |
| | | HttpClient client = new HttpClient(); |
| | | try { |
| | | Iterator<String> keys = params.keySet().iterator(); |
| | | url += "?"; |
| | | while (keys.hasNext()) { |
| | | String key = keys.next(); |
| | | url += String.format("%s=%s&", key, URLEncoder.encode(params.get(key), "UTF-8")); |
| | | } |
| | | GetMethod method = new GetMethod(url); |
| | | // 3S的响应超时 |
| | | HttpConnectionManagerParams hparams = new HttpConnectionManagerParams(); |
| | | hparams.setConnectionTimeout(3000); |
| | | client.getHttpConnectionManager().setParams(hparams); |
| | | return method.getResponseBodyAsString(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package java; |
| | | |
| | | import com.ks.lijin.pojo.DO.LiJinProvider; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.generater.mybatis.MyBatisMapperUtil; |
| | | |
| | | public class MyBatisTest { |
| | | |
| | | @Test |
| | | public void test(){ |
| | | MyBatisMapperUtil.createMapper(LiJinProvider.class); |
| | | } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>tejia</artifactId> |
| | | <groupId>com.ks</groupId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>facade-vip</artifactId> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/src/main/libs/lib-common.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/src/main/libs/lib-common.jar</systemPath> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.yeshi</groupId> |
| | | <artifactId>utils</artifactId> |
| | | <version>0.0.2-SNAPSHOT</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/src/main/libs/utils-0.0.2-SNAPSHOT.jar</systemPath> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- https://mvnrepository.com/artifact/dom4j/dom4j --> |
| | | <dependency> |
| | | <groupId>dom4j</groupId> |
| | | <artifactId>dom4j</artifactId> |
| | | <version>1.6.1</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>facade-vip</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | |
| | | </build> |
| | | |
| | | |
| | | </project> |
copy from facade-lijin/src/main/java/com/ks/lijin/exception/LuckyActivityAwardException.java
copy to facade-vip/src/main/java/com/ks/lijin/exception/LuckyActivityAwardMaterialException.java
File was copied from facade-lijin/src/main/java/com/ks/lijin/exception/LuckyActivityAwardException.java |
| | |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LuckyActivityAwardException extends BaseException { |
| | | public class LuckyActivityAwardMaterialException extends BaseException { |
| | | |
| | | public LuckyActivityAwardException(int code, String msg) { |
| | | public LuckyActivityAwardMaterialException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
copy from facade-lijin/src/main/java/com/ks/lijin/exception/LuckyActivityAwardException.java
copy to facade-vip/src/main/java/com/ks/lijin/exception/LuckyActivityAwardResultException.java
File was copied from facade-lijin/src/main/java/com/ks/lijin/exception/LuckyActivityAwardException.java |
| | |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LuckyActivityAwardException extends BaseException { |
| | | public class LuckyActivityAwardResultException extends BaseException { |
| | | |
| | | public LuckyActivityAwardException(int code, String msg) { |
| | | public LuckyActivityAwardResultException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
New file |
| | |
| | | package com.ks.vip.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LiJinException extends BaseException { |
| | | |
| | | public static final int CODE_TLJ_UN_PAID = 100; |
| | | // 商品支持创建红包 |
| | | public static final int CODE_TLJ_FORBIDDEN = 101; |
| | | // 官方账户余额不足 |
| | | public static final int CODE_TLJ_NO_MONEY = 102; |
| | | |
| | | |
| | | public LiJinException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public LiJinException() { |
| | | super(); |
| | | } |
| | | |
| | | |
| | | //屏蔽堆栈信息 |
| | | @Override |
| | | public synchronized Throwable fillInStackTrace() { |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class VipOrderException extends BaseException { |
| | | |
| | | public VipOrderException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public VipOrderException() { |
| | | super(); |
| | | } |
| | | |
| | | @Override |
| | | public synchronized Throwable fillInStackTrace() { |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Table("vip_center") |
| | | @Valid |
| | | public class VipCenter implements Serializable { |
| | | |
| | | @Column(name = "v_uid") |
| | | private String uid; |
| | | |
| | | @Column(name = "v_grade_id") |
| | | private Long gradeId; |
| | | |
| | | @Column(name = "v_start_time") |
| | | private Date startTime; |
| | | |
| | | @Column(name = "v_end_time") |
| | | private Date endTime; |
| | | |
| | | @Column(name = "v_state") |
| | | private Integer state; |
| | | |
| | | @Column(name = "v_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "v_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "v_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "v_update_time") |
| | | private Date updateTime; |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Long getGradeId() { |
| | | return gradeId; |
| | | } |
| | | |
| | | public void setGradeId(Long gradeId) { |
| | | this.gradeId = gradeId; |
| | | } |
| | | |
| | | 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 getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Table("vip_center_record") |
| | | @Valid |
| | | public class VipCenterRecord implements Serializable { |
| | | |
| | | @Column(name = "r_id") |
| | | private Long id; |
| | | |
| | | @Column(name = "r_order_id") |
| | | private Long orderId; |
| | | |
| | | @Column(name = "r_uid") |
| | | private String uid; |
| | | |
| | | @Column(name = "r_grade_id") |
| | | private Long gradeId; |
| | | |
| | | @Column(name = "r_start_time") |
| | | private Date startTime; |
| | | |
| | | @Column(name = "r_end_time") |
| | | private Date endTime; |
| | | |
| | | @Column(name = "r_state") |
| | | private Integer state; |
| | | |
| | | @Column(name = "r_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "r_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "r_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "r_update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Long getGradeId() { |
| | | return gradeId; |
| | | } |
| | | |
| | | public void setGradeId(Long gradeId) { |
| | | this.gradeId = gradeId; |
| | | } |
| | | |
| | | 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 getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Long getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Long orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 会员套餐 |
| | | */ |
| | | @Table("vip_combo") |
| | | @Valid |
| | | public class VipCombo implements Serializable { |
| | | |
| | | @Column(name = "cb_id") |
| | | private Long id; |
| | | |
| | | @Column(name = "cb_grade_id") |
| | | private Long gradeId; |
| | | |
| | | @Column(name = "cb_name") |
| | | private String name; |
| | | |
| | | @Column(name = "cb_icon") |
| | | private String icon; |
| | | |
| | | @Column(name = "cb_original_price") |
| | | private BigDecimal originalPrice; |
| | | |
| | | @Column(name = "cb_discount") |
| | | private BigDecimal discount; |
| | | |
| | | @Column(name = "cb_discount_price") |
| | | private BigDecimal discountPrice; |
| | | |
| | | @Column(name = "cb_valid_days") |
| | | private Integer validDays; |
| | | |
| | | @Column(name = "cb_state") |
| | | private Integer state; |
| | | |
| | | @Column(name = "cb_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "cb_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "cb_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "cb_update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getGradeId() { |
| | | return gradeId; |
| | | } |
| | | |
| | | public void setGradeId(Long gradeId) { |
| | | this.gradeId = gradeId; |
| | | } |
| | | |
| | | 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 BigDecimal getOriginalPrice() { |
| | | return originalPrice; |
| | | } |
| | | |
| | | public void setOriginalPrice(BigDecimal originalPrice) { |
| | | this.originalPrice = originalPrice; |
| | | } |
| | | |
| | | public BigDecimal getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(BigDecimal discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public BigDecimal getDiscountPrice() { |
| | | return discountPrice; |
| | | } |
| | | |
| | | public void setDiscountPrice(BigDecimal discountPrice) { |
| | | this.discountPrice = discountPrice; |
| | | } |
| | | |
| | | public Integer getValidDays() { |
| | | return validDays; |
| | | } |
| | | |
| | | public void setValidDays(Integer validDays) { |
| | | this.validDays = validDays; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Table("vip_grade") |
| | | @Valid |
| | | public class VipGrade implements Serializable { |
| | | |
| | | @Column(name = "g_id") |
| | | private Long id; |
| | | |
| | | @Column(name = "g_name") |
| | | private String name; |
| | | |
| | | @Column(name = "g_icon") |
| | | private String icon; |
| | | |
| | | @Column(name = "g_sort") |
| | | private Integer sort; |
| | | |
| | | @Column(name = "g_state") |
| | | private Integer state; |
| | | |
| | | @Column(name = "g_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "g_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "g_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "g_update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long 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 Integer getSort() { |
| | | return sort; |
| | | } |
| | | |
| | | public void setSort(Integer sort) { |
| | | this.sort = sort; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 会员等级权益 |
| | | */ |
| | | @Table("vip_grade_potence") |
| | | @Valid |
| | | public class VipGradePotence implements Serializable { |
| | | |
| | | @Column(name = "pc_id") |
| | | private Long id; |
| | | |
| | | @Column(name = "pc_grade_id") |
| | | private Long gradeId; |
| | | |
| | | @Column(name = "pc_rebate_percent") |
| | | private BigDecimal rebatePercent; |
| | | |
| | | @Column(name = "pc_taolijin_percent") |
| | | private BigDecimal taolijinPercent; |
| | | |
| | | @Column(name = "pc_taolijin_max_number") |
| | | private String taolijinMaxNumber; |
| | | |
| | | @Column(name = "pc_taolijin_max_money") |
| | | private BigDecimal taolijinMaxMoney; |
| | | |
| | | @Column(name = "pc_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "pc_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "pc_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "pc_update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getGradeId() { |
| | | return gradeId; |
| | | } |
| | | |
| | | public void setGradeId(Long gradeId) { |
| | | this.gradeId = gradeId; |
| | | } |
| | | |
| | | public BigDecimal getRebatePercent() { |
| | | return rebatePercent; |
| | | } |
| | | |
| | | public void setRebatePercent(BigDecimal rebatePercent) { |
| | | this.rebatePercent = rebatePercent; |
| | | } |
| | | |
| | | public BigDecimal getTaolijinPercent() { |
| | | return taolijinPercent; |
| | | } |
| | | |
| | | public void setTaolijinPercent(BigDecimal taolijinPercent) { |
| | | this.taolijinPercent = taolijinPercent; |
| | | } |
| | | |
| | | public String getTaolijinMaxNumber() { |
| | | return taolijinMaxNumber; |
| | | } |
| | | |
| | | public void setTaolijinMaxNumber(String taolijinMaxNumber) { |
| | | this.taolijinMaxNumber = taolijinMaxNumber; |
| | | } |
| | | |
| | | public BigDecimal getTaolijinMaxMoney() { |
| | | return taolijinMaxMoney; |
| | | } |
| | | |
| | | public void setTaolijinMaxMoney(BigDecimal taolijinMaxMoney) { |
| | | this.taolijinMaxMoney = taolijinMaxMoney; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Table("vip_order") |
| | | @Valid |
| | | public class VipOrder implements Serializable { |
| | | |
| | | @Column(name = "o_id") |
| | | private Long id; |
| | | |
| | | @Column(name = "o_type") |
| | | private String type; |
| | | |
| | | @Column(name = "o_combo_id") |
| | | private Long comboId; |
| | | |
| | | @Column(name = "o_uid") |
| | | private String uid; |
| | | |
| | | @Column(name = "o_three_order_id") |
| | | private String threeOrderId; |
| | | |
| | | @Column(name = "o_pay_money") |
| | | private BigDecimal payMoney; |
| | | |
| | | @Column(name = "o_pay_time") |
| | | private Date payTime; |
| | | |
| | | @Column(name = "o_pay_account") |
| | | private String payAccount; |
| | | |
| | | @Column(name = "o_pay_way") |
| | | private String payWay; |
| | | |
| | | @Column(name = "o_end_time") |
| | | private Date endTime; |
| | | |
| | | @Column(name = "o_start_time") |
| | | private Date startTime; |
| | | |
| | | @Column(name = "o_state") |
| | | private Integer state; |
| | | |
| | | @Column(name = "o_creator_id") |
| | | private Long creatorId; |
| | | |
| | | @Column(name = "o_create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "o_updator_id") |
| | | private Long updatorId; |
| | | |
| | | @Column(name = "o_update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Long getComboId() { |
| | | return comboId; |
| | | } |
| | | |
| | | public void setComboId(Long comboId) { |
| | | this.comboId = comboId; |
| | | } |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getThreeOrderId() { |
| | | return threeOrderId; |
| | | } |
| | | |
| | | public void setThreeOrderId(String threeOrderId) { |
| | | this.threeOrderId = threeOrderId; |
| | | } |
| | | |
| | | public BigDecimal getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(BigDecimal payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Date getPayTime() { |
| | | return payTime; |
| | | } |
| | | |
| | | public void setPayTime(Date payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public String getPayAccount() { |
| | | return payAccount; |
| | | } |
| | | |
| | | public void setPayAccount(String payAccount) { |
| | | this.payAccount = payAccount; |
| | | } |
| | | |
| | | public String getPayWay() { |
| | | return payWay; |
| | | } |
| | | |
| | | public void setPayWay(String payWay) { |
| | | this.payWay = payWay; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Long getCreatorId() { |
| | | return creatorId; |
| | | } |
| | | |
| | | public void setCreatorId(Long creatorId) { |
| | | this.creatorId = creatorId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Long getUpdatorId() { |
| | | return updatorId; |
| | | } |
| | | |
| | | public void setUpdatorId(Long updatorId) { |
| | | this.updatorId = updatorId; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DTO; |
| | | |
| | | import com.ks.vip.pojo.Enums.PayWayEnum; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | public class VipOrderDTO { |
| | | |
| | | private Long comboId; |
| | | |
| | | private String uid; |
| | | |
| | | private String threeOrderId; |
| | | |
| | | private BigDecimal payMoney; |
| | | |
| | | private Date payTime; |
| | | |
| | | private String payAccount; |
| | | |
| | | private PayWayEnum payWay; |
| | | |
| | | |
| | | public Long getComboId() { |
| | | return comboId; |
| | | } |
| | | |
| | | public void setComboId(Long comboId) { |
| | | this.comboId = comboId; |
| | | } |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getThreeOrderId() { |
| | | return threeOrderId; |
| | | } |
| | | |
| | | public void setThreeOrderId(String threeOrderId) { |
| | | this.threeOrderId = threeOrderId; |
| | | } |
| | | |
| | | public BigDecimal getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(BigDecimal payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Date getPayTime() { |
| | | return payTime; |
| | | } |
| | | |
| | | public void setPayTime(Date payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public String getPayAccount() { |
| | | return payAccount; |
| | | } |
| | | |
| | | public void setPayAccount(String payAccount) { |
| | | this.payAccount = payAccount; |
| | | } |
| | | |
| | | public PayWayEnum getPayWay() { |
| | | return payWay; |
| | | } |
| | | |
| | | public void setPayWay(PayWayEnum payWay) { |
| | | this.payWay = payWay; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.lijin.pojo.DTO.mq; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class BaseMQMsg implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String cmqMsgTag; |
| | | |
| | | public String getCmqMsgTag() { |
| | | return cmqMsgTag; |
| | | } |
| | | |
| | | public void setCmqMsgTag(String cmqMsgTag) { |
| | | this.cmqMsgTag = cmqMsgTag; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.Enums; |
| | | |
| | | |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | public enum OrderTypeEnum { |
| | | |
| | | buy("购买会员"), |
| | | watchVideo("观看视频兑换"); |
| | | |
| | | private final String desc; |
| | | |
| | | private OrderTypeEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.Enums; |
| | | |
| | | |
| | | /** |
| | | * 支付方式 |
| | | */ |
| | | public enum PayWayEnum { |
| | | |
| | | alipay("支付宝"), |
| | | weChat("微信"); |
| | | |
| | | private final String desc; |
| | | |
| | | private PayWayEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.lijin.query; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class BaseDaoQuery { |
| | | |
| | | public long start; |
| | | public int count; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | public List<String> sortList; |
| | | |
| | | /** |
| | | * 查询的关键词 |
| | | */ |
| | | public String key; |
| | | } |
New file |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.pojo.DO.VipCenterRecord; |
| | | |
| | | public interface VipCenterRecordService { |
| | | |
| | | public void insertSelective(VipCenterRecord t); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipCenterService { |
| | | |
| | | public long count(VipCenter t); |
| | | |
| | | public List<VipCenter> listByPage(int page, int pageSize, VipCenter t); |
| | | |
| | | public void insertSelective(VipCenter t); |
| | | |
| | | public void updateByPrimaryKeySelective(VipCenter t); |
| | | |
| | | public VipCenter getByUid(String id); |
| | | |
| | | public void deteleByUid(String id); |
| | | |
| | | public void saveVipCenter(String uid, Long gradeId, Integer validDays, Long orderId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipComboService { |
| | | |
| | | public long count(VipCombo t); |
| | | |
| | | public List<VipCombo> listByPage(int page, int pageSize, VipCombo t); |
| | | |
| | | public void insertSelective(VipCombo t); |
| | | |
| | | public void updateByPrimaryKeySelective(VipCombo t); |
| | | |
| | | public VipCombo selectByPrimaryKey(Long id); |
| | | |
| | | public void delete(Long id); |
| | | } |
New file |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipGradeService { |
| | | |
| | | public long count(VipGrade t); |
| | | |
| | | public List<VipGrade> listByPage(int page, int pageSize, VipGrade t); |
| | | |
| | | public void insertSelective(VipGrade t); |
| | | |
| | | public void updateByPrimaryKeySelective(VipGrade t); |
| | | |
| | | public void delete(Long id); |
| | | |
| | | public List<VipGrade> getValidList(); |
| | | } |
New file |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.pojo.DO.VipOrder; |
| | | import com.ks.vip.pojo.DTO.VipOrderDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipOrederService { |
| | | |
| | | public long count(VipOrder t); |
| | | |
| | | public List<VipOrder> listByPage(int page, int pageSize, VipOrder t); |
| | | |
| | | public void insertSelective(VipOrder t); |
| | | |
| | | public void updateByPrimaryKeySelective(VipOrder t); |
| | | |
| | | public void delete(Long id); |
| | | |
| | | |
| | | public void addOrderByBuy(VipOrderDTO t) throws VipOrderException; |
| | | |
| | | public void addOrderByWatchVideo(String uid, Long gradeId, Integer validDays) throws VipOrderException; |
| | | |
| | | } |
New file |
| | |
| | | package cccc.com.ks; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | import java.util.*; |
| | | |
| | | public class LuckyTest { |
| | | |
| | | |
| | | @Test |
| | | public void test() { |
| | | Map<Long, Integer> map = new HashMap<>(); |
| | | int total = 0; |
| | | int personCount = 1000000; |
| | | for (int i = 0; i < personCount; i++) { |
| | | map.put(10000L + i, i == 0 ? 0 : (int) (1 + 10 * Math.random())); |
| | | total += map.get(10000L + i); |
| | | } |
| | | Set<Long> sets = choujiang(map, 100); |
| | | int percent = total / personCount; |
| | | int upCount = 0; |
| | | for (Long uid : sets) { |
| | | if (map.get(uid) > percent) |
| | | upCount += 1; |
| | | System.out.println(uid + "-" + map.get(uid) + "是否大于均值:" + (map.get(uid) > percent)); |
| | | } |
| | | System.out.println("大于均值数量:" + upCount); |
| | | System.out.println("数量:" + sets.size()); |
| | | } |
| | | |
| | | private Set<Long> choujiang(Map<Long, Integer> map, int number) { |
| | | |
| | | List<Long> mList = new ArrayList<>(); |
| | | for (Iterator<Long> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | Long uid = its.next(); |
| | | int c = map.get(uid); |
| | | for (int i = 0; i < c; i++) { |
| | | mList.add(uid); |
| | | } |
| | | } |
| | | |
| | | Set<Long> luckyUids = new HashSet<>(); |
| | | for (int i = 0; i < number; i++) { |
| | | if(mList.size()==0) |
| | | break; |
| | | long startTime = System.currentTimeMillis(); |
| | | int p = (int) (mList.size() * Math.random()); |
| | | long uid = mList.get(p); |
| | | luckyUids.add(uid); |
| | | |
| | | //移除列表右面的相同uid |
| | | while (mList.size() > p && mList.get(p) == uid) { |
| | | mList.remove(p); |
| | | } |
| | | |
| | | //查询相同uid的列表左侧起点 |
| | | for (int j = p - 1; j >= 0; j--) { |
| | | if (mList.get(j).longValue() != uid) { |
| | | p = j + 1; |
| | | break; |
| | | } else if (j == 0) { |
| | | p = 0; |
| | | } |
| | | } |
| | | |
| | | //删除左侧相同uid |
| | | while (mList.size() > p && mList.get(p) == uid) { |
| | | mList.remove(p); |
| | | } |
| | | |
| | | System.out.println("运行时间:" + (System.currentTimeMillis() - startTime)); |
| | | } |
| | | |
| | | |
| | | System.out.println(luckyUids); |
| | | return luckyUids; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package cccc.com.ks; |
| | | |
| | | import com.ks.vip.pojo.DO.VipOrder; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.generater.mybatis.MyBatisMapperUtil; |
| | | |
| | | public class MyBatisTest22 { |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | MyBatisMapperUtil.createMapper(VipOrder.class); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <modules> |
| | | <module>facade-lijin</module> |
| | | <module>service-lijin</module> |
| | | <module>facade-vip</module> |
| | | <module>service-vip</module> |
| | | <module>app</module> |
| | | </modules> |
| | | <parent> |
| | |
| | | package com.ks.lijin.service.remote; |
| | | |
| | | import com.ks.lijin.exception.LiJinException; |
| | | import com.ks.lijin.exception.LiJinExpendRecordException; |
| | | import com.ks.lijin.exception.TaoKeApiException; |
| | | import com.ks.lijin.mapper.LiJinExpendRecordMapper; |
| | | import com.ks.lijin.pojo.DO.LiJinExpendRecord; |
| | | import com.ks.lijin.pojo.DTO.LiJinCreateParam; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoBaoGoodsBrief; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoKeAppInfo; |
| | | import com.ks.lijin.pojo.DTO.taobao.TaoLiJinDTO; |
| | | import com.ks.lijin.query.ExpendRecordQuery; |
| | | import com.ks.lijin.service.LiJinExpendRecordService; |
| | | import com.ks.lijin.utils.taobao.TaoKeApiUtil; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | | public class LiJinExpendRecordServiceImpl implements LiJinExpendRecordService { |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | @Resource |
| | | private LiJinExpendRecordMapper liJinExpendRecordMapper; |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public LiJinExpendRecord createLiJin(Long uid, BigDecimal money, TaoBaoGoodsBrief goods) |
| | | throws LiJinExpendRecordException { |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date_str = format.format(date); |
| | | String sendEndTime_str = date_str + " 22:00:00"; |
| | | String useEndTime_str = date_str + " 23:59:59"; |
| | | |
| | | /* 创建淘礼金 */ |
| | | String name = "自购淘礼金红包"; |
| | | // 发放开始时间 |
| | | Date sendStartTime = date; |
| | | // 发放截止时间 - 分享当日22:00 |
| | | Date sendEndTime = null; |
| | | // 使用结束日期 - 分享当日 23:59 |
| | | Date useEndTime = null; |
| | | |
| | | try { |
| | | sendEndTime = formatStr.parse(sendEndTime_str); |
| | | useEndTime = formatStr.parse(useEndTime_str); |
| | | } catch (ParseException e2) { |
| | | e2.printStackTrace(); |
| | | } |
| | | |
| | | LiJinCreateParam params = new LiJinCreateParam(); |
| | | params.setTitle("自购淘礼金红包"); |
| | | params.setUid(uid + ""); |
| | | params.setGoodsId(goods.getAuctionId()); |
| | | params.setUseEndTime(useEndTime); |
| | | params.setSendStartTime(sendStartTime); |
| | | params.setSendEndTime(sendEndTime); |
| | | params.setNum(1); |
| | | params.setMoney(money); |
| | | // params.setPid(); // pid缺少 TODO |
| | | |
| | | return createTaoLiJin(params); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public LiJinExpendRecord createTaoLiJin(LiJinCreateParam params) throws LiJinExpendRecordException { |
| | | |
| | | String appkey = ""; |
| | | String appsecret = ""; |
| | | |
| | | // 总金额 |
| | | //BigDecimal totalMoney = BigDecimalUtil.mul(params.getMoney(), new BigDecimal(params.getNum())); |
| | | |
| | | // 创建淘礼金红包 |
| | | TaoLiJinDTO taoLiJinDTO = null; |
| | | try { |
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(params.getGoodsId(), params.getTitle(), params.getMoney(), |
| | | params.getNum(), params.getSendStartTime(), params.getSendEndTime(), |
| | | params.getUseStartTime(), params.getUseEndTime(), new TaoKeAppInfo(appkey, appsecret, params.getPid())); |
| | | } catch (LiJinException e) { |
| | | // 通知相应供应商 TODO |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (e.getCode() == LiJinException.CODE_TLJ_FORBIDDEN) { |
| | | // 该商品不支持创建淘礼金红包 |
| | | } else if (e.getCode() == LiJinException.CODE_TLJ_NO_MONEY) { |
| | | // 官方玩法钱包余额不足 |
| | | } else if (e.getCode() == LiJinException.CODE_TLJ_UN_PAID) { |
| | | // 未创建账户 |
| | | } |
| | | } |
| | | }); |
| | | } catch (TaoKeApiException e1) { |
| | | // TODO |
| | | } |
| | | |
| | | if (taoLiJinDTO == null) { |
| | | throw new LiJinExpendRecordException(101, "淘宝API推广红包创建失败"); |
| | | } |
| | | |
| | | // 保存记录 |
| | | LiJinExpendRecord record = new LiJinExpendRecord(); |
| | | record.setUid(params.getUid()); |
| | | record.setGoodsId(params.getGoodsId() + ""); |
| | | record.setTitle(params.getTitle()); |
| | | record.setNum(params.getNum()); |
| | | record.setMoney(params.getMoney()); |
| | | record.setRightsId(taoLiJinDTO.getRightsId()); |
| | | record.setSendUrl(taoLiJinDTO.getSendUrl()); |
| | | record.setCreateTime(new Date()); |
| | | liJinExpendRecordMapper.insertSelective(record); |
| | | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 更新对应 限制次数和金额 |
| | | } |
| | | }); |
| | | return record; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void save(LiJinProviderAccount t) { |
| | | if(t.getId() != null) { |
| | | t.setUpdateTime(new Date()); |
| | | liJinProviderAccountMapper.updateByPrimaryKeySelective(t); |
| | | } else { |
| | | t.setCreateTime(new Date()); |
| | | public void insertSelective(LiJinProviderAccount t){ |
| | | liJinProviderAccountMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(LiJinProviderAccount t){ |
| | | liJinProviderAccountMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | liJinProviderAccountMapper.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return liJinProviderLinkMapper.listByPage(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void save(LiJinProviderLink t) { |
| | | if(t.getId() != null) { |
| | | t.setUpdateTime(new Date()); |
| | | liJinProviderLinkMapper.updateByPrimaryKeySelective(t); |
| | | } else { |
| | | t.setCreateTime(new Date()); |
| | | public void insertSelective(LiJinProviderLink t){ |
| | | liJinProviderLinkMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(LiJinProviderLink t){ |
| | | liJinProviderLinkMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | #!/bin/sh |
| | | # ---------------------------------------------------------------------------- |
| | | # Licensed to the Apache Software Foundation (ASF) under one |
| | | # or more contributor license agreements. See the NOTICE file |
| | | # distributed with this work for additional information |
| | | # regarding copyright ownership. The ASF licenses this file |
| | | # to you under the Apache License, Version 2.0 (the |
| | | # "License"); you may not use this file except in compliance |
| | | # with the License. You may obtain a copy of the License at |
| | | # |
| | | # https://www.apache.org/licenses/LICENSE-2.0 |
| | | # |
| | | # Unless required by applicable law or agreed to in writing, |
| | | # software distributed under the License is distributed on an |
| | | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | # KIND, either express or implied. See the License for the |
| | | # specific language governing permissions and limitations |
| | | # under the License. |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | # ---------------------------------------------------------------------------- |
| | | # Maven Start Up Batch script |
| | | # |
| | | # Required ENV vars: |
| | | # ------------------ |
| | | # JAVA_HOME - location of a JDK home dir |
| | | # |
| | | # Optional ENV vars |
| | | # ----------------- |
| | | # M2_HOME - location of maven2's installed home dir |
| | | # MAVEN_OPTS - parameters passed to the Java VM when running Maven |
| | | # e.g. to debug Maven itself, use |
| | | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
| | | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
| | | # ---------------------------------------------------------------------------- |
| | | |
| | | if [ -z "$MAVEN_SKIP_RC" ] ; then |
| | | |
| | | if [ -f /etc/mavenrc ] ; then |
| | | . /etc/mavenrc |
| | | fi |
| | | |
| | | if [ -f "$HOME/.mavenrc" ] ; then |
| | | . "$HOME/.mavenrc" |
| | | fi |
| | | |
| | | fi |
| | | |
| | | # OS specific support. $var _must_ be set to either true or false. |
| | | cygwin=false; |
| | | darwin=false; |
| | | mingw=false |
| | | case "`uname`" in |
| | | CYGWIN*) cygwin=true ;; |
| | | MINGW*) mingw=true;; |
| | | Darwin*) darwin=true |
| | | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
| | | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
| | | if [ -z "$JAVA_HOME" ]; then |
| | | if [ -x "/usr/libexec/java_home" ]; then |
| | | export JAVA_HOME="`/usr/libexec/java_home`" |
| | | else |
| | | export JAVA_HOME="/Library/Java/Home" |
| | | fi |
| | | fi |
| | | ;; |
| | | esac |
| | | |
| | | if [ -z "$JAVA_HOME" ] ; then |
| | | if [ -r /etc/gentoo-release ] ; then |
| | | JAVA_HOME=`java-config --jre-home` |
| | | fi |
| | | fi |
| | | |
| | | if [ -z "$M2_HOME" ] ; then |
| | | ## resolve links - $0 may be a link to maven's home |
| | | PRG="$0" |
| | | |
| | | # need this for relative symlinks |
| | | while [ -h "$PRG" ] ; do |
| | | ls=`ls -ld "$PRG"` |
| | | link=`expr "$ls" : '.*-> \(.*\)$'` |
| | | if expr "$link" : '/.*' > /dev/null; then |
| | | PRG="$link" |
| | | else |
| | | PRG="`dirname "$PRG"`/$link" |
| | | fi |
| | | done |
| | | |
| | | saveddir=`pwd` |
| | | |
| | | M2_HOME=`dirname "$PRG"`/.. |
| | | |
| | | # make it fully qualified |
| | | M2_HOME=`cd "$M2_HOME" && pwd` |
| | | |
| | | cd "$saveddir" |
| | | # echo Using m2 at $M2_HOME |
| | | fi |
| | | |
| | | # For Cygwin, ensure paths are in UNIX format before anything is touched |
| | | if $cygwin ; then |
| | | [ -n "$M2_HOME" ] && |
| | | M2_HOME=`cygpath --unix "$M2_HOME"` |
| | | [ -n "$JAVA_HOME" ] && |
| | | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
| | | [ -n "$CLASSPATH" ] && |
| | | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
| | | fi |
| | | |
| | | # For Mingw, ensure paths are in UNIX format before anything is touched |
| | | if $mingw ; then |
| | | [ -n "$M2_HOME" ] && |
| | | M2_HOME="`(cd "$M2_HOME"; pwd)`" |
| | | [ -n "$JAVA_HOME" ] && |
| | | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" |
| | | fi |
| | | |
| | | if [ -z "$JAVA_HOME" ]; then |
| | | javaExecutable="`which javac`" |
| | | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then |
| | | # readlink(1) is not available as standard on Solaris 10. |
| | | readLink=`which readlink` |
| | | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then |
| | | if $darwin ; then |
| | | javaHome="`dirname \"$javaExecutable\"`" |
| | | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" |
| | | else |
| | | javaExecutable="`readlink -f \"$javaExecutable\"`" |
| | | fi |
| | | javaHome="`dirname \"$javaExecutable\"`" |
| | | javaHome=`expr "$javaHome" : '\(.*\)/bin'` |
| | | JAVA_HOME="$javaHome" |
| | | export JAVA_HOME |
| | | fi |
| | | fi |
| | | fi |
| | | |
| | | if [ -z "$JAVACMD" ] ; then |
| | | if [ -n "$JAVA_HOME" ] ; then |
| | | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
| | | # IBM's JDK on AIX uses strange locations for the executables |
| | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | | else |
| | | JAVACMD="$JAVA_HOME/bin/java" |
| | | fi |
| | | else |
| | | JAVACMD="`which java`" |
| | | fi |
| | | fi |
| | | |
| | | if [ ! -x "$JAVACMD" ] ; then |
| | | echo "Error: JAVA_HOME is not defined correctly." >&2 |
| | | echo " We cannot execute $JAVACMD" >&2 |
| | | exit 1 |
| | | fi |
| | | |
| | | if [ -z "$JAVA_HOME" ] ; then |
| | | echo "Warning: JAVA_HOME environment variable is not set." |
| | | fi |
| | | |
| | | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher |
| | | |
| | | # traverses directory structure from process work directory to filesystem root |
| | | # first directory with .mvn subdirectory is considered project base directory |
| | | find_maven_basedir() { |
| | | |
| | | if [ -z "$1" ] |
| | | then |
| | | echo "Path not specified to find_maven_basedir" |
| | | return 1 |
| | | fi |
| | | |
| | | basedir="$1" |
| | | wdir="$1" |
| | | while [ "$wdir" != '/' ] ; do |
| | | if [ -d "$wdir"/.mvn ] ; then |
| | | basedir=$wdir |
| | | break |
| | | fi |
| | | # workaround for JBEAP-8937 (on Solaris 10/Sparc) |
| | | if [ -d "${wdir}" ]; then |
| | | wdir=`cd "$wdir/.."; pwd` |
| | | fi |
| | | # end of workaround |
| | | done |
| | | echo "${basedir}" |
| | | } |
| | | |
| | | # concatenates all lines of a file |
| | | concat_lines() { |
| | | if [ -f "$1" ]; then |
| | | echo "$(tr -s '\n' ' ' < "$1")" |
| | | fi |
| | | } |
| | | |
| | | BASE_DIR=`find_maven_basedir "$(pwd)"` |
| | | if [ -z "$BASE_DIR" ]; then |
| | | exit 1; |
| | | fi |
| | | |
| | | ########################################################################################## |
| | | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
| | | # This allows using the maven wrapper in projects that prohibit checking in binary data. |
| | | ########################################################################################## |
| | | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Found .mvn/wrapper/maven-wrapper.jar" |
| | | fi |
| | | else |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." |
| | | fi |
| | | if [ -n "$MVNW_REPOURL" ]; then |
| | | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
| | | else |
| | | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
| | | fi |
| | | while IFS="=" read key value; do |
| | | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; |
| | | esac |
| | | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Downloading from: $jarUrl" |
| | | fi |
| | | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" |
| | | if $cygwin; then |
| | | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` |
| | | fi |
| | | |
| | | if command -v wget > /dev/null; then |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Found wget ... using wget" |
| | | fi |
| | | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
| | | wget "$jarUrl" -O "$wrapperJarPath" |
| | | else |
| | | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" |
| | | fi |
| | | elif command -v curl > /dev/null; then |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Found curl ... using curl" |
| | | fi |
| | | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
| | | curl -o "$wrapperJarPath" "$jarUrl" -f |
| | | else |
| | | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f |
| | | fi |
| | | |
| | | else |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo "Falling back to using Java to download" |
| | | fi |
| | | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" |
| | | # For Cygwin, switch paths to Windows format before running javac |
| | | if $cygwin; then |
| | | javaClass=`cygpath --path --windows "$javaClass"` |
| | | fi |
| | | if [ -e "$javaClass" ]; then |
| | | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo " - Compiling MavenWrapperDownloader.java ..." |
| | | fi |
| | | # Compiling the Java class |
| | | ("$JAVA_HOME/bin/javac" "$javaClass") |
| | | fi |
| | | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
| | | # Running the downloader |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo " - Running MavenWrapperDownloader.java ..." |
| | | fi |
| | | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") |
| | | fi |
| | | fi |
| | | fi |
| | | fi |
| | | ########################################################################################## |
| | | # End of extension |
| | | ########################################################################################## |
| | | |
| | | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} |
| | | if [ "$MVNW_VERBOSE" = true ]; then |
| | | echo $MAVEN_PROJECTBASEDIR |
| | | fi |
| | | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
| | | |
| | | # For Cygwin, switch paths to Windows format before running java |
| | | if $cygwin; then |
| | | [ -n "$M2_HOME" ] && |
| | | M2_HOME=`cygpath --path --windows "$M2_HOME"` |
| | | [ -n "$JAVA_HOME" ] && |
| | | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` |
| | | [ -n "$CLASSPATH" ] && |
| | | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` |
| | | [ -n "$MAVEN_PROJECTBASEDIR" ] && |
| | | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` |
| | | fi |
| | | |
| | | # Provide a "standardized" way to retrieve the CLI args that will |
| | | # work with both Windows and non-Windows executions. |
| | | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" |
| | | export MAVEN_CMD_LINE_ARGS |
| | | |
| | | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
| | | |
| | | exec "$JAVACMD" \ |
| | | $MAVEN_OPTS \ |
| | | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
| | | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
| | | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
New file |
| | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Licensed to the Apache Software Foundation (ASF) under one |
| | | @REM or more contributor license agreements. See the NOTICE file |
| | | @REM distributed with this work for additional information |
| | | @REM regarding copyright ownership. The ASF licenses this file |
| | | @REM to you under the Apache License, Version 2.0 (the |
| | | @REM "License"); you may not use this file except in compliance |
| | | @REM with the License. You may obtain a copy of the License at |
| | | @REM |
| | | @REM https://www.apache.org/licenses/LICENSE-2.0 |
| | | @REM |
| | | @REM Unless required by applicable law or agreed to in writing, |
| | | @REM software distributed under the License is distributed on an |
| | | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | @REM KIND, either express or implied. See the License for the |
| | | @REM specific language governing permissions and limitations |
| | | @REM under the License. |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM ---------------------------------------------------------------------------- |
| | | @REM Maven Start Up Batch script |
| | | @REM |
| | | @REM Required ENV vars: |
| | | @REM JAVA_HOME - location of a JDK home dir |
| | | @REM |
| | | @REM Optional ENV vars |
| | | @REM M2_HOME - location of maven2's installed home dir |
| | | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
| | | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
| | | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
| | | @REM e.g. to debug Maven itself, use |
| | | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
| | | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
| | | @REM ---------------------------------------------------------------------------- |
| | | |
| | | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
| | | @echo off |
| | | @REM set title of command window |
| | | title %0 |
| | | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
| | | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
| | | |
| | | @REM set %HOME% to equivalent of $HOME |
| | | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
| | | |
| | | @REM Execute a user defined script before this one |
| | | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
| | | @REM check for pre script, once with legacy .bat ending and once with .cmd ending |
| | | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" |
| | | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" |
| | | :skipRcPre |
| | | |
| | | @setlocal |
| | | |
| | | set ERROR_CODE=0 |
| | | |
| | | @REM To isolate internal variables from possible post scripts, we use another setlocal |
| | | @setlocal |
| | | |
| | | @REM ==== START VALIDATION ==== |
| | | if not "%JAVA_HOME%" == "" goto OkJHome |
| | | |
| | | echo. |
| | | echo Error: JAVA_HOME not found in your environment. >&2 |
| | | echo Please set the JAVA_HOME variable in your environment to match the >&2 |
| | | echo location of your Java installation. >&2 |
| | | echo. |
| | | goto error |
| | | |
| | | :OkJHome |
| | | if exist "%JAVA_HOME%\bin\java.exe" goto init |
| | | |
| | | echo. |
| | | echo Error: JAVA_HOME is set to an invalid directory. >&2 |
| | | echo JAVA_HOME = "%JAVA_HOME%" >&2 |
| | | echo Please set the JAVA_HOME variable in your environment to match the >&2 |
| | | echo location of your Java installation. >&2 |
| | | echo. |
| | | goto error |
| | | |
| | | @REM ==== END VALIDATION ==== |
| | | |
| | | :init |
| | | |
| | | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
| | | @REM Fallback to current working directory if not found. |
| | | |
| | | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
| | | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
| | | |
| | | set EXEC_DIR=%CD% |
| | | set WDIR=%EXEC_DIR% |
| | | :findBaseDir |
| | | IF EXIST "%WDIR%"\.mvn goto baseDirFound |
| | | cd .. |
| | | IF "%WDIR%"=="%CD%" goto baseDirNotFound |
| | | set WDIR=%CD% |
| | | goto findBaseDir |
| | | |
| | | :baseDirFound |
| | | set MAVEN_PROJECTBASEDIR=%WDIR% |
| | | cd "%EXEC_DIR%" |
| | | goto endDetectBaseDir |
| | | |
| | | :baseDirNotFound |
| | | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
| | | cd "%EXEC_DIR%" |
| | | |
| | | :endDetectBaseDir |
| | | |
| | | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
| | | |
| | | @setlocal EnableExtensions EnableDelayedExpansion |
| | | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
| | | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
| | | |
| | | :endReadAdditionalConfig |
| | | |
| | | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
| | | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
| | | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
| | | |
| | | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
| | | |
| | | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
| | | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
| | | ) |
| | | |
| | | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
| | | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
| | | if exist %WRAPPER_JAR% ( |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Found %WRAPPER_JAR% |
| | | ) |
| | | ) else ( |
| | | if not "%MVNW_REPOURL%" == "" ( |
| | | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
| | | ) |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Couldn't find %WRAPPER_JAR%, downloading it ... |
| | | echo Downloading from: %DOWNLOAD_URL% |
| | | ) |
| | | |
| | | powershell -Command "&{"^ |
| | | "$webclient = new-object System.Net.WebClient;"^ |
| | | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
| | | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
| | | "}"^ |
| | | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
| | | "}" |
| | | if "%MVNW_VERBOSE%" == "true" ( |
| | | echo Finished downloading %WRAPPER_JAR% |
| | | ) |
| | | ) |
| | | @REM End of extension |
| | | |
| | | @REM Provide a "standardized" way to retrieve the CLI args that will |
| | | @REM work with both Windows and non-Windows executions. |
| | | set MAVEN_CMD_LINE_ARGS=%* |
| | | |
| | | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
| | | if ERRORLEVEL 1 goto error |
| | | goto end |
| | | |
| | | :error |
| | | set ERROR_CODE=1 |
| | | |
| | | :end |
| | | @endlocal & set ERROR_CODE=%ERROR_CODE% |
| | | |
| | | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost |
| | | @REM check for post script, once with legacy .bat ending and once with .cmd ending |
| | | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" |
| | | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" |
| | | :skipRcPost |
| | | |
| | | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
| | | if "%MAVEN_BATCH_PAUSE%" == "on" pause |
| | | |
| | | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% |
| | | |
| | | exit /B %ERROR_CODE% |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <artifactId>tejia</artifactId> |
| | | <groupId>com.ks</groupId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | |
| | | |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>service-vip</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>service-vip</name> |
| | | <description>会员服务</description> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <java.version>1.8</java.version> |
| | | <druid.version>1.1.10</druid.version> |
| | | <mybatis.version>2.0.1</mybatis.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-vip</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!-- <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-app</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-config</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-web</artifactId> |
| | | </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-tomcat</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-tomcat</artifactId> |
| | | <!--打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。 |
| | | 相当于compile,但是打包阶段做了exclude操作--> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.junit.vintage</groupId> |
| | | <artifactId>junit-vintage-engine</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.vaadin.external.google</groupId> |
| | | <artifactId>android-json</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- Mybatis --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>${druid.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.mybatis.spring.boot</groupId> |
| | | <artifactId>mybatis-spring-boot-starter</artifactId> |
| | | <version>${mybatis.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/com.github.penggle/kaptcha --> |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | <version>2.3.2</version> |
| | | </dependency> |
| | | |
| | | <!-- 分步式任务 --> |
| | | <dependency> |
| | | <groupId>com.xuxueli</groupId> |
| | | <artifactId>xxl-job-core</artifactId> |
| | | <version>2.1.2</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--全局排除log4j --> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>*</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.qcloud</groupId> |
| | | <artifactId>cmq-http-client</artifactId> |
| | | <version>1.0.7</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>log4j</groupId> |
| | | <artifactId>log4j</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!--devtools热部署--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-devtools</artifactId>--> |
| | | <!--<optional>true</optional>--> |
| | | <!--<scope>true</scope>--> |
| | | <!--</dependency>--> |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-vip</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!--<dependency>--> |
| | | <!--<groupId>log4j</groupId>--> |
| | | <!--<artifactId>log4j</artifactId>--> |
| | | <!--<exclusions>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>*</groupId>--> |
| | | <!--<artifactId>*</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--</exclusions>--> |
| | | <!--</dependency>--> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>service-vip</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ks.vip; |
| | | |
| | | import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | @SpringBootApplication |
| | | @EnableTransactionManagement |
| | | @MapperScan(basePackages = "com.ks.vip.mapper") |
| | | @EnableDubbo(scanBasePackages = "com.ks.vip.service.remote") |
| | | public class VIPApplication extends SpringBootServletInitializer { |
| | | private final static Logger logger = LoggerFactory.getLogger(VIPApplication.class); |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(VIPApplication.class, args); |
| | | logger.info("应用启动成功"); |
| | | } |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(VIPApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class LiJinMQException extends BaseException { |
| | | |
| | | |
| | | public LiJinMQException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.job; |
| | | |
| | | //import com.ks.lijin.service.LuckyMQService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class MQJob { |
| | | |
| | | // @Resource |
| | | // private LuckyMQService luckyMQService; |
| | | |
| | | |
| | | // @XxlJob("mqjob-sendmq") |
| | | // public ReturnT<String> sendMQ(String param) throws Exception { |
| | | // Date now = new Date(); |
| | | // List<LuckyMQ> mqList = luckyMQService.listUnSendMsg(now, 1, 1000); |
| | | // if (mqList != null) { |
| | | // for (LuckyMQ mq : mqList) { |
| | | // luckyMQService.sendMsg(mq.getTaskId()); |
| | | // } |
| | | // } |
| | | // return ReturnT.SUCCESS; |
| | | // } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipOrder; |
| | | import com.ks.vip.query.VipCenterQuery; |
| | | import com.ks.vip.query.VipOrderQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipCenterMapper extends BaseMapper<VipCenter> { |
| | | |
| | | VipCenter getByUid(@Param("uid") String uid); |
| | | |
| | | void deteleByUid(@Param("uid") String uid); |
| | | |
| | | VipCenter selectForUpdate(@Param("uid") String uid); |
| | | |
| | | List<VipCenter> listByPage(@Param("query") VipCenterQuery query); |
| | | |
| | | long count(@Param("query")VipCenterQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipCenterRecord; |
| | | |
| | | public interface VipCenterRecordMapper extends BaseMapper<VipCenterRecord> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.query.VipComboQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipComboMapper extends BaseMapper<VipCombo> { |
| | | |
| | | List<VipCombo> listByPage(@Param("query") VipComboQuery query); |
| | | |
| | | long count(@Param("query")VipComboQuery query); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | import com.ks.vip.query.VipGradeQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipGradeMapper extends BaseMapper<VipGrade> { |
| | | |
| | | |
| | | List<VipGrade> listByPage(@Param("query") VipGradeQuery query); |
| | | |
| | | long count(@Param("query")VipGradeQuery query); |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipGradePotence; |
| | | |
| | | public interface VipGradePotenceMapper extends BaseMapper<VipGradePotence> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.mapper; |
| | | |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import com.ks.vip.pojo.DO.VipOrder; |
| | | import com.ks.vip.query.VipOrderQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface VipOrderMapper extends BaseMapper<VipOrder> { |
| | | |
| | | List<VipOrder> listByPage(@Param("query") VipOrderQuery query); |
| | | |
| | | long count(@Param("query")VipOrderQuery query); |
| | | |
| | | /** |
| | | * 根据三方订单号查询 |
| | | * @param threeOrderId |
| | | * @return |
| | | */ |
| | | VipOrder getByThreeOrderId(@Param("threeOrderId") String threeOrderId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | @Valid |
| | | public class LiJinMQ { |
| | | //未发送 |
| | | public final static int STATE_NOT_SEND = 0; |
| | | //已发送 |
| | | public final static int STATE_SENDED = 1; |
| | | |
| | | |
| | | private Long id; |
| | | |
| | | @NotEmpty(message = "任务ID不能为空") |
| | | private String taskId; |
| | | |
| | | |
| | | private String taskName; |
| | | |
| | | private Integer state; |
| | | |
| | | @NotEmpty(message = "队列名称不能为空") |
| | | private String queueName; |
| | | |
| | | @NotEmpty(message = "队列内容不能为空") |
| | | private String queueContent; |
| | | |
| | | @NotNull(message = "预计发送时间不能为空") |
| | | private Date preSendTime; |
| | | |
| | | private Date actualSendTime; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTaskId() { |
| | | return taskId; |
| | | } |
| | | |
| | | public void setTaskId(String taskId) { |
| | | this.taskId = taskId == null ? null : taskId.trim(); |
| | | } |
| | | |
| | | public String getTaskName() { |
| | | return taskName; |
| | | } |
| | | |
| | | public void setTaskName(String taskName) { |
| | | this.taskName = taskName == null ? null : taskName.trim(); |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getQueueName() { |
| | | return queueName; |
| | | } |
| | | |
| | | public void setQueueName(String queueName) { |
| | | this.queueName = queueName == null ? null : queueName.trim(); |
| | | } |
| | | |
| | | public String getQueueContent() { |
| | | return queueContent; |
| | | } |
| | | |
| | | public void setQueueContent(String queueContent) { |
| | | this.queueContent = queueContent == null ? null : queueContent.trim(); |
| | | } |
| | | |
| | | public Date getPreSendTime() { |
| | | return preSendTime; |
| | | } |
| | | |
| | | public void setPreSendTime(Date preSendTime) { |
| | | this.preSendTime = preSendTime; |
| | | } |
| | | |
| | | public Date getActualSendTime() { |
| | | return actualSendTime; |
| | | } |
| | | |
| | | public void setActualSendTime(Date actualSendTime) { |
| | | this.actualSendTime = actualSendTime; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.query; |
| | | |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | |
| | | public class VipCenterQuery extends BaseDaoQuery { |
| | | |
| | | // 用户id |
| | | public String uid; |
| | | // 等级id |
| | | public Long gradeId; |
| | | //状态 |
| | | public Integer state; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.query; |
| | | |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | |
| | | public class VipComboQuery extends BaseDaoQuery { |
| | | |
| | | //id |
| | | public Long id; |
| | | //状态 |
| | | public Integer state; |
| | | // 名称 |
| | | public String name; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.query; |
| | | |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | |
| | | public class VipGradeQuery extends BaseDaoQuery { |
| | | |
| | | //id |
| | | public Long id; |
| | | //状态 |
| | | public Integer state; |
| | | // 名称 |
| | | public String name; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.query; |
| | | |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | |
| | | public class VipOrderQuery extends BaseDaoQuery { |
| | | |
| | | //id |
| | | public Long id; |
| | | // 套餐id |
| | | public Long comboId; |
| | | // 用户id |
| | | public String uid; |
| | | // 三方订单Id |
| | | public String threeOrderId; |
| | | //状态 |
| | | public Integer state; |
| | | // 订单类型 |
| | | public String type; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.manager; |
| | | |
| | | |
| | | public class VipComboManager { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.mapper.VipCenterRecordMapper; |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipCenterRecord; |
| | | import com.ks.vip.service.VipCenterRecordService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service(version = "1.0") |
| | | public class VipCenterRecordServiceImpl implements VipCenterRecordService { |
| | | |
| | | @Resource |
| | | private VipCenterRecordMapper vipCenterRecordMapper; |
| | | |
| | | |
| | | @Override |
| | | public void insertSelective(VipCenterRecord t){ |
| | | vipCenterRecordMapper.insertSelective(t); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.mapper.VipCenterMapper; |
| | | import com.ks.vip.mapper.VipComboMapper; |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipCenterRecord; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.query.VipCenterQuery; |
| | | import com.ks.vip.query.VipComboQuery; |
| | | import com.ks.vip.service.VipCenterRecordService; |
| | | import com.ks.vip.service.VipCenterService; |
| | | import com.ks.vip.service.VipComboService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.yeshi.utils.DateUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | | public class VipCenterServiceImpl implements VipCenterService { |
| | | |
| | | @Resource |
| | | private VipCenterMapper vipCenterMapper; |
| | | |
| | | @Resource |
| | | private VipCenterRecordService vipCenterRecordService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void insertSelective(VipCenter t){ |
| | | vipCenterMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(VipCenter t){ |
| | | vipCenterMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public VipCenter getByUid(String id) { |
| | | return vipCenterMapper.getByUid(id); |
| | | } |
| | | |
| | | @Override |
| | | public void deteleByUid(String id) { |
| | | vipCenterMapper.deteleByUid(id); |
| | | } |
| | | |
| | | @Override |
| | | public long count(VipCenter t) { |
| | | VipCenterQuery query = new VipCenterQuery(); |
| | | query.uid = t.getUid(); |
| | | query.gradeId = t.getGradeId(); |
| | | query.state = t.getState(); |
| | | return vipCenterMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<VipCenter> listByPage(int page, int pageSize, VipCenter t) { |
| | | VipCenterQuery query = new VipCenterQuery(); |
| | | query.uid = t.getUid(); |
| | | query.gradeId = t.getGradeId(); |
| | | query.state = t.getState(); |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return vipCenterMapper.listByPage(query); |
| | | } |
| | | |
| | | @Override |
| | | public void saveVipCenter(String uid, Long gradeId, Integer validDays, Long orderId) { |
| | | VipCenterRecord record = new VipCenterRecord(); |
| | | |
| | | VipCenter vipCenter = vipCenterMapper.selectForUpdate(uid); |
| | | if (vipCenter == null) { |
| | | Date startTime = new Date(); |
| | | Date endTime = DateUtil.plusDayDate(validDays, startTime); |
| | | |
| | | vipCenter.setUid(uid); |
| | | vipCenter.setGradeId(gradeId); |
| | | vipCenter.setStartTime(startTime); |
| | | vipCenter.setEndTime(DateUtil.plusDayDate(validDays, new Date())); |
| | | vipCenter.setCreateTime(new Date()); |
| | | vipCenterMapper.insertSelective(vipCenter); |
| | | |
| | | record.setStartTime(startTime); |
| | | record.setEndTime(endTime); |
| | | } else { |
| | | Date startTime = vipCenter.getStartTime(); |
| | | Date endTime = vipCenter.getEndTime(); |
| | | |
| | | Long oldGradeId = vipCenter.getGradeId(); |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | if (gradeId.longValue() == oldGradeId.longValue() && vipCenter.getEndTime().getTime() > nowTime) { |
| | | // 上次会员还未已结束 |
| | | endTime = DateUtil.plusDayDate(validDays, vipCenter.getEndTime()); |
| | | } else { |
| | | startTime = new Date(); |
| | | endTime = DateUtil.plusDayDate(validDays, startTime); |
| | | } |
| | | vipCenter.setStartTime(startTime); |
| | | vipCenter.setEndTime(endTime); |
| | | vipCenter.setGradeId(gradeId); |
| | | vipCenter.setUpdateTime(new Date()); |
| | | vipCenterMapper.updateByPrimaryKeySelective(vipCenter); |
| | | |
| | | record.setStartTime(new Date()); |
| | | record.setEndTime(endTime); |
| | | } |
| | | |
| | | record.setOrderId(orderId); |
| | | record.setUid(uid); |
| | | record.setGradeId(gradeId); |
| | | record.setCreateTime(new Date()); |
| | | vipCenterRecordService.insertSelective(record); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.mapper.VipComboMapper; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.query.VipComboQuery; |
| | | import com.ks.vip.service.VipComboService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | | public class VipComboServiceImpl implements VipComboService { |
| | | |
| | | @Resource |
| | | private VipComboMapper vipComboMapper; |
| | | |
| | | |
| | | @Override |
| | | public void insertSelective(VipCombo t){ |
| | | vipComboMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(VipCombo t){ |
| | | vipComboMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public VipCombo selectByPrimaryKey(Long id) { |
| | | return vipComboMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | vipComboMapper.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public long count(VipCombo t) { |
| | | VipComboQuery query = new VipComboQuery(); |
| | | // query.appId = appId; |
| | | // query.uid = uid; |
| | | return vipComboMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<VipCombo> listByPage(int page, int pageSize, VipCombo t) { |
| | | VipComboQuery query = new VipComboQuery(); |
| | | // query.appId = appId; |
| | | // query.uid = uid; |
| | | // query.drawStateList = Arrays.asList(new Integer[]{LuckyActivityJoinRecord.DRAW_STATE_UNOPEN}); |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return vipComboMapper.listByPage(query); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.mapper.VipComboMapper; |
| | | import com.ks.vip.mapper.VipGradeMapper; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | import com.ks.vip.query.VipComboQuery; |
| | | import com.ks.vip.query.VipGradeQuery; |
| | | import com.ks.vip.service.VipComboService; |
| | | import com.ks.vip.service.VipGradeService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | | public class VipGradeServiceImpl implements VipGradeService { |
| | | |
| | | @Resource |
| | | private VipGradeMapper vipGradeMapper; |
| | | |
| | | |
| | | @Override |
| | | public void insertSelective(VipGrade t){ |
| | | vipGradeMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(VipGrade t){ |
| | | vipGradeMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | vipGradeMapper.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public long count(VipGrade t) { |
| | | VipGradeQuery query = new VipGradeQuery(); |
| | | query.name = t.getName(); |
| | | query.state = t.getState(); |
| | | return vipGradeMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<VipGrade> listByPage(int page, int pageSize, VipGrade t) { |
| | | VipGradeQuery query = new VipGradeQuery(); |
| | | query.name = t.getName(); |
| | | query.state = t.getState(); |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return vipGradeMapper.listByPage(query); |
| | | } |
| | | |
| | | @Override |
| | | public List<VipGrade> getValidList(){ |
| | | VipGrade t = new VipGrade(); |
| | | t.setState(1); |
| | | return listByPage(0, Integer.MAX_VALUE, t); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.mapper.VipOrderMapper; |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.DO.VipOrder; |
| | | import com.ks.vip.pojo.DTO.VipOrderDTO; |
| | | import com.ks.vip.pojo.Enums.OrderTypeEnum; |
| | | import com.ks.vip.query.VipOrderQuery; |
| | | import com.ks.vip.service.VipCenterService; |
| | | import com.ks.vip.service.VipComboService; |
| | | import com.ks.vip.service.VipGradeService; |
| | | import com.ks.vip.service.VipOrederService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | | public class VipOrderServiceImpl implements VipOrederService { |
| | | |
| | | @Resource |
| | | private VipOrderMapper vipOrderMapper; |
| | | |
| | | @Resource |
| | | private VipComboService vipComboService; |
| | | |
| | | @Resource |
| | | private VipCenterService vipCenterService; |
| | | |
| | | |
| | | @Override |
| | | public void insertSelective(VipOrder t){ |
| | | vipOrderMapper.insertSelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByPrimaryKeySelective(VipOrder t){ |
| | | vipOrderMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | vipOrderMapper.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public long count(VipOrder t) { |
| | | VipOrderQuery query = new VipOrderQuery(); |
| | | query.comboId = t.getComboId(); |
| | | query.uid = t.getUid(); |
| | | query.threeOrderId = t.getThreeOrderId(); |
| | | query.type = t.getType(); |
| | | query.state = t.getState(); |
| | | return vipOrderMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<VipOrder> listByPage(int page, int pageSize, VipOrder t) { |
| | | VipOrderQuery query = new VipOrderQuery(); |
| | | query.comboId = t.getComboId(); |
| | | query.uid = t.getUid(); |
| | | query.threeOrderId = t.getThreeOrderId(); |
| | | query.type = t.getType(); |
| | | query.state = t.getState(); |
| | | return vipOrderMapper.listByPage(query); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addOrderByBuy(VipOrderDTO t) throws VipOrderException { |
| | | if(t.getComboId() == null || t.getComboId() <= 0){ |
| | | throw new VipOrderException(1, "套餐ID不能为空"); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(t.getUid())){ |
| | | throw new VipOrderException(1, "用户ID不能为空"); |
| | | } |
| | | if(t.getPayWay() == null){ |
| | | throw new VipOrderException(1, "付款方式不能为空"); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(t.getThreeOrderId())){ |
| | | throw new VipOrderException(1, "付款订单号不能为空"); |
| | | } |
| | | |
| | | // 检查是否已记录 |
| | | VipOrder order = vipOrderMapper.getByThreeOrderId(t.getThreeOrderId()); |
| | | if (order != null) { |
| | | throw new VipOrderException(1, "该付款订单号已存在"); |
| | | } |
| | | |
| | | VipCombo vipCombo = vipComboService.selectByPrimaryKey(t.getComboId()); |
| | | if (vipCombo == null) { |
| | | throw new VipOrderException(1, "该套餐不存在"); |
| | | } |
| | | // 有效天数 |
| | | Integer validDays = vipCombo.getValidDays(); |
| | | |
| | | // 插入订单信息 |
| | | VipOrder newOrder = new VipOrder(); |
| | | newOrder.setComboId(t.getComboId()); |
| | | newOrder.setUid(t.getUid()); |
| | | newOrder.setThreeOrderId(t.getThreeOrderId()); |
| | | newOrder.setPayWay(t.getPayWay().name()); |
| | | newOrder.setPayAccount(t.getPayAccount()); |
| | | newOrder.setPayMoney(t.getPayMoney()); |
| | | newOrder.setPayTime(t.getPayTime()); |
| | | newOrder.setType(OrderTypeEnum.buy.name()); |
| | | newOrder.setCreateTime(new Date()); |
| | | vipOrderMapper.insertSelective(newOrder); |
| | | |
| | | // 更新等级 |
| | | vipCenterService.saveVipCenter(t.getUid(), vipCombo.getGradeId(), validDays, newOrder.getId() ); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addOrderByWatchVideo(String uid, Long gradeId, Integer validDays) throws VipOrderException { |
| | | if(StringUtil.isNullOrEmpty(uid)){ |
| | | throw new VipOrderException(1, "用户ID不能为空"); |
| | | } |
| | | if(gradeId == null){ |
| | | throw new VipOrderException(1, "等级ID不能为空"); |
| | | } |
| | | if(validDays == null || validDays.longValue() <= 0){ |
| | | throw new VipOrderException(1, "有效天数不能为空"); |
| | | } |
| | | |
| | | // 插入订单信息 唯一性处理TODO |
| | | VipOrder newOrder = new VipOrder(); |
| | | newOrder.setUid(uid); |
| | | newOrder.setType(OrderTypeEnum.watchVideo.name()); |
| | | newOrder.setCreateTime(new Date()); |
| | | vipOrderMapper.insertSelective(newOrder); |
| | | |
| | | // 更新等级 |
| | | vipCenterService.saveVipCenter(uid, gradeId, validDays,newOrder.getId() ); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.vip.util; |
| | | |
| | | public class Constant { |
| | | |
| | | //奖品领取有效期为7天 |
| | | public final static long ACTIVITY_DRAWN_RECIEVE_VALID_TIME = 1000 * 60 * 60L * 24 * 7; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.lijin.util; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class LoggerUtil { |
| | | /** |
| | | * 活动日志 |
| | | */ |
| | | public final static Logger activityLogger = LoggerFactory.getLogger("activityLogger"); |
| | | /** |
| | | * 活动参与日志 |
| | | */ |
| | | public final static Logger activityJoinLogger = LoggerFactory.getLogger("activityJoinLogger"); |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.vip.util.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | @Documented |
| | | @Target(ElementType.METHOD) |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface RedisCache { |
| | | String key(); |
| | | //分类 |
| | | String cate(); |
| | | //默认1分钟 |
| | | int second() default 60; |
| | | } |
New file |
| | |
| | | package com.ks.vip.util.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | @Documented |
| | | @Target(ElementType.METHOD) |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Repeatable(RedisCacheEvicts.class) |
| | | public @interface RedisCacheEvict { |
| | | String key() default ""; |
| | | String keyPrefix() default ""; |
| | | //分类 |
| | | String cate(); |
| | | } |
New file |
| | |
| | | package com.ks.vip.util.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | @Documented |
| | | @Target(ElementType.METHOD) |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface RedisCacheEvicts { |
| | | RedisCacheEvict[] value(); |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8089 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | http: |
| | | encoding: |
| | | force: true |
| | | charset: UTF-8 |
| | | enabled: true |
| | | data: |
| | | mongodb: |
| | | username: admin |
| | | password: admin |
| | | #172.16.16.44 |
| | | #193.112.35.168 |
| | | host: 118.195.138.153 |
| | | port: 27017 |
| | | database: lijin |
| | | authentication-database: admin |
| | | datasource: |
| | | #gz-cdb-r13d0yi9.sql.tencentcdb.com:62929 |
| | | #172.16.16.17:3306 |
| | | url: jdbc:mysql://127.0.0.1:3306/tejia_vip?&useTimezone=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: root |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
| | | initial-size: 8 |
| | | min-idle: 1 |
| | | max-active: 20 |
| | | max-wait: 60000 |
| | | time-between-eviction-runsMillis: 60000 |
| | | min-evictable-idle-timeMillis: 300000 |
| | | validation-query: select 'x' FROM DUAL |
| | | test-while-idle: true |
| | | test-on-borrow: false |
| | | test-on-return: false |
| | | pool-prepared-statements: true |
| | | max-open-prepared-statements: 20 |
| | | max-pool-prepared-statement-per-connection-size: 20 |
| | | filters: stat |
| | | connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
| | | use-global-data-source-stat: true |
| | | mybatis: |
| | | mapper-locations : classpath:mapper/*.xml |
| | | type-aliases-package: com.ks.vip.pojo.DO |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl |
| | | |
| | | redis: |
| | | #172.16.16.3 |
| | | #193.112.34.40 |
| | | host: 118.195.138.153 |
| | | port: 6379 |
| | | password: 123456 |
| | | timeout: 5000 |
| | | jedis: |
| | | pool: |
| | | max-wait: 10000 |
| | | max-idle: 200 |
| | | max-total: 1024 |
| | | database: 5 |
| | | |
| | | dubbo: |
| | | application: |
| | | name: lijin-provider |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://118.195.138.153:2181 # 134.175.68.214 134.175.68.214:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |
| | | port: 20903 |
| | | scan: |
| | | base-packages: com.ks.vip.service.remote |
| | | provider: |
| | | timeout: 10000 |
| | | host: 127.0.0.1 |
| | | xxl: |
| | | job: |
| | | accessToken: |
| | | executor: |
| | | appname: demo |
| | | ip: |
| | | logpath: /data/applogs/xxl-job/jobhandler |
| | | logretentiondays: -1 |
| | | port: 9999 |
| | | admin: |
| | | addresses: http://localhost:8081/xxl-job-admin |
| | | logging: |
| | | level: |
| | | com: |
| | | ks: |
| | | vip: |
| | | mapper: debug |
| | | org.springframework.data.mongodb.core: DEBUG |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE generatorConfiguration |
| | | PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
| | | <generatorConfiguration> |
| | | |
| | | <!--mysql 连接数据库jar 这里选择自己本地位置--> |
| | | |
| | | <classPathEntry location="D:/mysql-connector-java-5.1.46-bin.jar"/> |
| | | <context id="testTables" targetRuntime="MyBatis3"> |
| | | <commentGenerator> |
| | | <!-- 是否去除自动生成的注释 true:是 : false:否 --> |
| | | <property name="suppressAllComments" value="true"/> |
| | | </commentGenerator> |
| | | <!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> |
| | | <jdbcConnection driverClass="com.mysql.jdbc.Driver" |
| | | connectionURL="jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_lucky" userId="root" |
| | | password="Yeshi2016@"> |
| | | </jdbcConnection> |
| | | |
| | | <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 |
| | | NUMERIC 类型解析为java.math.BigDecimal --> |
| | | <javaTypeResolver> |
| | | <property name="forceBigDecimals" value="true"/> |
| | | </javaTypeResolver> |
| | | |
| | | <!-- targetProject:生成PO类的位置 --> |
| | | <javaModelGenerator targetPackage="com.ks.app.pojo.DO" |
| | | targetProject="src/main/java"> |
| | | <!-- enableSubPackages:是否让schema作为包的后缀 --> |
| | | <property name="enableSubPackages" value="false"/> |
| | | <!-- 从数据库返回的值被清理前后的空格 --> |
| | | <property name="trimStrings" value="true"/> |
| | | </javaModelGenerator> |
| | | |
| | | <!-- targetProject:mapper映射文件生成的位置 |
| | | 如果maven工程只是单独的一个工程,targetProject="src/main/java" |
| | | 若果maven工程是分模块的工程,targetProject="所属模块的名称",例如: |
| | | targetProject="ecps-manager-mapper",下同--> |
| | | <sqlMapGenerator targetPackage="mapper" |
| | | targetProject="src/main/resources"> |
| | | <!-- enableSubPackages:是否让schema作为包的后缀 --> |
| | | <property name="enableSubPackages" value="false"/> |
| | | </sqlMapGenerator> |
| | | |
| | | <!-- targetPackage:mapper接口生成的位置 --> |
| | | <javaClientGenerator type="XMLMAPPER" |
| | | targetPackage="com.ks.app.mapper" |
| | | targetProject="src/main/java"> |
| | | |
| | | <!-- enableSubPackages:是否让schema作为包的后缀 --> |
| | | <property name="enableSubPackages" value="false"/> |
| | | </javaClientGenerator> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivity" tableName="lucky_activity" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityOpenInfo" tableName="lucky_activity_open_info" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwardResult" tableName="lucky_activity_award_result" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwardResultExtra" tableName="lucky_activity_award_result_extra" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwards" tableName="lucky_activity_awards" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityJoinAssist" tableName="lucky_activity_join_assist" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityJoinRecord" tableName="lucky_activity_join_record" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivitySponsorInfo" tableName="lucky_activity_sponsor_info" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <table schema="" domainObjectName="LuckySponsorMoneyRecord" tableName="lucky_sponsor_money_record" enableCountByExample="false" enableUpdateByExample="false" |
| | | enableDeleteByExample="false" enableSelectByExample="false" |
| | | selectByExampleQueryId="false"></table> |
| | | |
| | | <!--<table schema="" domainObjectName="" tableName=""></table>--> |
| | | |
| | | |
| | | </context> |
| | | |
| | | </generatorConfiguration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!--scan为true(默认每一分钟扫描一下配置文件,如果发生更改就重新加载配置文件) |
| | | scanPeriod设置扫描配置文件的时间间隔(如果没有指定单位默认为毫秒) |
| | | debug 如果设置为true,在控制台中打印logback内部运行日志(内部状态信息,如果配置文件有错误 |
| | | 也会输出),由于logback已经很稳定了,我们一般设置为false,以免干扰我们查看有用的日志信息 --> |
| | | <configuration scan="true" scanPeriod="60 seconds" debug="false"> |
| | | |
| | | <!--定义参数常量(全局变量)--> |
| | | <!--设置Logger的等级 (TRACE<DEBUG<INFO<WARN<ERROR),假设配置为INFO,那么debug将不会被 |
| | | 输出,我们一般会把debug,info,error的信息分别输出到文件中--> |
| | | <property name="log.level" value="debug"/> |
| | | <!--归档日志文件保存的最大时间(单位跟按什么轮转有关,比如按天轮转那么单位就为天) --> |
| | | <property name="log.maxHistory" value="30"/> |
| | | <!--日志存储的根路径 ${catalina.base}指向每个Tomcat目录私有信息的位置, |
| | | 就是conf、logs、temp、webapps和work的父目录--> |
| | | |
| | | <!-- E:/logback --> |
| | | <property name="log.filePath" value="/tmp/logs/lucky"/> |
| | | <!--日志展示的格式--> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/> |
| | | |
| | | <!--appender是为了配置日志信息输出到哪个地方--> |
| | | <!--控制台设置,输出到控制台中--> |
| | | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--encoder作用是既把日志信息转换为字符串,也输出到指定的位置 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <!--pattern为配置输出的格式--> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | |
| | | <!-- ERROR --> |
| | | <appender name="errorAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/error.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/error/error.log.gz.%d{yyyy-MM-dd}</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 活动日志 --> |
| | | <appender name="activityAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/activity/activity.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/activity/activity.log.zip.%d{yyyy-MM-dd}</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 活动参与日志 --> |
| | | <appender name="activityJoinAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/activity/activity-join.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/activity/activity-join.log.zip.%d{yyyy-MM-dd}</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!--name表示为哪一个logger指定层级和输出的方式 |
| | | additivity表示叠加祖先的输出方式(默认为true,会叠加),所以com.lxc.o2o以及其子类都会输出在控制台中,因为这个logger继承了root中的appender |
| | | level表示级别大于等于${log.level}的信息才会输出,输出方式为配置的appender, |
| | | 由于这里level为debug(重写了,就不会继承root的level了), |
| | | 所以控制台中会输出大于等于debug等级的日志(包括持久层执行的mysql) |
| | | 并且 |
| | | debug日志会输出到debugAppender指定的文件中 |
| | | info日志会输出到infoAppender指定的文件中 |
| | | error日志会输出到errorAppender指定的文件中--> |
| | | |
| | | <!-- 一切logger都会继承自root,root默认的层级level为debug --> |
| | | |
| | | <logger name="activityLogger" level="INFO" additivity="true"> |
| | | <appender-ref ref="activityAppender"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="activityJoinLogger" level="INFO" additivity="true"> |
| | | <appender-ref ref="activityJoinAppender"></appender-ref> |
| | | </logger> |
| | | |
| | | <root level="INFO"> |
| | | <!--在控制台中输出所在层级对应level(以及大于level)的日志信息,因为这里并没有设置LevelFilter--> |
| | | <appender-ref ref="STDOUT"></appender-ref> |
| | | <appender-ref ref="errorAppender"></appender-ref> |
| | | </root> |
| | | </configuration> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipCenterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipCenter"> |
| | | <id column="v_uid" property="uid" jdbcType="VARCHAR"/> |
| | | <result column="v_grade_id" property="gradeId" jdbcType="BIGINT"/> |
| | | <result column="v_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="v_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="v_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="v_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="v_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="v_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="v_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">v_uid,v_grade_id,v_start_time,v_end_time,v_state,v_creator_id,v_create_time,v_updator_id,v_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">select |
| | | <include refid="Base_Column_List"/>from vip_center where v_uid = #{uid,jdbcType=VARCHAR} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.String">delete from vip_center where v_uid = #{uid,jdbcType=VARCHAR}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipCenter" useGeneratedKeys="true" keyProperty="id">insert into vip_center (v_uid,v_grade_id,v_start_time,v_end_time,v_state,v_creator_id,v_create_time,v_updator_id,v_update_time) values (#{uid,jdbcType=VARCHAR},#{gradeId,jdbcType=BIGINT},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipCenter" useGeneratedKeys="true" keyProperty="id">insert into vip_center |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="uid != null">v_uid,</if> |
| | | <if test="gradeId != null">v_grade_id,</if> |
| | | <if test="startTime != null">v_start_time,</if> |
| | | <if test="endTime != null">v_end_time,</if> |
| | | <if test="state != null">v_state,</if> |
| | | <if test="creatorId != null">v_creator_id,</if> |
| | | <if test="createTime != null">v_create_time,</if> |
| | | <if test="updatorId != null">v_updator_id,</if> |
| | | <if test="updateTime != null">v_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="uid != null">#{uid,jdbcType=VARCHAR},</if> |
| | | <if test="gradeId != null">#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipCenter">update vip_center set v_grade_id = #{gradeId,jdbcType=BIGINT},v_start_time = #{startTime,jdbcType=TIMESTAMP},v_end_time = #{endTime,jdbcType=TIMESTAMP},v_state = #{state,jdbcType=INTEGER},v_creator_id = #{creatorId,jdbcType=BIGINT},v_create_time = #{createTime,jdbcType=TIMESTAMP},v_updator_id = #{updatorId,jdbcType=BIGINT},v_update_time = #{updateTime,jdbcType=TIMESTAMP} where v_uid = #{uid,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipCenter">update vip_center |
| | | <set> |
| | | <if test="gradeId != null">v_grade_id=#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="startTime != null">v_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">v_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">v_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">v_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">v_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">v_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">v_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where v_uid = #{uid,jdbcType=VARCHAR} |
| | | </update> |
| | | |
| | | <!-- 非模板 --> |
| | | |
| | | <delete id="deteleByUid" parameterType="java.lang.String">delete from vip_center where v_uid = #{uid,jdbcType=VARCHAR}</delete> |
| | | |
| | | <select id="getByUid" resultMap="BaseResultMap" parameterType="java.lang.String">select |
| | | <include refid="Base_Column_List"/>from vip_center where v_uid = #{uid,jdbcType=VARCHAR} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectForUpdate" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | SELECT <include refid="Base_Column_List"/> FROM vip_center |
| | | WHERE v_uid = #{uid,jdbcType=VARCHAR} FOR UPDATE |
| | | </select> |
| | | |
| | | |
| | | <sql id="listWhere"> |
| | | <if test="query.uid!=null">and v_uid=#{query.uid}</if> |
| | | <if test="query.gradeId!=null">and v_grade_id=#{query.gradeId}</if> |
| | | <if test="query.state!=null">and v_state=#{query.state}</if> |
| | | </sql> |
| | | |
| | | |
| | | <select id="listByPage" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_center |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select count(*) from vip_center |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | </select> |
| | | |
| | | |
| | | <select id="getByThreeOrderId" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_center |
| | | where o_three_order_id=#{query.threeOrderId} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipCenterRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipCenterRecord"> |
| | | <id column="r_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="r_uid" property="uid" jdbcType="VARCHAR"/> |
| | | <result column="r_grade_id" property="gradeId" jdbcType="BIGINT"/> |
| | | <result column="r_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="r_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="r_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="r_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="r_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="r_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="r_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">r_id,r_uid,r_grade_id,r_start_time,r_end_time,r_state,r_creator_id,r_create_time,r_updator_id,r_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from vip_center_record where r_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_center_record where r_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipCenterRecord" useGeneratedKeys="true" keyProperty="id">insert into vip_center_record (r_id,r_uid,r_grade_id,r_start_time,r_end_time,r_state,r_creator_id,r_create_time,r_updator_id,r_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=VARCHAR},#{gradeId,jdbcType=BIGINT},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipCenterRecord" useGeneratedKeys="true" keyProperty="id">insert into vip_center_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">r_id,</if> |
| | | <if test="uid != null">r_uid,</if> |
| | | <if test="gradeId != null">r_grade_id,</if> |
| | | <if test="startTime != null">r_start_time,</if> |
| | | <if test="endTime != null">r_end_time,</if> |
| | | <if test="state != null">r_state,</if> |
| | | <if test="creatorId != null">r_creator_id,</if> |
| | | <if test="createTime != null">r_create_time,</if> |
| | | <if test="updatorId != null">r_updator_id,</if> |
| | | <if test="updateTime != null">r_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=VARCHAR},</if> |
| | | <if test="gradeId != null">#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipCenterRecord">update vip_center_record set r_uid = #{uid,jdbcType=VARCHAR},r_grade_id = #{gradeId,jdbcType=BIGINT},r_start_time = #{startTime,jdbcType=TIMESTAMP},r_end_time = #{endTime,jdbcType=TIMESTAMP},r_state = #{state,jdbcType=INTEGER},r_creator_id = #{creatorId,jdbcType=BIGINT},r_create_time = #{createTime,jdbcType=TIMESTAMP},r_updator_id = #{updatorId,jdbcType=BIGINT},r_update_time = #{updateTime,jdbcType=TIMESTAMP} where r_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipCenterRecord">update vip_center_record |
| | | <set> |
| | | <if test="uid != null">r_uid=#{uid,jdbcType=VARCHAR},</if> |
| | | <if test="gradeId != null">r_grade_id=#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="startTime != null">r_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">r_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">r_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">r_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">r_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">r_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">r_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where r_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipComboMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipCombo"> |
| | | <id column="cb_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="cb_grade_id" property="gradeId" jdbcType="BIGINT"/> |
| | | <result column="cb_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="cb_icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="cb_original_price" property="originalPrice" jdbcType="DECIMAL"/> |
| | | <result column="cb_discount" property="discount" jdbcType="DECIMAL"/> |
| | | <result column="cb_discount_price" property="discountPrice" jdbcType="DECIMAL"/> |
| | | <result column="cb_valid_days" property="validDays" jdbcType="INTEGER"/> |
| | | <result column="cb_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="cb_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="cb_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cb_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="cb_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">cb_id,cb_grade_id,cb_name,cb_icon,cb_original_price,cb_discount,cb_discount_price,cb_valid_days,cb_state,cb_creator_id,cb_create_time,cb_updator_id,cb_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from vip_combo where cb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_combo where cb_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipCombo" useGeneratedKeys="true" keyProperty="id">insert into vip_combo (cb_id,cb_grade_id,cb_name,cb_icon,cb_original_price,cb_discount,cb_discount_price,cb_valid_days,cb_state,cb_creator_id,cb_create_time,cb_updator_id,cb_update_time) values (#{id,jdbcType=BIGINT},#{gradeId,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{originalPrice,jdbcType=DECIMAL},#{discount,jdbcType=DECIMAL},#{discountPrice,jdbcType=DECIMAL},#{validDays,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipCombo" useGeneratedKeys="true" keyProperty="id">insert into vip_combo |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">cb_id,</if> |
| | | <if test="gradeId != null">cb_grade_id,</if> |
| | | <if test="name != null">cb_name,</if> |
| | | <if test="icon != null">cb_icon,</if> |
| | | <if test="originalPrice != null">cb_original_price,</if> |
| | | <if test="discount != null">cb_discount,</if> |
| | | <if test="discountPrice != null">cb_discount_price,</if> |
| | | <if test="validDays != null">cb_valid_days,</if> |
| | | <if test="state != null">cb_state,</if> |
| | | <if test="creatorId != null">cb_creator_id,</if> |
| | | <if test="createTime != null">cb_create_time,</if> |
| | | <if test="updatorId != null">cb_updator_id,</if> |
| | | <if test="updateTime != null">cb_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="gradeId != null">#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="originalPrice != null">#{originalPrice,jdbcType=DECIMAL},</if> |
| | | <if test="discount != null">#{discount,jdbcType=DECIMAL},</if> |
| | | <if test="discountPrice != null">#{discountPrice,jdbcType=DECIMAL},</if> |
| | | <if test="validDays != null">#{validDays,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipCombo">update vip_combo set cb_grade_id = #{gradeId,jdbcType=BIGINT},cb_name = #{name,jdbcType=VARCHAR},cb_icon = #{icon,jdbcType=VARCHAR},cb_original_price = #{originalPrice,jdbcType=DECIMAL},cb_discount = #{discount,jdbcType=DECIMAL},cb_discount_price = #{discountPrice,jdbcType=DECIMAL},cb_valid_days = #{validDays,jdbcType=INTEGER},cb_state = #{state,jdbcType=INTEGER},cb_creator_id = #{creatorId,jdbcType=BIGINT},cb_create_time = #{createTime,jdbcType=TIMESTAMP},cb_updator_id = #{updatorId,jdbcType=BIGINT},cb_update_time = #{updateTime,jdbcType=TIMESTAMP} where cb_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipCombo">update vip_combo |
| | | <set> |
| | | <if test="gradeId != null">cb_grade_id=#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="name != null">cb_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">cb_icon=#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="originalPrice != null">cb_original_price=#{originalPrice,jdbcType=DECIMAL},</if> |
| | | <if test="discount != null">cb_discount=#{discount,jdbcType=DECIMAL},</if> |
| | | <if test="discountPrice != null">cb_discount_price=#{discountPrice,jdbcType=DECIMAL},</if> |
| | | <if test="validDays != null">cb_valid_days=#{validDays,jdbcType=INTEGER},</if> |
| | | <if test="state != null">cb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">cb_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">cb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">cb_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">cb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where cb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | |
| | | <!-- 非模板 --> |
| | | <sql id="listWhere"> |
| | | <if test="query.id!=null">and cb_id=#{query.id}</if> |
| | | <if test="query.name!=null">and cb_name=#{query.name}</if> |
| | | <if test="query.state!=null">and cb_state=#{query.state}</if> |
| | | </sql> |
| | | |
| | | |
| | | <select id="listByPage" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_combo |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select count(*) from vip_combo |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipGradeMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipGrade"> |
| | | <id column="g_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="g_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="g_icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="g_sort" property="sort" jdbcType="INTEGER"/> |
| | | <result column="g_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="g_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="g_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="g_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="g_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">g_id,g_name,g_icon,g_sort,g_state,g_creator_id,g_create_time,g_updator_id,g_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from vip_grade where g_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_grade where g_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipGrade" useGeneratedKeys="true" keyProperty="id">insert into vip_grade (g_id,g_name,g_icon,g_sort,g_state,g_creator_id,g_create_time,g_updator_id,g_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipGrade" useGeneratedKeys="true" keyProperty="id">insert into vip_grade |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">g_id,</if> |
| | | <if test="name != null">g_name,</if> |
| | | <if test="icon != null">g_icon,</if> |
| | | <if test="sort != null">g_sort,</if> |
| | | <if test="state != null">g_state,</if> |
| | | <if test="creatorId != null">g_creator_id,</if> |
| | | <if test="createTime != null">g_create_time,</if> |
| | | <if test="updatorId != null">g_updator_id,</if> |
| | | <if test="updateTime != null">g_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="sort != null">#{sort,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipGrade">update vip_grade set g_name = #{name,jdbcType=VARCHAR},g_icon = #{icon,jdbcType=VARCHAR},g_sort = #{sort,jdbcType=INTEGER},g_state = #{state,jdbcType=INTEGER},g_creator_id = #{creatorId,jdbcType=BIGINT},g_create_time = #{createTime,jdbcType=TIMESTAMP},g_updator_id = #{updatorId,jdbcType=BIGINT},g_update_time = #{updateTime,jdbcType=TIMESTAMP} where g_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipGrade">update vip_grade |
| | | <set> |
| | | <if test="name != null">g_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">g_icon=#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="sort != null">g_sort=#{sort,jdbcType=INTEGER},</if> |
| | | <if test="state != null">g_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">g_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">g_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">g_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">g_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where g_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <!-- 非模板 --> |
| | | <sql id="listWhere"> |
| | | <if test="query.id!=null">and g_id=#{query.id}</if> |
| | | <if test="query.name!=null">and g_name=#{query.name}</if> |
| | | <if test="query.state!=null">and g_state=#{query.state}</if> |
| | | </sql> |
| | | |
| | | |
| | | <select id="listByPage" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_grade |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select count(*) from vip_grade |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipGradePotenceMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipGradePotence"> |
| | | <id column="pc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="pc_grade_id" property="gradeId" jdbcType="BIGINT"/> |
| | | <result column="pc_rebate_percent" property="rebatePercent" jdbcType="DECIMAL"/> |
| | | <result column="pc_taolijin_percent" property="taolijinPercent" jdbcType="DECIMAL"/> |
| | | <result column="pc_taolijin_max_number" property="taolijinMaxNumber" jdbcType="VARCHAR"/> |
| | | <result column="pc_taolijin_max_money" property="taolijinMaxMoney" jdbcType="DECIMAL"/> |
| | | <result column="pc_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="pc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pc_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="pc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">pc_id,pc_grade_id,pc_rebate_percent,pc_taolijin_percent,pc_taolijin_max_number,pc_taolijin_max_money,pc_creator_id,pc_create_time,pc_updator_id,pc_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from vip_grade_potence where pc_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_grade_potence where pc_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipGradePotence" useGeneratedKeys="true" keyProperty="id">insert into vip_grade_potence (pc_id,pc_grade_id,pc_rebate_percent,pc_taolijin_percent,pc_taolijin_max_number,pc_taolijin_max_money,pc_creator_id,pc_create_time,pc_updator_id,pc_update_time) values (#{id,jdbcType=BIGINT},#{gradeId,jdbcType=BIGINT},#{rebatePercent,jdbcType=DECIMAL},#{taolijinPercent,jdbcType=DECIMAL},#{taolijinMaxNumber,jdbcType=VARCHAR},#{taolijinMaxMoney,jdbcType=DECIMAL},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipGradePotence" useGeneratedKeys="true" keyProperty="id">insert into vip_grade_potence |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">pc_id,</if> |
| | | <if test="gradeId != null">pc_grade_id,</if> |
| | | <if test="rebatePercent != null">pc_rebate_percent,</if> |
| | | <if test="taolijinPercent != null">pc_taolijin_percent,</if> |
| | | <if test="taolijinMaxNumber != null">pc_taolijin_max_number,</if> |
| | | <if test="taolijinMaxMoney != null">pc_taolijin_max_money,</if> |
| | | <if test="creatorId != null">pc_creator_id,</if> |
| | | <if test="createTime != null">pc_create_time,</if> |
| | | <if test="updatorId != null">pc_updator_id,</if> |
| | | <if test="updateTime != null">pc_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="gradeId != null">#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="rebatePercent != null">#{rebatePercent,jdbcType=DECIMAL},</if> |
| | | <if test="taolijinPercent != null">#{taolijinPercent,jdbcType=DECIMAL},</if> |
| | | <if test="taolijinMaxNumber != null">#{taolijinMaxNumber,jdbcType=VARCHAR},</if> |
| | | <if test="taolijinMaxMoney != null">#{taolijinMaxMoney,jdbcType=DECIMAL},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipGradePotence">update vip_grade_potence set pc_grade_id = #{gradeId,jdbcType=BIGINT},pc_rebate_percent = #{rebatePercent,jdbcType=DECIMAL},pc_taolijin_percent = #{taolijinPercent,jdbcType=DECIMAL},pc_taolijin_max_number = #{taolijinMaxNumber,jdbcType=VARCHAR},pc_taolijin_max_money = #{taolijinMaxMoney,jdbcType=DECIMAL},pc_creator_id = #{creatorId,jdbcType=BIGINT},pc_create_time = #{createTime,jdbcType=TIMESTAMP},pc_updator_id = #{updatorId,jdbcType=BIGINT},pc_update_time = #{updateTime,jdbcType=TIMESTAMP} where pc_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipGradePotence">update vip_grade_potence |
| | | <set> |
| | | <if test="gradeId != null">pc_grade_id=#{gradeId,jdbcType=BIGINT},</if> |
| | | <if test="rebatePercent != null">pc_rebate_percent=#{rebatePercent,jdbcType=DECIMAL},</if> |
| | | <if test="taolijinPercent != null">pc_taolijin_percent=#{taolijinPercent,jdbcType=DECIMAL},</if> |
| | | <if test="taolijinMaxNumber != null">pc_taolijin_max_number=#{taolijinMaxNumber,jdbcType=VARCHAR},</if> |
| | | <if test="taolijinMaxMoney != null">pc_taolijin_max_money=#{taolijinMaxMoney,jdbcType=DECIMAL},</if> |
| | | <if test="creatorId != null">pc_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">pc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">pc_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">pc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where pc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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="com.ks.vip.mapper.VipOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipOrder"> |
| | | <id column="o_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="o_type" property="type" jdbcType="VARCHAR"/> |
| | | <result column="o_combo_id" property="comboId" jdbcType="BIGINT"/> |
| | | <result column="o_uid" property="uid" jdbcType="VARCHAR"/> |
| | | <result column="o_three_order_id" property="threeOrderId" jdbcType="VARCHAR"/> |
| | | <result column="o_pay_money" property="payMoney" jdbcType="DECIMAL"/> |
| | | <result column="o_pay_time" property="payTime" jdbcType="TIMESTAMP"/> |
| | | <result column="o_pay_account" property="payAccount" jdbcType="VARCHAR"/> |
| | | <result column="o_pay_way" property="payWay" jdbcType="VARCHAR"/> |
| | | <result column="o_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="o_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="o_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="o_creator_id" property="creatorId" jdbcType="BIGINT"/> |
| | | <result column="o_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="o_updator_id" property="updatorId" jdbcType="BIGINT"/> |
| | | <result column="o_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">o_id,o_type,o_combo_id,o_uid,o_three_order_id,o_pay_money,o_pay_time,o_pay_account,o_pay_way,o_end_time,o_start_time,o_state,o_creator_id,o_create_time,o_updator_id,o_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from vip_order where o_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_order where o_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipOrder" useGeneratedKeys="true" keyProperty="id">insert into vip_order (o_id,o_type,o_combo_id,o_uid,o_three_order_id,o_pay_money,o_pay_time,o_pay_account,o_pay_way,o_end_time,o_start_time,o_state,o_creator_id,o_create_time,o_updator_id,o_update_time) values (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{comboId,jdbcType=BIGINT},#{uid,jdbcType=VARCHAR},#{threeOrderId,jdbcType=VARCHAR},#{payMoney,jdbcType=DECIMAL},#{payTime,jdbcType=TIMESTAMP},#{payAccount,jdbcType=VARCHAR},#{payWay,jdbcType=VARCHAR},#{endTime,jdbcType=TIMESTAMP},#{startTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipOrder" useGeneratedKeys="true" keyProperty="id">insert into vip_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">o_id,</if> |
| | | <if test="type != null">o_type,</if> |
| | | <if test="comboId != null">o_combo_id,</if> |
| | | <if test="uid != null">o_uid,</if> |
| | | <if test="threeOrderId != null">o_three_order_id,</if> |
| | | <if test="payMoney != null">o_pay_money,</if> |
| | | <if test="payTime != null">o_pay_time,</if> |
| | | <if test="payAccount != null">o_pay_account,</if> |
| | | <if test="payWay != null">o_pay_way,</if> |
| | | <if test="endTime != null">o_end_time,</if> |
| | | <if test="startTime != null">o_start_time,</if> |
| | | <if test="state != null">o_state,</if> |
| | | <if test="creatorId != null">o_creator_id,</if> |
| | | <if test="createTime != null">o_create_time,</if> |
| | | <if test="updatorId != null">o_updator_id,</if> |
| | | <if test="updateTime != null">o_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="comboId != null">#{comboId,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=VARCHAR},</if> |
| | | <if test="threeOrderId != null">#{threeOrderId,jdbcType=VARCHAR},</if> |
| | | <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if> |
| | | <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="payAccount != null">#{payAccount,jdbcType=VARCHAR},</if> |
| | | <if test="payWay != null">#{payWay,jdbcType=VARCHAR},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipOrder">update vip_order set o_type = #{type,jdbcType=VARCHAR},o_combo_id = #{comboId,jdbcType=BIGINT},o_uid = #{uid,jdbcType=VARCHAR},o_three_order_id = #{threeOrderId,jdbcType=VARCHAR},o_pay_money = #{payMoney,jdbcType=DECIMAL},o_pay_time = #{payTime,jdbcType=TIMESTAMP},o_pay_account = #{payAccount,jdbcType=VARCHAR},o_pay_way = #{payWay,jdbcType=VARCHAR},o_end_time = #{endTime,jdbcType=TIMESTAMP},o_start_time = #{startTime,jdbcType=TIMESTAMP},o_state = #{state,jdbcType=INTEGER},o_creator_id = #{creatorId,jdbcType=BIGINT},o_create_time = #{createTime,jdbcType=TIMESTAMP},o_updator_id = #{updatorId,jdbcType=BIGINT},o_update_time = #{updateTime,jdbcType=TIMESTAMP} where o_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipOrder">update vip_order |
| | | <set> |
| | | <if test="type != null">o_type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="comboId != null">o_combo_id=#{comboId,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">o_uid=#{uid,jdbcType=VARCHAR},</if> |
| | | <if test="threeOrderId != null">o_three_order_id=#{threeOrderId,jdbcType=VARCHAR},</if> |
| | | <if test="payMoney != null">o_pay_money=#{payMoney,jdbcType=DECIMAL},</if> |
| | | <if test="payTime != null">o_pay_time=#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="payAccount != null">o_pay_account=#{payAccount,jdbcType=VARCHAR},</if> |
| | | <if test="payWay != null">o_pay_way=#{payWay,jdbcType=VARCHAR},</if> |
| | | <if test="endTime != null">o_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="startTime != null">o_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">o_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="creatorId != null">o_creator_id=#{creatorId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">o_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatorId != null">o_updator_id=#{updatorId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">o_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where o_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <!-- 非模板 --> |
| | | <sql id="listWhere"> |
| | | <if test="query.id!=null">and o_id=#{query.id}</if> |
| | | <if test="query.type!=null">and o_type=#{query.type}</if> |
| | | <if test="query.comboId!=null">and comboId=#{query.comboId}</if> |
| | | <if test="query.uid!=null">and o_uid=#{query.uid}</if> |
| | | <if test="query.threeOrderId!=null">and o_three_order_id=#{query.threeOrderId}</if> |
| | | <if test="query.state!=null">and o_state=#{query.state}</if> |
| | | </sql> |
| | | |
| | | |
| | | <select id="listByPage" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_order |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select count(*) from vip_order |
| | | where 1=1 |
| | | <include refid="listWhere"/> |
| | | </select> |
| | | |
| | | |
| | | <select id="getByThreeOrderId" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/> from vip_order |
| | | where o_three_order_id=#{query.threeOrderId} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.ks; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | import java.util.*; |
| | | |
| | | public class LuckyTest { |
| | | |
| | | |
| | | @Test |
| | | public void test() { |
| | | Map<Long, Integer> map = new HashMap<>(); |
| | | int total = 0; |
| | | int personCount = 1000000; |
| | | for (int i = 0; i < personCount; i++) { |
| | | map.put(10000L + i, i == 0 ? 0 : (int) (1 + 10 * Math.random())); |
| | | total += map.get(10000L + i); |
| | | } |
| | | Set<Long> sets = choujiang(map, 100); |
| | | int percent = total / personCount; |
| | | int upCount = 0; |
| | | for (Long uid : sets) { |
| | | if (map.get(uid) > percent) |
| | | upCount += 1; |
| | | System.out.println(uid + "-" + map.get(uid) + "是否大于均值:" + (map.get(uid) > percent)); |
| | | } |
| | | System.out.println("大于均值数量:" + upCount); |
| | | System.out.println("数量:" + sets.size()); |
| | | } |
| | | |
| | | private Set<Long> choujiang(Map<Long, Integer> map, int number) { |
| | | |
| | | List<Long> mList = new ArrayList<>(); |
| | | for (Iterator<Long> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | Long uid = its.next(); |
| | | int c = map.get(uid); |
| | | for (int i = 0; i < c; i++) { |
| | | mList.add(uid); |
| | | } |
| | | } |
| | | |
| | | Set<Long> luckyUids = new HashSet<>(); |
| | | for (int i = 0; i < number; i++) { |
| | | if(mList.size()==0) |
| | | break; |
| | | long startTime = System.currentTimeMillis(); |
| | | int p = (int) (mList.size() * Math.random()); |
| | | long uid = mList.get(p); |
| | | luckyUids.add(uid); |
| | | |
| | | //移除列表右面的相同uid |
| | | while (mList.size() > p && mList.get(p) == uid) { |
| | | mList.remove(p); |
| | | } |
| | | |
| | | //查询相同uid的列表左侧起点 |
| | | for (int j = p - 1; j >= 0; j--) { |
| | | if (mList.get(j).longValue() != uid) { |
| | | p = j + 1; |
| | | break; |
| | | } else if (j == 0) { |
| | | p = 0; |
| | | } |
| | | } |
| | | |
| | | //删除左侧相同uid |
| | | while (mList.size() > p && mList.get(p) == uid) { |
| | | mList.remove(p); |
| | | } |
| | | |
| | | System.out.println("运行时间:" + (System.currentTimeMillis() - startTime)); |
| | | } |
| | | |
| | | |
| | | System.out.println(luckyUids); |
| | | return luckyUids; |
| | | } |
| | | |
| | | |
| | | } |
File was renamed from facade-lijin/src/test/java/java/com/ks/MyBatisTest.java |
| | |
| | | package java.com.ks; |
| | | package com.ks; |
| | | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.generater.mybatis.MyBatisMapperUtil; |