添加分区逻辑代码

This commit is contained in:
kongyuebin 2021-05-19 13:46:49 +08:00
parent f7a7eb737d
commit 706a95317d
34 changed files with 629 additions and 73 deletions

View File

@ -0,0 +1,75 @@
package controllers
import (
"legend/controllers/base"
"legend/request"
"legend/service"
)
type AreaController struct {
base.BasicController
}
func (c *AreaController) getRequestPrams() *request.AreaReq {
req := new(request.AreaReq)
req.AreaName = c.GetString("areaName")
req.GroupName = c.GetString("groupName")
req.TemplateName = c.GetString("templateName")
req.NotifyUrl = c.GetString("notifyUrl")
req.AttachParams = c.GetString("attachParams")
return req
}
func (c *AreaController) AreaAdd() {
req := c.getRequestPrams()
se := new(service.AreaService)
area := se.AddArea(req)
c.Data["json"] = area
_ = c.ServeJSON()
}
func (c *AreaController) AreaEdit() {
req := c.getRequestPrams()
uid := c.GetString("uid")
se := new(service.AreaService)
resp := se.EditArea(req, uid)
c.Data["json"] = resp
_ = c.ServeJSON()
}
func (c *AreaController) AreaList() {
page, _ := c.GetInt("page")
limit, _ := c.GetInt("limit")
se := new(service.AreaService)
list := se.AreaList(page, limit)
c.Data["json"] = list
_ = c.ServeJSON()
}
func (c *AreaController) AreaDelete() {
uid := c.GetString("uid")
se := new(service.AreaService)
resp := se.DeleteArea(uid)
c.Data["json"] = resp
_ = c.ServeJSON()
}
func (c *AreaController) AreaGet() {
uid := c.GetString("uid")
se := new(service.AreaService)
resp := se.GetArea(uid)
c.Data["json"] = resp
_ = c.ServeJSON()
}

View File

@ -92,6 +92,12 @@ func (c *ShowPageController) AreaListPage() {
c.TplName = "area-list.html" c.TplName = "area-list.html"
} }
func (c *ShowPageController) AreaEdit() {
uid := c.GetString("uid")
c.Data["uid"] = uid
c.TplName = "area-edit.html"
}
/** /**
** 充值订单 ** 充值订单
*/ */

View File

@ -55,6 +55,7 @@ func initLegend() {
orm.RegisterModel(new(legend.ScalePresent)) orm.RegisterModel(new(legend.ScalePresent))
orm.RegisterModel(new(legend.ScaleTemplate)) orm.RegisterModel(new(legend.ScaleTemplate))
orm.RegisterModel(new(legend.Group)) orm.RegisterModel(new(legend.Group))
orm.RegisterModel(new(legend.Area))
logs.Info("init legend success ......") logs.Info("init legend success ......")

View File

@ -11,8 +11,7 @@ type AnyMoney struct {
GameMoneyName string GameMoneyName string
GameMoneyScale int GameMoneyScale int
LimitLow float64 LimitLow float64
UpdateTime string BaseDao
CreateTime string
} }
const ANYMONEY = "legend_any_money" const ANYMONEY = "legend_any_money"

View File

@ -0,0 +1,92 @@
package legend
import (
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/core/logs"
)
type Area struct {
Id int `orm:"pk;column(id)"`
AreaName string
Uid string
GroupName string
TemplateName string
NotifyUrl string
AttachParams string
BaseDao
}
const AREA = "legend_area"
func (c *Area) TableName() string {
return AREA
}
func InsertArea(area *Area) bool {
o := orm.NewOrm()
if _, err := o.Insert(area); err != nil {
logs.Error("insert area err: ", err)
return false
}
return true
}
func GetAreaByName(name string) *Area {
o := orm.NewOrm()
area := new(Area)
if _, err := o.QueryTable(AREA).Filter("area_name", name).Limit(1).All(area); err != nil {
logs.Error("get area by name err", err)
}
return area
}
func GetAreaAllCount() int {
o := orm.NewOrm()
count, err := o.QueryTable(AREA).Count()
if err != nil {
logs.Error("get area all count err", err)
}
return int(count)
}
func GetAreaList(offset, limit int) []Area {
o := orm.NewOrm()
var areas []Area
if _, err := o.QueryTable(AREA).Limit(limit, offset).OrderBy("-create_time").All(&areas); err != nil {
logs.Error(" get area list err", err)
}
return areas
}
func GetAreaByUid(uid string) *Area {
o := orm.NewOrm()
area := new(Area)
if _, err := o.QueryTable(AREA).Filter("uid", uid).Limit(1).All(area); err != nil {
logs.Error(" get area by uid err : ", err)
}
return area
}
func UpdateArea(area *Area) bool {
o := orm.NewOrm()
if _, err := o.Update(area); err != nil {
logs.Error("update area err", err)
return false
}
return true
}
func DeleteAreaByUid(uid string) bool {
o := orm.NewOrm()
if _, err := o.QueryTable(AREA).Filter("uid", uid).Delete(); err != nil {
logs.Error(" delete area by uid err", err)
return false
}
return true
}

View File

@ -0,0 +1,6 @@
package legend
type BaseDao struct {
UpdateTime string
CreateTime string
}

View File

@ -13,8 +13,7 @@ type FixMoney struct {
GoodsName string GoodsName string
GoodsNo string GoodsNo string
BuyTimes int BuyTimes int
UpdateTime string BaseDao
CreateTime string
} }
const FIXMONEY = "legend_fix_money" const FIXMONEY = "legend_fix_money"

View File

@ -11,8 +11,7 @@ type FixPresent struct {
TemplateName string TemplateName string
Money float64 Money float64
PresentMoney float64 PresentMoney float64
UpdateTime string BaseDao
CreateTime string
} }
const FIXPRESENT = "legend_fix_present" const FIXPRESENT = "legend_fix_present"

View File

@ -6,11 +6,10 @@ import (
) )
type Group struct { type Group struct {
Id int `orm:"pk;column(id)"` Id int `orm:"pk;column(id)"`
GroupName string GroupName string
Uid string Uid string
UpdateTime string BaseDao
CreateTime string
} }
const GROUP = "legend_group" const GROUP = "legend_group"

View File

@ -11,8 +11,7 @@ type ScalePresent struct {
TemplateName string TemplateName string
Money float64 Money float64
PresentScale float64 PresentScale float64
UpdateTime string BaseDao
CreateTime string
} }
const SCALEPRESENT = "legend_scale_present" const SCALEPRESENT = "legend_scale_present"

View File

@ -13,8 +13,7 @@ type ScaleTemplate struct {
UserWarn string UserWarn string
MoneyType string MoneyType string
PresentType string PresentType string
UpdateTime string BaseDao
CreateTime string
} }
const SCALETMPLETE = "legend_scale_template" const SCALETMPLETE = "legend_scale_template"

View File

@ -0,0 +1,9 @@
package request
type AreaReq struct {
AreaName string
GroupName string
TemplateName string
NotifyUrl string
AttachParams string
}

View File

@ -0,0 +1,23 @@
package request
type AddTemplateReq struct {
ScaleTemplateName string `form:"scaleTemplateName"`
ScaleUserName string `form:"scaleUserName"`
ScaleUserNamePoint string `form:"scaleUserNamePoint"`
MoneyType string `form:"moneyType"`
GameMoneyName string `form:"gameMoneyName"`
GameMoneyScale int `form:"gameMoneyScale"`
LimitLowMoney float64 `form:"limitLowMoney"`
PresentType string `form:"presentType"`
FixPrices []float64 `form:"fixPrices"`
GoodsNames []string `form:"goodsNames"`
GoodsNos []string `form:"goodsNos"`
Limits []int `form:"limits"`
PresentFixMoneys []float64 `form:"presentFixMoneys"`
PresentFixPresentMoneys []float64 `form:"presentFixPresentMoneys"`
PresentScaleMoneys []float64 `form:"presentScaleMoneys"`
PresentScales []float64 `form:"presentScales"`
FixUids []string `form:"fixUids"`
PresentScaleUids []string `form:"presentScaleUids"`
PresentFixUids []string `form:"presentFixUids"`
}

View File

@ -0,0 +1,16 @@
package response
import "legend/models/legend"
type AreaListResp struct {
Code int `json:"code"`
Msg string `json:"msg"`
Count int `json:"count"`
Data []legend.Area `json:"data"`
}
type AreaInfoResp struct {
Code int
Msg string
Area *legend.Area
}

View File

@ -35,6 +35,7 @@ func pageInit() {
web.Router("/areaChargeCount.html", &controllers.ShowPageController{}, "*:AreaChargePage") web.Router("/areaChargeCount.html", &controllers.ShowPageController{}, "*:AreaChargePage")
web.Router("/person.html", &controllers.ShowPageController{}, "*:PersonPage") web.Router("/person.html", &controllers.ShowPageController{}, "*:PersonPage")
web.Router("areaAddOrEdit.html", &controllers.ShowPageController{}, "*:AreaAddOrEdit") web.Router("areaAddOrEdit.html", &controllers.ShowPageController{}, "*:AreaAddOrEdit")
web.Router("/areaEdit.html", &controllers.ShowPageController{}, "*:AreaEdit")
} }
/** /**
@ -53,5 +54,11 @@ func logicInit() {
web.Router("/add/group", &controllers.GroupController{}, "*:AddGroup") web.Router("/add/group", &controllers.GroupController{}, "*:AddGroup")
web.Router("/delete/group", &controllers.GroupController{}, "*:DeleteGroup") web.Router("/delete/group", &controllers.GroupController{}, "*:DeleteGroup")
web.Router("/edit/group", &controllers.GroupController{}, "*:EditGroup") web.Router("/edit/group", &controllers.GroupController{}, "*:EditGroup")
web.Router("/add/area", &controllers.AreaController{}, "*:AreaAdd")
web.Router("/area/list", &controllers.AreaController{}, "*:AreaList")
web.Router("/delete/area", &controllers.AreaController{}, "*:AreaDelete")
web.Router("/get/area", &controllers.AreaController{}, "*:AreaGet")
web.Router("/edit/area", &controllers.AreaController{}, "*:AreaEdit")
web.InsertFilter("/*", web.BeforeRouter, filter.LoginFilter) web.InsertFilter("/*", web.BeforeRouter, filter.LoginFilter)
} }

View File

@ -0,0 +1,98 @@
package service
import (
"github.com/rs/xid"
"legend/models/legend"
"legend/request"
"legend/response"
"legend/utils"
)
type AreaService struct {
BaseService
}
func (c *AreaService) AddArea(req *request.AreaReq) *response.BaseResp {
resp := new(response.BaseResp)
area := new(legend.Area)
area.AreaName = req.AreaName
area.GroupName = req.GroupName
area.TemplateName = req.TemplateName
area.NotifyUrl = req.NotifyUrl
area.AttachParams = req.AttachParams
area.UpdateTime = utils.GetNowTime()
area.CreateTime = utils.GetNowTime()
area.Uid = xid.New().String()
if legend.InsertArea(area) {
resp.Code = 0
} else {
resp.Code = -1
resp.Msg = "添加分区失败"
}
return resp
}
func (c *AreaService) AreaList(page, limit int) *response.AreaListResp {
offset := utils.CountOffset(page, limit)
count := legend.GetAreaAllCount()
areas := legend.GetAreaList(offset, limit)
for i, _ := range areas {
areas[i].Id = offset + i + 1
}
areaResp := new(response.AreaListResp)
areaResp.Code = 0
areaResp.Count = count
areaResp.Data = areas
return areaResp
}
func (c *AreaService) DeleteArea(uid string) *response.BaseResp {
resp := new(response.BaseResp)
if legend.DeleteAreaByUid(uid) {
resp.Code = 0
} else {
resp.Code = -1
resp.Msg = "删除分区失败"
}
return resp
}
func (c *AreaService) GetArea(uid string) *response.AreaInfoResp {
resp := new(response.AreaInfoResp)
resp.Code = 0
resp.Msg = "请求成功"
area := legend.GetAreaByUid(uid)
resp.Area = area
return resp
}
func (c *AreaService) EditArea(req *request.AreaReq, uid string) *response.BaseResp {
resp := new(response.BaseResp)
resp.Code = -1
area := legend.GetAreaByUid(uid)
if area == nil || area.AreaName == "" {
resp.Msg = "更新失败"
} else {
area.UpdateTime = utils.GetNowTime()
area.GroupName = req.GroupName
area.TemplateName = req.TemplateName
area.NotifyUrl = req.NotifyUrl
area.AttachParams = req.AttachParams
if legend.UpdateArea(area) {
resp.Msg = "更新失败"
}
}
return resp
}

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
@ -39,16 +39,13 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">分区名称</label> <label class="layui-form-label">分区名称</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="areaname" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> <input type="text" name="areaName" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">选择分组</label> <label class="layui-form-label">选择分组</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="groupname" lay-verify="required"> <select name="groupName" lay-verify="required" id="groupnames">
<option value=""></option>
<option value="0">轩辕</option>
<option value="1">日狗</option>
</select> </select>
</div> </div>
</div> </div>
@ -56,11 +53,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">选择模板</label> <label class="layui-form-label">选择模板</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="selecttemplate" lay-verify="required"> <select name="templateName" id="selecttemplates" lay-verify="required">
<option value=""></option>
<option value="xingsha">星沙二区</option>
<option value="dongguan">东莞</option>
<option value="huizhou">惠州</option>
</select> </select>
</div> </div>
</div> </div>
@ -68,19 +61,19 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">通知地址</label> <label class="layui-form-label">通知地址</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="notifyaddress" required lay-verify="required" autocomplete="on" class="layui-input"> <input type="text" name="notifyUrl" required lay-verify="required" autocomplete="on" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label">附加参数</label> <label class="layui-form-label">附加参数</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name="desc" placeholder="系统会自动发送必带参数附加参数只为补充不填也行。填写格式key1=value1&key2=value2&key3=value3" class="layui-textarea"></textarea> <textarea name="attachParams" placeholder="系统会自动发送必带参数附加参数只为补充不填也行。填写格式key1=value1&key2=value2&key3=value3" class="layui-textarea"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">添加/更新</button> <button class="layui-btn" lay-submit lay-filter="formDemo">添加</button>
<button type="reset" class="layui-btn layui-btn-primary" onclick="backPrePage();">返回上级</button> <button type="reset" class="layui-btn layui-btn-primary" onclick="backPrePage();">返回上级</button>
</div> </div>
</div> </div>
@ -91,6 +84,43 @@
</div> </div>
<script> <script>
// 进入页面
// function onchange() {
$(document).ready(function () {
$.ajax({
url: "/group/list",
success: function (res) {
$("#groupnames option").remove()
let str = '<option value=""></option>'
for (let i = 0; i < res.data.length; i++) {
let group = res.data[i]
str = str + '<option value="' + group.GroupName + '">' + group.GroupName + '</option>'
}
console.log(str)
$("#groupnames").append(str)
layui.use('form', function () {
let form = layui.form
form.render('select')
})
}
})
$.ajax({
url: "/template/list",
success: function (res) {
let str = '<option value=""></option>'
for (let i = 0; i < res.data.length; i++) {
let template = res.data[i]
str = str + '<option value="' + template.TemplateName + '">' + template.TemplateName + '</option>'
}
$("#selecttemplates").append(str)
layui.use('form', function () {
let form = layui.form
form.render('select')
})
}
})
})
// 返回上级页面 // 返回上级页面
function backPrePage() { function backPrePage() {
window.history.back(-1); window.history.back(-1);
@ -98,9 +128,20 @@
layui.use('form', function () { layui.use('form', function () {
let form = layui.form; let form = layui.form;
form.on('submit(back)', function () { form.on('submit(formDemo)', function (data) {
window.history.back(-1); console.log(data.field)
}); $.ajax({
url: "/add/area",
data: data.field,
success: function (res) {
if (res.Code !== 0) {
layer.alert(res.Msg)
} else {
window.history.back(-1);
}
}
})
})
}) })
</script> </script>
</body> </body>

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

166
legend/views/area-edit.html Normal file
View File

@ -0,0 +1,166 @@
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<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" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
<!-- <link rel="stylesheet" href="./css/theme5.css"> -->
<script src="../static/x-admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/x-admin/js/xadmin.js"></script>
<script type="text/javascript" src="../static/js/jquery-3.5.1.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]-->
<script>
// 是否开启刷新记忆tab功能
// var is_remember = false;
</script>
</head>
<body>
<script>
</script>
<div class="layui-fluid">
<div class="layui-collapse">
<div class="layui-card">
<div class="layui-card-header"><strong>编辑分区</strong></div>
<div class="layui-card-body">
<form class="layui-form" action="">
<input class="area-uid" name="uid" value="{{.uid}}" hidden="hidden" />
<div class="layui-form-item">
<label class="layui-form-label">分区名称</label>
<div class="layui-input-inline">
<input type="text" name="areaName" readonly="readonly" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择分组</label>
<div class="layui-input-inline">
<select name="groupName" lay-verify="required" id="groupnames">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择模板</label>
<div class="layui-input-inline">
<select name="templateName" id="selecttemplates" lay-verify="required">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">通知地址</label>
<div class="layui-input-block">
<input type="text" name="notifyUrl" required lay-verify="required" autocomplete="on" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">附加参数</label>
<div class="layui-input-block">
<textarea name="attachParams" placeholder="系统会自动发送必带参数附加参数只为补充不填也行。填写格式key1=value1&key2=value2&key3=value3" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formDemo">更新</button>
<button type="reset" class="layui-btn layui-btn-primary" onclick="backPrePage();">返回上级</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
// 进入页面
$(document).ready(function () {
$.ajax({
url: "/group/list",
success: function (res) {
$("#groupnames option").remove()
let str = '<option value=""></option>'
for (let i = 0; i < res.data.length; i++) {
let group = res.data[i]
str = str + '<option value="' + group.GroupName + '">' + group.GroupName + '</option>'
}
$("#groupnames").append(str)
layui.use('form', function () {
let form = layui.form
form.render('select')
})
}
})
$.ajax({
url: "/template/list",
success: function (res) {
let str = '<option value=""></option>'
for (let i = 0; i < res.data.length; i++) {
let template = res.data[i]
str = str + '<option value="' + template.TemplateName + '">' + template.TemplateName + '</option>'
}
$("#selecttemplates").append(str)
layui.use('form', function () {
let form = layui.form
form.render('select')
})
}
})
$.ajax({
url: "/get/area",
data: {"uid":$(".area-uid").val()},
success: function (res) {
console.log(res)
let area = res.Area
$('input[name="areaName"]').val(area.AreaName)
$("#groupnames").val(area.GroupName);
$("#selecttemplates").val(area.TemplateName)
$('input[name="notifyUrl"]').val(area.NotifyUrl)
$('textarea[name="attachParams"]').val(area.AttachParams)
layui.use('form', function () {
let form = layui.form
form.render('select')
})
}
})
})
// 返回上级页面
function backPrePage() {
window.history.back(-1);
}
layui.use('form', function () {
let form = layui.form;
form.on('submit(formDemo)', function (data) {
console.log(data.field)
$.ajax({
url: "/edit/area",
data: data.field,
success: function (res) {
if (res.Code !== 0) {
layer.alert(res.Msg)
} else {
window.history.back(-1);
}
}
})
})
})
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
@ -37,7 +37,7 @@
<script type="text/html" id="toolbarHead"> <script type="text/html" id="toolbarHead">
<div class="layui-btn-container"> <div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="create-area"><i class="layui-icon layui-icon-add-1"></i>创建分区</button> <button class="layui-btn layui-btn-sm" lay-event="create-area"><i class="layui-icon layui-icon-add-1"></i>创建分区</button>
<button class="layui-btn layui-btn-sm" lay-event="flush"><i class="layui-icon layui-icon-refresh-3"></i></button> <button class="layui-btn layui-btn-sm" lay-event="flush" onclick="flush()"><i class="layui-icon layui-icon-refresh-3"></i></button>
</div> </div>
</script> </script>
@ -51,47 +51,62 @@
</script> </script>
<script> <script>
layui.use('table', function () { layui.use('table', function () {
let table = layui.table; let table = layui.table;
table.render({ table.render({
elem: "#demo" elem: "#demo"
,height: 500 ,height: 500
,url: '/static/data/area.json' //数据接口 ,url: '/area/list' //数据接口
,page: true //开启分页 ,page: true //开启分页
,limits: [10, 20, 30, 50, 100, 200] ,limits: [10, 20, 30, 50, 100]
,cols: [[ //表头 ,cols: [[ //表头
{field: 'id', title: 'ID', sort: true, fixed: 'left'} {field: 'Id', title: 'ID', sort: true, fixed: 'left'}
,{field: 'areaname', title: '分区名称'} ,{field: 'AreaName', title: '分区名称'}
,{field: 'usetemplate', title: '使用模板', sort: true} ,{field: 'Uid', title: "分区id"}
,{field: 'currencyname', title: '货币名称', sort:false} ,{field: "GroupName", title: "分组名称"}
,{field: 'rechargescale', title: '充值比例', sort: true} ,{field: 'TemplateName', title: '使用模板', sort: true}
,{field: 'areastatus', title: '分区状态', sort: true} ,{field: "NotifyUrl", title: "通知地址"}
,{field: 'createtime', title: '创建时间', sort:true} ,{field: "AttachParams", title:"附加参数"}
,{fixed: 'right', title: "操作", width:240, align:'center', toolbar: '#toolbarDemo'} ,{field: 'CreateTime', title: '创建时间', sort:true}
,{fixed: 'right', title: "操作", width:260, align:'center', toolbar: '#toolbarDemo'}
]] ]]
,toolbar: "#toolbarHead" ,toolbar: "#toolbarHead"
}); });
table.on('toolbar(test)', function (data) {
let event = data.event;
if ("create-area" === event) {
}
});
// 监听行工具事件 // 监听行工具事件
table.on('tool(test)', function (data) { table.on('tool(test)', function (data) {
let event = data.event; let event = data.event;
if ("imitate-recharge-url" === event) { if ("imitate-recharge-url" === event) {
location.href = "https://www.baidu.com"; // location.href = "https://www.baidu.com";
} else if ("edit-area" === event) { } else if ("edit-area" === event) {
location.href = "/areaAddOrEdit.html" + "?id=" + data.data.id; location.href = "/areaEdit.html" + "?uid=" + data.data.Uid;
} else if ("delete-area" === event) { } else if ("delete-area" === event) {
layer.confirm("是否要删除该行?", { layer.confirm("是否要删除该行?", {
btn:["YES", "NO"] btn:["YES", "NO"]
},function () { },function (index) {
layer.msg("请做删除分组的代码逻辑"); console.log(data.data)
$.ajax({
url: "/delete/area",
data: {
"uid":data.data.Uid
},
success: function (res) {
if (res.Code !== 0) {
layer.alert("删除分组失败")
} else {
data.del()
table.reload('demo',{
url: "/area/list",
where: {
"page": 1
}
})
}
layer.close(index)
}
})
}, function (index) { }, function (index) {
layer.close(index); layer.close(index);
return false; return false;
@ -105,6 +120,13 @@
let event = data.event; let event = data.event;
if ("create-area" === event) { if ("create-area" === event) {
location.href = "/areaAddOrEdit.html" location.href = "/areaAddOrEdit.html"
} else if ("flush" === event) {
table.reload('demo', {
url: "/area/list",
where : {
"page":1
}
})
} }
}) })
}) })

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -5,7 +5,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
@ -107,7 +107,7 @@
</a> </a>
</li> </li>
<li> {{/*<li>
<a onclick="xadmin.add_tab('每日充值统计', './everydayChargeCount.html')"> <a onclick="xadmin.add_tab('每日充值统计', './everydayChargeCount.html')">
<i class="layui-icon layui-icon-survey"></i> <i class="layui-icon layui-icon-survey"></i>
<cite><strong>每日充值统计</strong></cite> <cite><strong>每日充值统计</strong></cite>
@ -124,7 +124,7 @@
<i class="layui-icon layui-icon-link"></i> <i class="layui-icon layui-icon-link"></i>
<cite><strong>分区充值统计</strong></cite> <cite><strong>分区充值统计</strong></cite>
</a> </a>
</li> </li>*/}}
</ul> </ul>
</div> </div>

View File

@ -5,7 +5,7 @@
<title>游戏充值商户后台</title> <title>游戏充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/login.css"> <link rel="stylesheet" href="../static/x-admin/css/login.css">

View File

@ -5,7 +5,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -5,7 +5,7 @@
<title>游戏充值商户后台</title> <title>游戏充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/login.css"> <link rel="stylesheet" href="../static/x-admin/css/login.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
@ -132,7 +132,7 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<br> <br>
<button class="layui-btn" lay-filter="add" lay-submit="">保存/添加</button> <button class="layui-btn" lay-filter="add" lay-submit="">添加</button>
<div class="layui-btn layui-btn-danger" onclick="back();">返回当前页</div> <div class="layui-btn layui-btn-danger" onclick="back();">返回当前页</div>
</div> </div>
</form> </form>

View File

@ -6,7 +6,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">

View File

@ -5,7 +5,7 @@
<title>充值商户后台</title> <title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <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" /> {{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css"> <link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css"> <link rel="stylesheet" href="../static/x-admin/css/xadmin.css">