Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
ELF 5 years ago
commit 659c27b930

@ -69,7 +69,7 @@ class SupportController extends BaseController {
$count=M('support','tab_')->field('id')->where($map)->select();
$count = count($count);
$parameter = I();
$parameter = I("get.");
$parameter['p']=I('get.p',1);
$parameter['row']=I('get.row');
@ -134,7 +134,7 @@ class SupportController extends BaseController {
$data[$key]['sum_support_num'] =$data1[0]['sum_support_num']+$value['real_support_num'];
}
$parameter =I();
$parameter =I("get.");
$parameter['p']=I('get.p',1);
$parameter['row']=I('get.row');
@ -207,7 +207,7 @@ class SupportController extends BaseController {
$count=count($data);
//分页
$parameter = I();
$parameter = I("get.");
$parameter['p']=I('get.p',1);
$parameter['row']=I('get.row');

@ -40,6 +40,7 @@ class TestResourceController extends BaseController
->join('left join tab_user as user on tab_support.user_id = user.id')
->where($map)
->page($page,$row)
->order('tab_support.create_time DESC')
->select();
foreach ($data as $key => $value) {
@ -104,24 +105,313 @@ class TestResourceController extends BaseController
$this->ajaxReturn(['status'=>0, 'msg'=> '重置密码失败']);
}
}
protected function _initialize()
{
parent::_initialize();
$map['id'] = get_pid();
$pro = M("promote", "tab_")->where($map)->find();
if ($pro['parent_id']!=0) {
$this->error('无权操作!');
}
}
public function index($p=0)
{
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map =array();
if(!empty(I('role_name'))){
$map['role_name']=['like','%'.I('role_name').'%'];
}
if(!empty(I('server_name'))){
$map['server_name']=I('server_name');
}
if(!empty(I('game_name'))){
$map['game_name']=I('game_name');
}
if(!empty(I('user_account'))){
$map['user_account']=['like','%'.I('user_account').'%'];
}
if(!empty($_REQUEST['start'])&&empty($_REQUEST['end'])){
$map['create_time'] = array('GT',strtotime($_REQUEST['start']));
unset($_REQUEST['start']);
}
if(empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){
$map['create_time'] = array('LT',strtotime($_REQUEST['end'])+24*60*60-1);
unset($_REQUEST['end']);
}
if(!empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){
$map['create_time'] = array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
unset($_REQUEST['start']);unset($_REQUEST['end']);
}
//
$res = D("test_resource")->getResourceCout($map,$page,$row);
// dump($res);
$parameter =I('get.');
$parameter['p']=I('get.p',1);
$parameter['row']=I('get.row');
$page = set_pagination($res["count"],$row,$parameter);
if($page) {$this->assign('_page', $page);}
$this->meta_title = '测试资源';
$this->assign('data',$res['list']);
$this->assign('count',$res["count"]);
$this->display();
# code...
}
/**
* 获取区服列表
* @param $game_id
*/
public function getServer($game_id=""){
* 获取区服列表
* @param $game_id
*/
public function getServer($game_id="")
{
$map['game_id']=$game_id;
$map['start_time']=['lt',time()];
if(I('status')==2){
if (I('status')==2) {
$map['show_status']=1;
}
$data = M('server','tab_')
->field('tab_server.server_name,support_quota')
->where($map)
->join('join tab_game tg ON tg.id=tab_server.game_id')
->select();
$data = M('server', 'tab_')
->field('tab_server.id,tab_server.server_name,support_quota')
->where($map)
->join('join tab_game tg ON tg.id=tab_server.game_id')
->select();
$this->AjaxReturn($data);
}
//获取当前和当前子渠道的渠道id
public function get_all_promote(){
$pro_id=get_prmoote_chlid_account(session('promote_auth.pid'));
foreach ($pro_id as $key => $value) {
$pro_id1[]=$value['id'];
}
if(!empty($pro_id1)){
$pro_id2=array_merge($pro_id1,array(get_pid()));
}else{
$pro_id2=array(get_pid());
}
return $pro_id2;
}
/**
* 系统非常规MD5加密方法
* @param string $str 要加密的字符串
* @return string
*/
public function think_ucenter_md5($str, $key = 'ThinkUCenter'){
return '' === $str ? '' : md5(sha1($str) . $key);
}
//新增扶持
public function add()
{
// dump(I('post.'));
if (IS_POST) {
$count=count(I('user_account'));
session('apply_status', 0);
(empty(I('server_id')) || I('server_id')<1) && $this->ajaxReturn(['msg'=>$i_account.'请选择区服' ,'status'=>0]);
M('test_resource', 'tab_')->startTrans(); //事物
for ($i=0; $i < $count ; $i++) {
$i_account=I('user_account')[$i];
if (!empty($i_account)) {
$user=M('user', 'tab_')->field('promote_id,password,phone')->where(['account'=>$i_account])->find();
$promote = $this->get_all_promote();
if (!in_array($user['promote_id'], $promote)) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>$i_account.'账号不存在' ,'status'=>0]);
}
if (empty(I('user_password')[$i])) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>I('user_account')[$i].'请输入密码' ,'status'=>0]);
}
if ($user['password']!=$this->think_ucenter_md5(I('user_password')[$i], UC_AUTH_KEY)) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>$i_account.'密码不正确' ,'status'=>0]);
}
if (empty(I('role_name')[$i])) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>I('user_account')[$i].'请输入角色名' ,'status'=>0]);
}
$supportNum = I('apply_resource')[$i];
if (empty($supportNum)) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>I('user_account')[$i].'请输入资源数量' ,'status'=>0]);
}
if ($supportNum<0 || !preg_match('/^[1-9]\d*$/', $supportNum)) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>I('user_account')[$i].'请输入资源数量' ,'status'=>0]);
}
$map['game_id']=I('game_id');
$map['server_id']=I('server_id');
$map['user_account']=I('user_account')[$i];
// $map['apply_status']=['neq',0];
$map['apply_type']=0;
$list= M('test_resource', 'tab_')->where($map)->find();
if ($list) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>I('user_account')[$i].'账号已存在' ,'status'=>0]);
}
//TODO:额度未进行验证
// $support_quota = M('game', 'tab_')->field('support_quota')->find(get_game_id(I('game_name')));
// if ($support_quota['support_quota'] < I('support_num')[$i]) {
// M('test_resource', 'tab_')->rollback();//回滚
// $this->ajaxReturn(['msg'=>'超出申请额度' ,'status'=>0]);
// }
$data['game_id']=I('game_id');
$data['game_name']=I('game_name');
$data['server_id']=I('server_id');
$data['server_name']=I('server_name');
$data['user_account']=I('user_account')[$i];
$data['user_id']=get_user_id(I('user_account')[$i]);
$data['user_password']=I('user_password')[$i];
$data['phone']=$user['phone'];
$data['role_name']=I('role_name')[$i];
$data['apply_resource']=I('apply_resource')[$i];
$data['apply_remark']=I('apply_remark')[$i];
$data['apply_name']=$_SESSION['onethink_home']['promote_auth']['account'];
$data['apply_id']=$_SESSION['onethink_home']['promote_auth']['pid'];
$data['promote_id']=session("promote_auth.pid");
$data['promote_account']=session("promote_auth.account");
$data['create_time']=time();
$data['apply_type']=0;
$model = M('test_resource', 'tab_')->add($data);
if ($model) {
session('apply_status', 1);
}
} else {
if (I('user_password')[$i]) {
M('test_resource', 'tab_')->rollback();//回滚
$this->ajaxReturn(['msg'=>'请输入账号' ,'status'=>0]);
}
}
}
if (session('apply_status')==0) {
session('apply_status', null);
$this->ajaxReturn(['msg'=>'请输入账号' ,'status'=>0]);
}
M('test_resource', 'tab_')->commit(); //提交事物
$this->ajaxReturn(['msg'=>'' ,'status'=>1]);
} else {
$this->meta_title = '新增测试账号';
$this->display();
}
}
//修改申请
public function apply_edit(){
$user=M('user','tab_')->field('password')->where(['account'=>I('user_account')])->find();
if($user['password'] !== $this->think_ucenter_md5(I('user_password'), UC_AUTH_KEY)){
$this->ajaxReturn(['status'=>0,'msg'=>'密码不正确']);
}
$data['user_password']=I('user_password');
$data['role_name']=I('role_name');
$map = I("post.");
unset($map['user_password']);
unset($map['role_name']);
$res=M('test_resource','tab_')->where($map)->save($data);
if($res===false){
$this->ajaxReturn(['status'=>0,'msg'=>'修改失败']);
}else{
$this->ajaxReturn(['status'=>1,'msg'=>'修改成功']);
}
}
//后续申请
public function apply(){
$ids = explode(',', I('id'));
foreach ($ids as $key => $value) {
$map['id']=$value;
$support=M('test_resource','tab_')->field('promote_id')->where($map)->find();
if($support['promote_id'] !=session("promote_auth.pid") || empty($support) ){
$this->error('数据错误');
}
}
$this->meta_title = '申请后续';
$this->display();
}
//申请新增扶持(单个或批量申请)
public function batch_apply(){
$ids = explode(',', I('apply_id'));
M('test_resource','tab_')->startTrans(); //事物
foreach ($ids as $key => $value) {
$map['id']=$value;
$support=M('test_resource','tab_')->where($map)->find();
if(I('apply_resource') <0 || !preg_match('/^[1-9]\d*$/', I('apply_resource', 0))){
M('test_resource','tab_')->rollback();//回滚
$this->ajaxReturn(['status'=>0,'msg'=>'申请资源数量有误']);
}
if(empty($support)){
M('test_resource','tab_')->rollback();//回滚
$this->ajaxReturn(['status'=>0,'msg'=>'数据有误']);
}
//TODO:额度未进行验证
// $max_quota=$this->max_quota($support['game_id'],$support['server_name']);//最大申请额度
// if(count($ids)>1){
// $map_s['game_id']=$support['game_id'];
// $map_s['server_name']=$support['server_name'];
// $map_s['id'] =['in',$ids];
// $count=M('support','tab_')->where($map_s)->count();
// $max_quota = floor($max_quota/$count);
// }
// if(I('support_num') > $max_quota){
// M('support','tab_')->rollback();//回滚
// $this->ajaxReturn(['status'=>0,'msg'=>'扶持申请额度不足,最大额度:'.$max_quota]);
// }
if($support['promote_id'] !=session("promote_auth.pid") || empty($support) ){
M('test_resource','tab_')->rollback();//回滚
$this->ajaxReturn(['status'=>0,'msg'=>'申请失败']);
}
$data['game_id']=$support['game_id'];
$data['game_name']=$support['game_name'];
$data['server_id']=$support['server_id'];
$data['server_name']=$support['server_name'];
$data['user_account']=$support['user_account'];
$data['user_id']=$support['user_id'];
$data['user_password']=$support['user_password'];
$data['phone']=$support['phone'];
$data['role_name']=$support['role_name'];
$data['apply_resource']=I('apply_resource');
$data['apply_remark']=I('apply_remark');
$data['apply_name']=$_SESSION['onethink_home']['promote_auth']['account'];
$data['apply_id']=$_SESSION['onethink_home']['promote_auth']['pid'];
$data['promote_id']=session("promote_auth.pid");
$data['promote_account']=session("promote_auth.account");
$data['create_time']=time();
$data['apply_type']=1;
//
$model = M('test_resource','tab_')->add($data);
if($model===false){
M('test_resource','tab_')->rollback();//回滚
$this->ajaxReturn(['status'=>0,'msg'=>'申请失败']);
}else{
//成功
}
}
M('test_resource','tab_')->commit(); //提交事物
$this->ajaxReturn(['status'=>1,'msg'=>'申请成功']);
}
}

@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace Home\Model;
use Think\Model;
/**
* 分类模型
*/
class TestResourceModel extends Model{
/**
* 构造函数
* @param string $name 模型名称
* @param string $tablePrefix 表前缀
* @param mixed $connection 数据库连接信息
*/
public function __construct($name = '', $tablePrefix = '', $connection = '') {
/* 设置默认的表前缀 */
$this->tablePrefix ='tab_';
/* 执行构造方法 */
parent::__construct($name, $tablePrefix, $connection);
}
/**
* 获取统计 $map,$page,$row
*/
public function getResourceCout($map,$page,$row) {
$promote_id=session("promote_auth.pid");
//获取基本信息
$res = $this
->table("tab_test_resource as test")
->field("test.*,user.check_status")
->join('tab_user user on test.user_id=user.id','left')
->page($page,$row)
->order("create_time desc")
->where($map)
->group("user_id,game_id,server_id")
->select();
//获取统计
if(empty($res)){
return $res;
}
$rescount = $this
->where($map)
->group("user_id,game_id,server_id")
->buildSql();
$rescount = $this->table($rescount.' a')->count();
//生成idstr
foreach ($res as $key => $value) {
$value['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
//获取累计发放
$where = array(
"user_id"=>$value['user_id'],
"game_id"=>$value['game_id'],
"server_id"=>$value['server_id']
);
$where1 = array(
"apply_status"=>2,
);
//获取累计
$verify_resource = $this->field("IFNULL(sum(verify_resource),0) verify_resource_count,count(*) verify_count")->where(array_merge($where,$where1))->find();
//获取申请
$where2 = array(
"apply_status"=>0,
);
$apply_resource = $this->field("IFNULL(sum(apply_resource),0) apply_resource_count")->where(array_merge($where,$where2))->find();
$res[$key] = array_merge($value,$verify_resource,$apply_resource);
}
return array("list"=>$res,"count"=>$rescount);
}
}

@ -78,14 +78,20 @@
<!-- </if> -->
<!-- </div> -->
<!-- <eq name="parent_id" value="0">
<eq name="parent_id" value="0">
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>测试资源</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('TestResource/index')}" class="<if condition='CONTROLLER_NAME eq TestResource and (ACTION_NAME eq index or ACTION_NAME eq add or ACTION_NAME eq apply ) '>active</if> ">测试资源申请</a>
</div>
</eq>
<eq name="parent_id" value="0">
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>扶持管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Support/index')}" class="<if condition='CONTROLLER_NAME eq Support and (ACTION_NAME eq index or ACTION_NAME eq add or ACTION_NAME eq apply ) '>active</if> ">扶持申请</a>
<a href="{:U('Support/lists')}" class="<if condition='CONTROLLER_NAME eq Support and ACTION_NAME eq lists '>active</if> ">扶持记录</a>
<a href="{:U('Support/quota')}" class="<if condition='CONTROLLER_NAME eq Support and ACTION_NAME eq quota '>active</if> ">扶持额度</a>
</div>
</eq> -->
</eq>
<!--<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>会长福利</span><i class="arrow_icon"></i></div>-->
<if condition="get_promote_levels(session('promote_auth.pid')) neq '三级推广员'">

@ -0,0 +1,409 @@
<extend name="Public/promote_base" />
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<style>
.my_text {
position: relative;
padding: 0 10px;
border: 1px solid #D5D5D5;
border-radius: 5px;
outline: none;
font-size: 14px;
font-family: inherit;
height: 38px;
line-height: 38px;
}
#submit1 {
background: #526782;
border-radius: 5px;
border: none;
color: #FFF;
cursor: pointer;
transition: .8s;
height: 38px;
line-height: 38px;
outline: none;
font-size: 14px;
font-family: inherit;
width: 120px;
}
.del-act {
color: #19ADED;
text-decoration: none;
line-height: 68px;
border-collapse: collapse;
border-spacing: 0;
}
.add-act {
color: #19ADED;
text-decoration: none;
line-height: 68px;
border-collapse: collapse;
border-spacing: 0;
}
</style>
</block>
<block name="body">
<form method="post" enctype="multipart/form-data" id="form1" action="javascript:;">
<div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>测试资源</span><span>测试资源申请></span><span>新增测试账号</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_shenqing.png">
<span class="title_main">新增测试账号</span>
<span class="details">说明:新增测试账号</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<div id="">
<div class="form-group normal_space fr" id='support_quota' style="line-height: 37px;">
</div>
<div class="form-group normal_space fr">
<span id="server_js">
<select id="server_id" name="server_name" class="reselect select_gallery"
style="width:101px">
<option server-id="0" value="0">请选择区服</option>
<volist name=":getServer_name_on($_GET['game_name'],2)" id="vo">
<option data-server-id="{$vo.id}" value="{$vo.server_name}" <if
condition="$_GET['server_name'] eq $vo['server_name']">selected="selected"
</if>>{$vo.server_name}</option>
</volist>
<!-- <option value="{:$_GET['server_name']}"> {:$_GET['server_name']}
</option> -->
</select>
</span>
</div>
<div class="form-group normal_space fr">
<select id="game_id" name="game_name" class="reselect select_gallery">
<option game-id="0" value="0">请选择游戏</option>
<volist name=":get_game_list()" id="vo">
<option game-id="{$vo.id}" value="{$vo.game_name}">{$vo.game_name}</option>
</volist>
</select>
</div>
</div>
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>测试账号</th>
<th>密码</th>
<th>角色名称</th>
<th>资源数量</th>
<th>备注</th>
<th>操作</th>
</tr>
<tr class="table_tr" data-val='0'>
<td>
<div class="from-element from-input">
<input type="text" title="账号" placeholder="账号" class="my_text"
name='user_account[]'></div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="密码" placeholder="密码" class="my_text"
name='user_password[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="角色名称" placeholder="角色名称" class="my_text"
name='role_name[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" maxlength="19" placeholder="申请元宝或钻石数量" title="申请数量"
class="my_text" name='apply_resource[]'
onkeyup="value=value.replace(/[^\d]/g,'')">
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" placeholder="备注" maxlength="100" class="my_text"
name='apply_remark[]'>
</div>
</td>
<td>
<a href="javascript:;" class="support-act del-act">删除</a>
<a href="javascript:;" class="support-act add-act" style="display: none;">新增</a>
</td>
</tr>
<tr class="table_tr" data-val='1'>
<td>
<div class="from-element from-input">
<input type="text" title="账号" placeholder="账号" class="my_text"
name='user_account[]'></div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="密码" placeholder="密码" class="my_text"
name='user_password[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="角色名称" placeholder="角色名称" class="my_text"
name='role_name[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" maxlength="19" placeholder="申请元宝或钻石数量" title="申请数量"
class="my_text" name='apply_resource[]'
onkeyup="value=value.replace(/[^\d]/g,'')">
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" placeholder="备注" maxlength="100" class="my_text"
name='apply_remark[]'>
</div>
</td>
<td>
<a href="javascript:;" class="support-act del-act">删除</a>
<a href="javascript:;" class="support-act add-act" style="display: none;">新增</a>
</td>
</tr>
<tr class="table_tr" data-val='0'>
<td>
<div class="from-element from-input">
<input type="text" title="账号" placeholder="账号" class="my_text"
name='user_account[]'></div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="密码" placeholder="密码" class="my_text"
name='user_password[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" title="角色名称" placeholder="角色名称" class="my_text"
name='role_name[]'>
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" maxlength="19" placeholder="申请元宝或钻石数量" title="申请数量"
class="my_text" name='apply_resource[]'
onkeyup="value=value.replace(/[^\d]/g,'')">
</div>
</td>
<td>
<div class="from-element from-input">
<input type="text" placeholder="备注" maxlength="100" class="my_text"
name='apply_remark[]'>
</div>
</td>
<td>
<a href="javascript:;" class="support-act del-act">删除</a>
<a href="javascript:;" class="support-act add-act"
style="display: inline-block;">新增</a>
</td>
</tr>
</table>
<div class="import" style="padding-left:90%;margin-bottom: 15px;">
<input type="submit" class="submit" id='submit1' value="保存" url="{:U('Support/add')}">
</div>
</div>
</div>
</div>
</form>
</block>
<block name="script">
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript">
$().ready(function () {
$("#pagehtml a").on("click", function (event) {
event.preventDefault();//使a自带的方法失效即无法调整到href中的URL(http://www.baidu.com)
var geturl = $(this).attr('href');
$('#data_form').attr('action', geturl);
$('#data_form').submit();
});
$('#sdate').datetimepicker({
lang: 'ch',
format: 'Y-m-d',
formatDate: 'Y-m-d',
timepicker: false
});
$(".select_gallery").select2();
$('#edate').datetimepicker({
lang: 'ch',
format: 'Y-m-d',
formatDate: 'Y-m-d',
timepicker: false
});
});
</script>
<script type="text/javascript">
//去除空值
function serializeNotNull(serStr) {
return serStr.split("&").filter(str => !str.endsWith("=")).join("&");
}
var gload_game_id = 0;
var gload_server_id = 0;
$("#submit1").click(function () {
var game_id = $('#game_id').val();
var server_id = $('#server_id').val();
if (game_id == 0 || game_id == '') {
layer.msg('请选择游戏');
return false;
}
if (server_id == 0 || server_id == '') {
layer.msg('请选择区服');
return false;
}
var data = $("form").serialize();
var g_game_id = $("#game_id option:selected").attr('game-id');
var g_server_id = $("#server_id option:selected").attr('server-id');
data = "game_id="+g_game_id+"&server_id="+g_server_id+"&"+data;
$.ajax({
url: "{:U('add')}",
type: "post",
data: data,
dataType: 'json',
success: function (data) {
if (data.status == 0) {
layer.msg(data.msg);
} else {
layer.msg('申请成功');
setTimeout(function () {
window.location.href = "{:U('index')}";
}, 1500);
}
}
})
});
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServer')}",
type: "post",
data: { game_id: $("#game_id option:selected").attr('game-id'), status: 2 },
dataType: 'json',
success: function (data) {
console.log();
str = "<option value=''>请选择区服</option>";
var support_quota = "<span>单角色可申请上限0</span>";
for (var i in data) {
str += "<option server-id="+data[i].id+" value='" + data[i].server_name + "'>" + data[i].server_name + "</option>"
var support_quota = "<span>单角色可申请上限:" + data[i].support_quota + "</span>"
}
$('#support_quota').html(support_quota);
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
})
$("#server_js").click(function (event) {
var game_id = $("#game_id").val();
if (game_id == 0) {
layer.msg('请先选择游戏');
}
});
$('.table').on("click", '.add-act', function (event) {
$(".table").find("tr:last").find('td:last').find('a:last').css("display", 'none');
var rowNum = $(".table tr").size() - 1;
var html = "<tr class='table_tr' data-val='" + rowNum + "'><td><div class='from-element from-input'><input type='text' class='my_text' title='账号' placeholder='账号' name='user_account[]' ></div></td><td><div class='from-element from-input'><input type='text' title='密码' class='my_text' placeholder='密码' name='user_password[]'></div></td><td><div class='from-element from-input'><input type='text' title='角色名称' placeholder='角色名称' class='my_text' name='role_name[]'></div></td><td><div class='from-element from-input'><input type='text' maxlength='19' placeholder='申请元宝或钻石数量' title='申请数量' class='my_text' name='support_num[]' onkeyup = " + '"' + "value=value.replace(/[^\\d]/g,'')" + '"' + "></div></td><td><div class='from-element from-input'><input type='text' placeholder='备注' class='my_text' maxlength='100' name='remarks[]'></div></td><td><a href='javascript:;' class='support-act del-act'>删除</a>&nbsp<a href='javascript:;' class='support-act add-act' style='display: inline-block;' >新增</a></td></tr>";
$(".table").append(html);
});
$('.table').on("click", '.del-act', function (event) {
var rowNum = $(".table tr").size() - 1;
if (rowNum > 1) {
$(this).closest("tr").remove();
$(".table").find("tr:last").find('td:last').find('a:last').css("display", ' inline-block');
}
});
</script>
</block>

@ -0,0 +1,88 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>扶持管理></span><span>扶持申请></span><span>申请后续</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_shenqing.png">
<span class="title_main">申请后续</span>
<span class="details">说明:申请后续</span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('apply')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<tr>
<td class="l">扶持数量:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="apply_resource" id="apply_resource" placeholder="扶持数量" onkeyup = "value=value.replace(/[^\d]/g,'')">
<p id="account_tip"></p>
</td>
</tr>
<tr>
<td class="l">备注:</td>
<td class="r">
<input type="text" class="name txt" name="apply_remark" id="apply_remark" placeholder="备注">
<span id="password_tip"></span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="hidden" name="id" value="{$_GET['id']}" id="apply_id"></input>
<input type="button" class="tj btn ajax-post" onclick="check()" value="确认添加" title="" target-form="base_info">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript">
function check() {
var apply_resource = $('#apply_resource').val();
var apply_remark = $('#apply_remark').val();
var apply_id = $('#apply_id').val();
if(apply_resource == '' || apply_resource ==0){
layer.msg('扶持数量不能为空');
return false;
}
$.ajax({
type:"POST",
url:"{:U('batch_apply')}",
data:{
apply_resource:apply_resource,
apply_remark:apply_remark,
apply_id:apply_id
},
dataType:"json",
success:function(res){
if(res.status == 1){
layer.msg(res.msg);
setTimeout(function(){
window.location.href="{:U('index')}";
},1000);
}else{
layer.msg(res.msg);
}
}
});
}
</script>
</block>

@ -0,0 +1,533 @@
<extend name="Public/promote_base" />
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.open_edit {
color: #19ADED;
text-decoration: none;
line-height: 40px;
border-collapse: collapse;
border-spacing: 0;
}
.apply {
color: #19ADED;
text-decoration: none;
line-height: 40px;
border-collapse: collapse;
border-spacing: 0;
}
.my_text {
position: relative;
padding: 0 10px;
border: 1px solid #D5D5D5;
border-radius: 5px;
outline: none;
font-size: 14px;
font-family: inherit;
height: 38px;
line-height: 38px;
}
.my_save {
width: 95px;
height: 36px;
line-height: 38px;
display: block;
background: #26C7DB;
color: #fff;
border: none;
border-radius: 4px;
text-align: center;
float: left;
cursor: pointer;
text-decoration: none;
padding: 0;
margin: 14px;
font-family: "微软雅黑";
box-sizing: border-box;
}
.td_tit {
width: 112px;
text-align: right;
padding: 0 24px 0 6px;
border: none;
}
</style>
</block>
<block name="body">
<div class="div_editor" style="display:none;">
<form action="">
<table class="" style="border-collapse:separate; border-spacing:0px 10px;">
<tbody>
<tr>
</tr>
<tr>
<td class="td_tit"><span style="color: red">*</span>游戏名称</td>
<td><input class="my_text" type="text" size="50" value="" id='i_game_name' placeholder=""
disabled="disabled"></td>
</tr>
<tr>
<td class="td_tit"><span style="color: red">*</span>游戏区服</td>
<td><input class="my_text" type="text" size="50" value="" id='i_server_name' placeholder=""
disabled="disabled"></td>
</tr>
<tr>
<td class="td_tit"><span style="color: red">*</span>账号</td>
<td><input class="my_text" type="text" size="50" value="" id='i_account' placeholder=""
disabled="disabled"></td>
</tr>
<tr>
<td class="td_tit"><span style="color: red">*</span>密码</td>
<td><input class="my_text" type="text" size="50" value="" id='i_password' placeholder=""></td>
</tr>
<tr>
<td class="td_tit"><span style="color: red">*</span>角色名称</td>
<td><input class="my_text" type="text" size="50" value="" id='i_role_name' placeholder=""></td>
</tr>
<input class="" type="hidden" size="50" value="" id='i_support_id' placeholder="">
<tr>
<td class="">&nbsp;</td>
<td class="td_tit"><a class="i_save my_save" data-id="">保存</a><a class="i_cancel my_save">取消</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>测试资源></span><span>测试资源申请</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_shenqing.png">
<span class="title_main">申请测试资源</span>
<span class="details">说明:申请测试资源</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<div id="form1">
<div class="form-group normal_space fr">
<input type="submit" class="submit" id='submit' value="查询" url="{:U('index')}"
style="cursor:pointer;">
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title" style="margin-right: 9px;"></label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}">
</div>
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title">申请时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="start" placeholder="开始时间"
value="{:I('start')}">
</div>
</div>
<div class="form-group normal_space fr">
<input type="text" name="role_name" class="txt normal_txt" style="width:128px;"
placeholder="角色名称" value="{:I('role_name')}" onKeyDown="webchat_chkkeysend(event);">
</div>
<div class="form-group normal_space fr">
<input type="text" name="user_account" class="txt normal_txt" id="uid" style="width:128px;"
placeholder="测试账号" value="{:I('user_account')}" onKeyDown="webchat_chkkeysend(event);">
</div>
<div class="form-group normal_space fr">
<span id="server_js">
<select id="server_id" name="server_name" class="reselect select_gallery"
style="width:101px">
<option game-id="0" value="">请选择区服</option>
<volist name=":getServer_name_on($_GET['game_name'])" id="vo">
<option value="{$vo.server_name}" <if
condition="$_GET['server_name'] eq $vo['server_name']">selected="selected"</if>
>{$vo.server_name}</option>
</volist>
</select>
</span>
</div>
<div class="form-group normal_space fr">
<select id="game_id" name="game_name" class="reselect select_gallery">
<option game-id="0" value="">请选择游戏</option>
<volist name=":get_game_list()" id="vo">
<option game-id="{$vo.id}" value="{$vo.game_name}" <if
condition="$_GET['game_name'] eq $vo['game_name']">selected="selected"</if>
>{$vo.game_name}</option>
</volist>
</select>
</div>
<br>
<br>
<br>
<div class="form-group normal_space fr">
<input type="button" class="submit" id='batch_add'
style="width: 100px;text-align: center;background:rgb(249,104,104);cursor:pointer;"
value="批量申请后续">
</div>
<div class="form-group normal_space fr">
<input type="button" class="submit" id='add'
style="width: 100px;text-align: center;background:rgb(249,104,104);cursor:pointer;"
value="新增测试号" url="{:U('add')}">
</div>
</div>
</div>
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>
<label class="checked">
<input class="check-all" type="checkbox">
<i class="check_icon"></i>
</label>
</th>
<th>产品名称</th>
<th>区服</th>
<th>测试账号</th>
<th>所属推广员</th>
<th>角色名称</th>
<th>累计发放资源</th>
<th>累计发放次数</th>
<th>申请数量</th>
<th>状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
<empty name="data">
<tr>
<td colspan="12" style="text-align: center;height: 45vh;"><img
src="__IMG__/20180207/icon_wushujv2.png" />
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else />
<volist name="data" id="s" mod="2">
<tr class="<eq name='mod' value='1'>odd</eq>">
<td>
<label class="checked">
<input class="ids" type="checkbox" value="{$s['id']}" name="ids[]">
<i class="check_icon"></i>
</label>
</td>
<td>{$s.game_name}</td>
<td>{$s.server_name}</td>
<td>{$s.user_account}</td>
<td>{$s.promote_account}</td>
<td>{$s.role_name}</td>
<td>{$s.verify_resource_count}</td>
<td>{$s.verify_count}</td>
<td>{$s.apply_resource_count}</td>
<td>
<if condition="$s['check_status'] eq 1">
正常
<else />
冻结
</if>
</td>
<td>{$s.create_time}</td>
<td>
<a href="javascript:;" class="open_edit" data-account="{$s.user_account}"
data-password="{$s['user_password']}"
data-game_name="{$s.game_name}" data-server_name="{$s.server_name}"
data-role_name="{$s.role_name}" data-support_id="{$s.id}">编辑</a>
<a href="javascript:;" class="apply" id="" data-id="{$s.id}">申请</a>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript">
$().ready(function () {
setValue('row', '{:I("get.row",10)}');
$("#pagehtml a").on("click", function (event) {
event.preventDefault();//使a自带的方法失效即无法调整到href中的URL(http://www.baidu.com)
var geturl = $(this).attr('href');
$('#data_form').attr('action', geturl);
$('#data_form').submit();
});
$('#sdate').datetimepicker({
lang: 'ch',
format: 'Y-m-d',
formatDate: 'Y-m-d',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
timepicker: false
});
$('#add').click(function () {
var url = $(this).attr('url');
window.location.href = url;
});
$('#batch_add').click(function () {
var ids = $('.ids:checked');
if (ids.length > 0) {
var str = new Array();
ids.each(function () {
str.push($(this).val());
});
param = str.join(',');
} else {
layer.msg('请选择要操作的数据');
return false;
}
var url = "{:U('apply','','')}" + '/id/' + param;
window.location.href = url;
});
$('.apply').click(function () {
var id = $(this).attr('data-id');
var url = "{:U('apply','','')}" + '/id/' + id;
window.location.href = url;
});
$('.open_edit').click(function () {
var account = $(this).attr('data-account');
var password = $(this).attr('data-password');
var game_name = $(this).attr('data-game_name');
var server_name = $(this).attr('data-server_name');
var role_name = $(this).attr('data-role_name');
var support_id = $(this).attr('data-support_id');
$('#i_account').val(account);
$('#i_password').val(password);
$('#i_game_name').val(game_name);
$('#i_server_name').val(server_name);
$('#i_role_name').val(role_name);
$('#i_support_id').val(support_id);
var id_editor = '.div_editor';
//页面层
layer.open({
type: 1,
title: '新增扶持-修改',
closeBtn: 1,
area: ['600px', '429px'],
//skin: 'layui-layer-bgwhite', //白色背景色
shadeClose: true,
content: $(id_editor),
})
});
$('.i_save').click(function () {
var id = $('#i_support_id').val();
var account = $('#i_account').val();
var role_name = $('#i_role_name').val();
var user_password = $('#i_password').val();
var game_name = $('#i_game_name').val();
var server_name = $('#i_server_name').val();
if (user_password == '') {
layer.msg('密码不能为空');
return false;
}
if (role_name == '') {
layer.msg('角色名称不能为空');
return false;
}
$.ajax({
async: false,
url: "{:U('apply_edit')}",
type: "POST",
dataType: "json",
data: { game_name:game_name,server_name:server_name,role_name: role_name, user_password: user_password, user_account: account },
success: function (result) {
if (result.status == 0) {
layer.msg(result.msg);
} else {
layer.msg('修改成功');
setTimeout(function () {
location.reload();
}, 1000);
}
},
error: function () {
}
});
});
$('.i_cancel').click(function () {
location.reload();
});
$(".select_gallery").select2();
$('#edate').datetimepicker({
lang: 'ch',
format: 'Y-m-d',
formatDate: 'Y-m-d',
timepicker: false
});
});
</script>
<script type="text/javascript">
$("#submit").click(function () {
var sdate = $('#sdate').val();
var edate = $('#edate').val();
if (Date.parse(sdate) > Date.parse(edate)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
var url = $(this).attr('url');
var query = $('#form1').find('input').serialize();
query += "&" + $('#form1').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServer')}",
type: "post",
data: { game_id: $("#game_id option:selected").attr('game-id') },
dataType: 'json',
success: function (data) {
str = "<option value=''>请选择区服</option>";
for (var i in data) {
str += "<option value='" + data[i].server_name + "'>" + data[i].server_name + "</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
})
$("#server_js").click(function (event) {
var game_id = $("#game_id").val();
if (game_id == 0) {
layer.msg('请先选择游戏');
}
});
function webchat_chkkeysend(event) {
if (event.keyCode == 13) {
$('#submit').click();
}
}
</script>
</block>

@ -33,22 +33,23 @@
<!-- <br><br><br>-->
<div id="form1">
<form action="{:U('TestResource/supportNumberList',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group normal_space fl">
<select id="game_id" name="game_name" class="reselect select_gallery" >
<option game-id="0" value="">请选择游戏</option>
<volist name=":get_game_list()" id="vo">
<option game-id="{$vo.id}" value="{$vo.game_name}" <if condition="$_GET['game_name'] eq $vo['game_name']">selected="selected"</if>>{$vo.game_name}</option>
<option game-id="{$vo.id}" value="{$vo.game_name}" <if condition="$_POST['game_name'] eq $vo['game_name']">selected="selected"</if>>{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space fl">
<span id="server_js">
<select id="server_id" name="server_name" class="reselect select_gallery" style="width:101px">
<option game-id="0" value="">请选择区服</option>
<volist name=":getServer_name_on($_GET['game_name'])" id="vo">
<option value="{$vo.server_name}" <if condition="$_GET['server_name'] eq $vo['server_name']">selected="selected"</if>>{$vo.server_name}</option>
<volist name=":getServer_name_on($_POST['game_name'])" id="vo">
<option value="{$vo.server_name}" <if condition="$_POST['server_name'] eq $vo['server_name']">selected="selected"</if>>{$_POST['server_name']}</option>
</volist>
</select>
@ -87,6 +88,7 @@
<!-- <input type="text" name="user_account" class="txt normal_txt" id="uid" style="width:110px;" placeholder="请输入玩家账号" value="{:I('user_account')}" onKeyDown="webchat_chkkeysend(event);">-->
<!-- </div>-->
</form>
</div>

Loading…
Cancel
Save