You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1388 lines
45 KiB
PHP
1388 lines
45 KiB
PHP
<?php
|
|
|
|
namespace Admin\Controller;
|
|
/**
|
|
* 后台首页控制器
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
*/
|
|
class ToolController extends ThinkController {
|
|
public $pay_type = [
|
|
0 => ['name' => '支付宝', 'paytag' => 'alipay' ],
|
|
1 => ['name' => '微信', 'paytag' => 'wxpay'],
|
|
2 => ['name' => '易宝', 'paytag' => 'yeepay'],
|
|
3 => ['name' => '双乾', 'paytag' => 'sqpay'],
|
|
|
|
];
|
|
|
|
/**
|
|
*保存设置
|
|
*/
|
|
public function saveTool($value='')
|
|
{
|
|
$name = $_POST['name'];
|
|
$config = I('config');
|
|
$data = array('config'=>json_encode($config),'template'=>$_POST['template'],'status'=>$_POST['status']);
|
|
$map['name']=$name;
|
|
|
|
$day_pay = $config['day_pay_limit'];
|
|
$month_pay = $config['month_pay_limit'];
|
|
if(!empty($day_pay) && !empty($month_pay)) {
|
|
if($month_pay / date('t') > $day_pay) {
|
|
$this->error('月支付限量较日支付限量过大');
|
|
} elseif ($month_pay < $day_pay) {
|
|
$this->error('月支付限量不能小于日支付限量');
|
|
}
|
|
}
|
|
|
|
if($_POST['status']==1&&$name=="weixin"){
|
|
$map_['name']=array("in",'wei_xin,wei_xin_app,weixin_gf');
|
|
M('tool','tab_')->where($map_)->setField('status','0');
|
|
}
|
|
if($_POST['status']==1&&$name=="wei_xin"||$name=="wei_xin_app"){
|
|
$map_['name']=['in','weixin,weixin_gf'];
|
|
M('tool','tab_')->where($map_)->setField('status','0');
|
|
}
|
|
if($_POST['status']==1&&$name=="weixin_gf"){
|
|
$map_['name']=array("in",'wei_xin,wei_xin_app,weixin');
|
|
M('tool','tab_')->where($map_)->setField('status','0');
|
|
}
|
|
if (isset($config['channel_rate']) && ($config['channel_rate'] > 100 || !is_numeric($config['channel_rate']))) {
|
|
$this->error('请输入正确的渠道费率');
|
|
}
|
|
if (isset($config['channel_rate'])) $config['channel_rate'] = round($config['channel_rate'], 2);
|
|
|
|
$flag = M('Tool','tab_')->where($map)->setField($data);
|
|
if($flag !== false){
|
|
$config['status']=$_POST['status'];
|
|
$this->set_config($name,$config);
|
|
\Think\Log::actionLog('Tool/saveTool','Tool',1);
|
|
$this->success('保存成功');
|
|
}else{
|
|
$this->error('保存失败');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* 给图片添加水印
|
|
* @author 鹿文学
|
|
* @date 2018-05-03
|
|
*/
|
|
public function addWatermarkOnPic() {
|
|
// watermark
|
|
$tool = M('tool',"tab_")->field('config,status')->where(['name'=>'watermark'])->find();
|
|
|
|
if(empty($tool)){$this->error('没有此设置');}
|
|
|
|
if($tool['status']==0) {$this->error('添加水印已关闭');exit;}
|
|
|
|
$piclist = M('picture')->field('path,url,water')->where(['status'=>1,'water'=>array('neq','')])->select();
|
|
|
|
if (!is_array($piclist)) {$this->error('没有图片需要添加');exit;}
|
|
|
|
$water = json_decode($tool['config'],true);
|
|
|
|
$temp = explode(',',$water['position']);
|
|
$position = 3*$temp[0]+$temp[1]+1;
|
|
|
|
|
|
$image = new \Think\Image();
|
|
|
|
if ($water['types']==1) { // 文字
|
|
|
|
$offset = array(
|
|
$water['hoffset']?$water['hoffset']:0,
|
|
$water['voffset']?$water['voffset']:0
|
|
);
|
|
|
|
foreach ($piclist as $k => $v) {
|
|
|
|
$image->open(ROOTTT.$v['path'])->text($water['font_text'],FONTS.$water['font'],$water['font_size'],$water['font_color'],$position,$offset)->save(ROOTTT.$v['water'],$image->type(),$water['quality']);
|
|
|
|
}
|
|
|
|
} else { // 图片
|
|
|
|
foreach ($piclist as $k => $v) {
|
|
|
|
|
|
$img_url=M('picture')->find($water['icon']);
|
|
$img_url=$img_url['path'];
|
|
$image->open(ROOTTT.$v['path'])->water(ROOTTT.$img_url,$position,$water['transparency'])->save(ROOTTT.$v['water'],$image->type(),$water['quality']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->success('水印添加成功');
|
|
|
|
}
|
|
|
|
public function save($config){
|
|
$name = $_POST['name'];
|
|
$a = $this->set_config($name,$config);
|
|
if ($a){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
*显示扩展设置信息
|
|
*/
|
|
protected function BaseConfig($name='')
|
|
{
|
|
$map['name'] = array('in',$name);
|
|
$tool = M('tool',"tab_")->where($map)->select();
|
|
if(empty($tool)){$this->error('没有此设置');}
|
|
foreach ($tool as $key => $val) {
|
|
$this->assign($tool[$key]['name'],json_decode($tool[$key]['config'],true));
|
|
unset($tool[$key]['config']);
|
|
$this->assign($tool[$key]['name']."_data",$tool[$key]);
|
|
}
|
|
}
|
|
/**
|
|
*短信设置
|
|
*/
|
|
public function smsset($value='')
|
|
{
|
|
$this->BaseConfig("sms_set,alidayu,jiguang,alidayunew,zhongwang");
|
|
$this->meta_title = '短信设置';
|
|
|
|
$this->m_title = '短信设置';
|
|
$url = 'Tool/smsset';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*防沉迷设置
|
|
*/
|
|
public function age($value='')
|
|
{
|
|
$this->BaseConfig("tool_age");
|
|
$this->meta_title = '实名认证';
|
|
|
|
$this->m_title = '实名认证';
|
|
$url = 'Tool/age';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*文件存储
|
|
*/
|
|
public function storage($value='')
|
|
{
|
|
$str = "oss_storage,qiniu_storage,cos_storage,bos_storage,ks3_storage";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '文件存储';
|
|
|
|
$this->m_title = '文件存储';
|
|
$url = 'Tool/storage';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*动态密保
|
|
*/
|
|
public function cooperate($value='')
|
|
{
|
|
$str = "set_cooperate";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '动态密保';
|
|
|
|
$this->m_title = '动态密保';
|
|
$url = 'Tool/cooperate';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*支付设置
|
|
*/
|
|
public function payset($value='')
|
|
{
|
|
$str = "alipay,weixin,wei_xin,wei_xin_app,jubaobar,weixin_gf,jft,jft_wap,goldpig,ptb_pay,bind_pay,sqpay,heepay,yeepay";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '支付设置';
|
|
|
|
$this->m_title = '支付设置';
|
|
$url = 'Tool/payset';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*邮件设置
|
|
*/
|
|
public function email($value='')
|
|
{
|
|
$str = "email_set";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '邮件设置';
|
|
|
|
$this->m_title = '邮件设置';
|
|
$url = 'Tool/email';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*第三方登录设置
|
|
*/
|
|
public function qq_thirdparty($value='')
|
|
{
|
|
$str = "qq_login,weixin_login,fb_login,gg_login";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '第三方登录';
|
|
|
|
$this->m_title = '第三方登录';
|
|
$url = 'Tool/qq_thirdparty';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*第三方登录设置
|
|
*/
|
|
public function wx_thirdparty($value='')
|
|
{
|
|
$str = "weixin_login";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '第三方登录';
|
|
$this->display();
|
|
}
|
|
/**
|
|
*第三方登录设置
|
|
*/
|
|
public function wb_thirdparty($value='')
|
|
{
|
|
$str = "sina_login";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '第三方登录';
|
|
$this->display();
|
|
}
|
|
/**
|
|
*第三方登录设置
|
|
*/
|
|
public function bd_thirdparty($value='')
|
|
{
|
|
$str = "baidu_login";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '第三方登录';
|
|
$this->display();
|
|
}
|
|
/**
|
|
*畅言设置
|
|
*/
|
|
public function changyan($value=''){
|
|
$str = "changyan";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '畅言设置';
|
|
|
|
$this->m_title = '畅言设置';
|
|
$url = 'Tool/changyan';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
/**
|
|
*聚宝云
|
|
*/
|
|
public function saveTool_jubaobar(){
|
|
$name = $_POST['name'];
|
|
$config = I('config');
|
|
$data = array('config'=>json_encode($config),'template'=>$_POST['template'],'status'=>$_POST['status']);
|
|
$map['name']=$name;
|
|
$flag = M('Tool','tab_')->where($map)->setField($data);
|
|
if($flag !== false){
|
|
$this->set_config($name,$config);
|
|
$this->update_xml($config['key']);
|
|
$this->success('保存成功');
|
|
}else{
|
|
$this->error('保存失败');
|
|
}
|
|
}
|
|
|
|
/**
|
|
*修改 聚宝云 安全口令
|
|
*/
|
|
private function update_xml($key=""){
|
|
// $file = $_SERVER['DOCUMENT_ROOT'].'Application/Sdk/SecretKey/jubaopay/jubaopay.ini';
|
|
$file = './Application/Sdk/SecretKey/jubaopay/jubaopay.ini';
|
|
//创建DOMDocument的对象
|
|
$dom = new \DOMDocument('1.0');
|
|
//载入mainchart.xml文件
|
|
$dom->load($file);
|
|
$dom->getElementsByTagName('psw')->item(0)->nodeValue = $key;
|
|
$dom->save($file);
|
|
}
|
|
|
|
/**
|
|
*设置config
|
|
*/
|
|
private function set_config($name="",$config=""){
|
|
$config_file ="./Application/Common/Conf/pay_config.php";
|
|
if(file_exists($config_file)){
|
|
$configs=include $config_file;
|
|
}else {
|
|
$configs=array();
|
|
}
|
|
#定义一个数组
|
|
$data = array();
|
|
#给数组赋值
|
|
$data[$name] = $config;
|
|
$configs=array_merge($configs,$data);
|
|
$result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";");
|
|
|
|
$ageConfigJson = json_encode($config);
|
|
M('tool', 'tab_')->where([
|
|
'name' => $name
|
|
])->save([
|
|
'config' => $ageConfigJson,
|
|
'type' => 1,
|
|
'status' => isset($config['status']) ? $config['status'] : $config['bat']
|
|
]);
|
|
}
|
|
|
|
public function ios_game(){
|
|
if($_GET['t']==1){
|
|
$url="qq";
|
|
}elseif($_GET['t']==2){
|
|
$url="wx";
|
|
}elseif($_GET['t']==3){
|
|
$url="wb";
|
|
}else{
|
|
$url="bd";
|
|
}
|
|
$this->meta_title = '第三方登录';
|
|
$this->assign('thirdparty',$url."_thirdparty");
|
|
$this->assign('param_lists',$url."_param_lists");
|
|
$this->display();
|
|
}
|
|
|
|
public function qq_param_lists(){
|
|
if(isset($_GET['game_id'])){
|
|
$map['game_id']=$_GET['game_id'];
|
|
}
|
|
$map['type']=1;
|
|
$model = array(
|
|
'm_name' => 'param',
|
|
'map' => $map,
|
|
'fields'=>'id,game_id,openid,key,callback,status,create_time',
|
|
'order' =>'id desc',
|
|
'title' => "第三方登录",
|
|
'template_list' =>'qq_param_lists',
|
|
);
|
|
$this->meta_title = '第三方登录';
|
|
$user = A('User','Event');
|
|
$user->user_join_($model,$_GET['p']);
|
|
|
|
}
|
|
|
|
public function wx_param_lists(){
|
|
if(isset($_GET['game_id'])){
|
|
$map['game_id']=$_GET['game_id'];
|
|
}
|
|
$map['type']=2;
|
|
$model = array(
|
|
'm_name' => 'param',
|
|
'map' => $map,
|
|
'fields'=>'id,game_id,wx_appid,appsecret,callback,status,create_time',
|
|
'order' =>'id desc',
|
|
'title' => "第三方登录",
|
|
'template_list' =>'wx_param_lists',
|
|
);
|
|
$this->meta_title = '第三方登录';
|
|
$user = A('User','Event');
|
|
$user->user_join_($model,$_GET['p']);
|
|
|
|
}
|
|
public function wb_param_lists(){
|
|
if(isset($_GET['game_id'])){
|
|
$map['game_id']=$_GET['game_id'];
|
|
}
|
|
$map['type']=3;
|
|
$model = array(
|
|
'm_name' => 'param',
|
|
'map' => $map,
|
|
'field'=>'id,game_id,appkey,scope,callback,status,create_time',
|
|
'order' =>'id desc',
|
|
'title' => "第三方登录",
|
|
'template_list' =>'wb_param_lists',
|
|
);
|
|
$this->meta_title = '第三方登录';
|
|
$user = A('User','Event');
|
|
$user->user_join_($model,$_GET['p']);
|
|
|
|
}
|
|
|
|
public function bd_param_lists(){
|
|
if(isset($_GET['game_id'])){
|
|
$map['game_id']=$_GET['game_id'];
|
|
}
|
|
$map['type']=4;
|
|
$model = array(
|
|
'm_name' => 'param',
|
|
'map' => $map,
|
|
'field'=>'id,game_id,openid,key,callback,status,create_time',
|
|
'order' =>'id desc',
|
|
'title' => "第三方登录",
|
|
'template_list' =>'bd_param_lists',
|
|
);
|
|
$this->meta_title = '第三方登录';
|
|
$user = A('User','Event');
|
|
$user->user_join_($model,$_GET['p']);
|
|
|
|
}
|
|
|
|
|
|
public function add_thirdparty(){
|
|
if(IS_POST){
|
|
if($_POST['type']==1){
|
|
if(empty($_POST['openid'])){
|
|
$this->error('openid不能为空');exit;
|
|
}
|
|
if(empty($_POST['key'])){
|
|
$this->error('安全校验码不能为空');exit;
|
|
}
|
|
$url="qq_param_lists";
|
|
}elseif($_POST['type']==2){
|
|
if(empty($_POST['wx_appid'])){
|
|
$this->error('APPID不能为空');exit;
|
|
}
|
|
if(empty($_POST['appsecret'])){
|
|
$this->error('APPSECRET不能为空');exit;
|
|
}
|
|
$url="wx_param_lists";
|
|
}elseif($_POST['type']==3){
|
|
if(empty($_POST['appkey'])||empty($_POST['scope'])){
|
|
$this->error('参数不能为空');exit;
|
|
}
|
|
$url="wb_param_lists";
|
|
}else{
|
|
if(empty($_POST['clientid'])){
|
|
$this->error('参数不能为空');exit;
|
|
}
|
|
$url="bd_param_lists";
|
|
}
|
|
|
|
$find=M('param','tab_')->where(['game_id'=>$_POST['game_id'],'type'=>$_POST['type']])->find();
|
|
if(null!==$find){
|
|
$this->error('该游戏已经设置过参数');exit;
|
|
}
|
|
if($_POST['game_id']==0){
|
|
$count=M('param','tab_')->where(['game_id'=>['gt',0],'type'=>$_POST['type']])->count();
|
|
if($count>=1){
|
|
$this->error('如需设置全部游戏 请先将其他游戏数据删除');exit;
|
|
}
|
|
}
|
|
$add=M('param','tab_')->add($_POST);
|
|
if($add){
|
|
$this->success('新增成功',U($url));
|
|
}else{
|
|
$this->error('新增失败',U($url));
|
|
}
|
|
}else{
|
|
|
|
switch($_GET['type']) {
|
|
case 1:$this->meta_title = '第三方登录';break;
|
|
case 2:$this->meta_title = '第三方登录';break;
|
|
|
|
}
|
|
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
|
|
public function edit_thirdparty($id){
|
|
if(IS_POST){
|
|
if($_POST['type']==1){
|
|
if(empty($_POST['openid'])){
|
|
$this->error('openid不能为空');exit;
|
|
}
|
|
if(empty($_POST['key'])) {
|
|
$this->error('安全校验码不能为空');exit;
|
|
}
|
|
|
|
$url="qq_param_lists";
|
|
}elseif($_POST['type']==2){
|
|
if(empty($_POST['wx_appid'])){
|
|
$this->error('APPID不能为空');exit;
|
|
}
|
|
if(empty($_POST['appsecret'])){
|
|
$this->error('APPSECRET不能为空');exit;
|
|
}
|
|
$url="wx_param_lists";
|
|
}elseif($_POST['type']==3){
|
|
if(empty($_POST['appkey'])||empty($_POST['scope'])){
|
|
$this->error('参数不能为空');exit;
|
|
}
|
|
$url="wb_param_lists";
|
|
}else{
|
|
if(empty($_POST['clientid'])){
|
|
$this->error('参数不能为空');exit;
|
|
}
|
|
$url="bd_param_lists";
|
|
}
|
|
|
|
$add=M('param','tab_')->save($_POST);
|
|
if($add){
|
|
$this->success('修改成功',U($url));
|
|
}else{
|
|
$this->error('修改失败',U($url));
|
|
}
|
|
}else{
|
|
$find=M('param','tab_')->where(['id'=>$id])->find();
|
|
$this->assign('data',$find);
|
|
switch($_GET['type']) {
|
|
case 1:$this->meta_title = '第三方登录';break;
|
|
case 2:$this->meta_title = '第三方登录';break;
|
|
|
|
}
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 删除
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
*/
|
|
public function del(){
|
|
$id = array_unique((array)I('ids',0));
|
|
|
|
if ( empty($id) ) {
|
|
$this->error('请选择要操作的数据!');
|
|
}
|
|
$map = array('id' => array('in', $id) );
|
|
if(M('param','tab_')->where($map)->delete()){
|
|
$this->success('删除成功');
|
|
} else {
|
|
$this->error('删除失败!');
|
|
}
|
|
}
|
|
|
|
public function changeStatus($field = null,$value=null)
|
|
{
|
|
$id = array_unique((array)I('id', 0));
|
|
$id = is_array($id) ? implode(',', $id) : $id;
|
|
if (empty($id)) {
|
|
$this->error('请选择要操作的数据!');
|
|
}
|
|
$map['id'] = array('in', $id);
|
|
$result = M('param','tab_')->where($map)->setField($field,$value);
|
|
$msg = $value == 0?"关闭":"开启";
|
|
if($result !== false){
|
|
$this->success($msg.'成功');
|
|
}else{
|
|
$this->error($msg.'失败');
|
|
}
|
|
}
|
|
|
|
/*
|
|
* 水印
|
|
*/
|
|
public function watermark() {
|
|
|
|
$this->BaseConfig("watermark");
|
|
|
|
$this->meta_title = '水印设置';
|
|
|
|
$this->m_title = '水印设置';
|
|
$url = 'Tool/watermark';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
/**
|
|
* 支付宝参数设置
|
|
* @author 鹿文学
|
|
*/
|
|
public function alipay_param($value='') {
|
|
$str = "alipay_param";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '支付宝认证';
|
|
|
|
$this->m_title = '支付宝认证';
|
|
$url = 'Tool/alipay_param';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 用户VIP设置
|
|
* @author 鹿文学
|
|
*/
|
|
public function vip($value='') {
|
|
$str = "viplevel";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '用户VIP设置';
|
|
|
|
$this->m_title = '用户VIP设置';
|
|
$url = 'Tool/vip';
|
|
$this->m_url = $url;
|
|
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
|
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
*公司信息列表
|
|
*/
|
|
public function company_info()
|
|
{
|
|
$model = M('company_info', 'tab_');
|
|
$map = [];
|
|
$id = intval(I('id', 0));
|
|
if (!empty($id)) {
|
|
$map['tab_company_info.id'] = $id;
|
|
$parameter['id'] = $id;
|
|
}
|
|
|
|
if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') {
|
|
$status = intval($_REQUEST['status']);
|
|
$map['tab_company_info.status'] = $status;
|
|
$parameter['status'] = $status;
|
|
}
|
|
|
|
$page = intval(I('get.p', 0));
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
$row = intval(I('row', 0));
|
|
$row = empty($row) ? 10 : $row;//每页条数
|
|
|
|
$data = $model->alias('p')
|
|
->field('p.id,p.partner,p.status,p.create_time,link_man,link_phone,address,company_tax_no,payee_name,
|
|
bank_account,opening_bank,m.nickname')
|
|
->join('left join sys_member as m on m.uid = p.uid')
|
|
->where($map)
|
|
->order('id desc')
|
|
->page($page, $row)
|
|
->select();
|
|
|
|
/* 查询记录总数 */
|
|
$count = $model
|
|
->where($map)
|
|
->count();
|
|
|
|
if (!empty($data)) {
|
|
foreach ($data as &$list) {
|
|
$list['status'] = ($list['status'] == 0) ? '已关闭' : '已开启';
|
|
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
|
|
}
|
|
}
|
|
|
|
//分页
|
|
$parameter['p'] = $page;
|
|
$parameter['row'] = $row;
|
|
$page = set_pagination($count, $row, $parameter);
|
|
if ($page) {
|
|
$this->assign('_page', $page);
|
|
}
|
|
|
|
$this->assign('listData', $data);
|
|
$this->assign('count', $count);
|
|
$this->meta_title = '公司信息管理';
|
|
$this->display();
|
|
}
|
|
|
|
//添加
|
|
public function company_add()
|
|
{
|
|
if ($_POST) {
|
|
$partner = I('post.partner', '');
|
|
$status = intval(I('post.status', 1));
|
|
|
|
if (empty($partner)) {
|
|
$this->error('请输入公司名称');
|
|
}
|
|
if (empty(I('link_man'))) {
|
|
$this->error('请输入联系人');
|
|
}
|
|
if (empty(I('link_phone'))) {
|
|
$this->error('请输入联系电话');
|
|
}
|
|
if (!in_array($status, [0, 1])) {
|
|
$this->error('参数异常');
|
|
}
|
|
|
|
$model = M('company_info', 'tab_');
|
|
$map['partner'] = $partner;
|
|
$res = $model->where($map)->getField('id');
|
|
if ($res) {
|
|
$this->error('公司名称已存在');
|
|
}
|
|
|
|
if(!checkPhone(I('link_phone'))) {
|
|
$this->error('联系电话格式不正确');
|
|
}
|
|
$res2 = $model->where(['link_phone' => I('link_phone')])->getField('id');
|
|
if ($res2) {
|
|
$this->error('已存在此联系电话');
|
|
}
|
|
$time = time();
|
|
$save['partner'] = $partner;
|
|
$save['status'] = $status;
|
|
|
|
$save['link_man'] = I('link_man');
|
|
$save['link_phone'] = I('link_phone');
|
|
$save['address'] = I('address');
|
|
$save['company_tax_no'] = I('company_tax_no');
|
|
$save['payee_name'] = I('payee_name');
|
|
$save['bank_account'] = I('bank_account');
|
|
$save['opening_bank'] = I('opening_bank');
|
|
|
|
$save['uid'] = UID;
|
|
$save['create_time'] = $time;
|
|
$save['last_up_time'] = $time;
|
|
|
|
$res = $model->add($save);
|
|
if ($res) {
|
|
\Think\Log::actionLog('company/add', 'company_info', $res);
|
|
$this->success('保存成功', U('company_info'));
|
|
} else {
|
|
$this->error('保存失败');
|
|
}
|
|
} else {
|
|
$this->meta_title = '新增公司';
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
//编辑
|
|
public function company_edit()
|
|
{
|
|
$model = M('company_info', 'tab_');
|
|
|
|
if ($_POST) {
|
|
$partner = I('post.partner', '');
|
|
$status = intval(I('post.status', 1));
|
|
$id = intval(I('post.id', 0));
|
|
|
|
if (empty($partner)) {
|
|
$this->error('请输入合作方名称');
|
|
}
|
|
if (empty(I('link_man'))) {
|
|
$this->error('请输入联系人');
|
|
}
|
|
if (empty(I('link_phone'))) {
|
|
$this->error('请输入联系电话');
|
|
}
|
|
if (!in_array($status, [0, 1])) {
|
|
$this->error('参数异常');
|
|
}
|
|
|
|
$data = $model
|
|
->field('id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank')
|
|
->find($id);
|
|
if (empty($data)) {
|
|
$this->error('数据异常');
|
|
}
|
|
|
|
$map['partner'] = $partner;
|
|
$res = $model->where($map)->getField('id');
|
|
if ($res && $res != $id) {
|
|
$this->error('公司名称已存在');
|
|
}
|
|
|
|
if(!checkPhone(I('link_phone'))) {
|
|
$this->error('联系电话格式不正确');
|
|
}
|
|
$res2 = $model->where([
|
|
'link_phone' => I('link_phone'),
|
|
'id' => ['neq', $id]
|
|
])->getField('id');
|
|
|
|
if ($res2) {
|
|
$this->error('已存在此联系电话');
|
|
}
|
|
$time = time();
|
|
$save['id'] = $id;
|
|
$save['partner'] = $partner;
|
|
|
|
$save['link_man'] = I('link_man');
|
|
$save['link_phone'] = I('link_phone');
|
|
$save['address'] = I('address');
|
|
$save['company_tax_no'] = I('company_tax_no');
|
|
$save['payee_name'] = I('payee_name');
|
|
$save['bank_account'] = I('bank_account');
|
|
$save['opening_bank'] = I('opening_bank');
|
|
|
|
$save['status'] = $status;
|
|
$save['last_up_time'] = $time;
|
|
$res = $model->save($save);
|
|
if ($res === false) {
|
|
$this->error('保存失败');
|
|
} else {
|
|
\Think\Log::actionLog('company/edit', 'company_info', $id);
|
|
$this->success('保存成功', U('company_info'));
|
|
}
|
|
} else {
|
|
$id = intval(I('get.id', 0));
|
|
$map['id'] = $id;
|
|
$data = $model
|
|
->field('id,partner,status,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank')
|
|
->find($id);
|
|
if (empty($data)) {
|
|
$this->error('数据异常', U('company_info'));
|
|
}
|
|
|
|
$this->assign('company_info', $data);
|
|
$this->meta_title = '编辑公司';
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
//删除
|
|
public function company_del()
|
|
{
|
|
if (!empty($_POST['ids'])) {
|
|
if (!is_array($_POST['ids'])) {
|
|
$this->error('参数异常');
|
|
}
|
|
|
|
$id = implode(',', $_POST['ids']);
|
|
} else {
|
|
$id = intval(I('get.id', 0));
|
|
if ($id == 0) {
|
|
$this->error('参数异常');
|
|
}
|
|
}
|
|
|
|
$res = M('company_info', 'tab_')->delete($id);
|
|
if ($res === false) {
|
|
$this->error('删除失败');
|
|
}
|
|
|
|
$this->success('删除成功', U('company_info'));
|
|
}
|
|
|
|
/**
|
|
*公司信息管理(旧版备份)
|
|
*/
|
|
public function company_info_old()
|
|
{
|
|
$str = "company_info";
|
|
$this->BaseConfig($str);
|
|
$this->meta_title = '公司信息管理';
|
|
$this->display();
|
|
}
|
|
|
|
|
|
public function limitPay($page = 1) {
|
|
$page = intval(I('get.p', 0));
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
$row = intval(I('row', 0));
|
|
$row = empty($row) ? 10 : $row;//每页条数
|
|
|
|
$payType = $_REQUEST['pay_type'];
|
|
$limit_type = $_REQUEST['limit_type'];
|
|
|
|
$limit_time_type = $_REQUEST['limit_time_type'];
|
|
$map = [];
|
|
if (!empty($payType)) {
|
|
$map['pay_type'] = $payType;
|
|
$parameter['pay_type'] = $payType;
|
|
}
|
|
|
|
if (!empty($limit_type)) {
|
|
$map['limit_type'] = $limit_type;
|
|
$parameter['limit_type'] = $limit_type;
|
|
}
|
|
$datas = M('pay_limit_conf', 'tab_')
|
|
->where($map)
|
|
->order('id desc')
|
|
->page($page, $row)
|
|
->select();
|
|
|
|
/* 查询记录总数 */
|
|
$count = M('pay_limit_conf', 'tab_')
|
|
->where($map)
|
|
->count();
|
|
foreach ($datas as $key => $data) {
|
|
$limit_rule = '';
|
|
if (!empty(intval($data['user_total_limit']))) {
|
|
$limit_rule .= '玩家全渠道总流水限额'.$data['user_total_limit']."    ";
|
|
}
|
|
if (!empty(intval($data['total_limit']))) {
|
|
$limit_rule .= '全渠道总流水限额'.$data['total_limit']."    ";
|
|
}
|
|
if (!empty(intval($data['user_one_limit']))) {
|
|
$limit_rule .= '玩家单笔限制'.$data['user_one_limit'];
|
|
}
|
|
if ($limit_rule == '') {
|
|
$limit_rule = '暂无规则';
|
|
}
|
|
if ($data['limit_time_type'] == 'day') {
|
|
$data['limit_time_type'] = '每日,';
|
|
$remarkStr = '';
|
|
}
|
|
if ($data['limit_time_type'] == 'week') {
|
|
$data['limit_time_type'] = '每周,';
|
|
if ($data['limit_time_type_remark'] == 1) $remarkStr = "周一";
|
|
if ($data['limit_time_type_remark'] == 2) $remarkStr = "周二";
|
|
if ($data['limit_time_type_remark'] == 3) $remarkStr = "周三";
|
|
if ($data['limit_time_type_remark'] == 4) $remarkStr = "周四";
|
|
if ($data['limit_time_type_remark'] == 5) $remarkStr = "周五";
|
|
if ($data['limit_time_type_remark'] == 6) $remarkStr = "周六";
|
|
if ($data['limit_time_type_remark'] == 7) $remarkStr = "周七";
|
|
|
|
}
|
|
if ($data['limit_time_type'] == 'month') {
|
|
$data['limit_time_type'] = '每月,';
|
|
$remarkStr = $data['limit_time_type_remark'].'日';
|
|
}
|
|
if ($data['limit_time_type'] == 'fix') {
|
|
$data['limit_time_type'] = '特殊,';
|
|
$remarks = str_split($data['limit_time_type_remark'], 1);
|
|
$remarkStr = '';
|
|
foreach($remarks as $keyR => $remark) {
|
|
if ($keyR == 3 || $keyR == 5){
|
|
$remarkStr .= $remark. '-';
|
|
}else {
|
|
$remarkStr .= $remark;
|
|
}
|
|
}
|
|
}
|
|
if ($data['limit_type'] == 'force') {
|
|
$datas[$key]['limit_type'] = '强制限制';
|
|
}
|
|
if ($data['limit_type'] == 'obstacles') {
|
|
$datas[$key]['limit_type'] = '支付体验障碍';
|
|
}
|
|
if ($data['pay_type'] == 'alipay') {
|
|
$pay_type = '支付宝';
|
|
}
|
|
if ($data['pay_type'] == 'wxpay') {
|
|
$pay_type = '微信';
|
|
}
|
|
if ($data['pay_type'] == 'yeepay') {
|
|
$pay_type = '易宝';
|
|
}
|
|
if ($data['pay_type'] == 'sqpay') {
|
|
$pay_type = '双乾';
|
|
}
|
|
$start_timeArr = str_split($data['start_time'], 1);
|
|
$startTimeStr = '';
|
|
foreach ($start_timeArr as $timeKey => $start_time) {
|
|
if ($timeKey == 1 || $timeKey == 3) {
|
|
$startTimeStr .= $start_time.':';
|
|
}else {
|
|
$startTimeStr .= $start_time;
|
|
}
|
|
|
|
}
|
|
|
|
$end_timeArr = str_split($data['end_time'], 1);
|
|
$endTimeStr = '';
|
|
foreach ($end_timeArr as $timeKey1 => $end_time) {
|
|
if ($timeKey1 == 1 || $timeKey1 == 3) {
|
|
$endTimeStr .= $end_time. ':';
|
|
}else {
|
|
$endTimeStr .= $end_time;
|
|
}
|
|
|
|
}
|
|
|
|
$datas[$key]['pay_type'] = $pay_type;
|
|
$datas[$key]['limit_rule'] = $limit_rule;
|
|
$datas[$key]['limit_time'] = $data['limit_time_type'] .$remarkStr.' '.$startTimeStr.'~'.$endTimeStr;
|
|
|
|
}
|
|
//分页
|
|
$parameter['p'] = $page;
|
|
$parameter['row'] = $row;
|
|
$page = set_pagination($count, $row, $parameter);
|
|
if ($page) {
|
|
$this->assign('_page', $page);
|
|
}
|
|
if (empty($payType)) {
|
|
$this->assign('pay_type', " ");
|
|
}else {
|
|
$this->assign('pay_type', $payType);
|
|
}
|
|
if (empty($limit_type)) {
|
|
$this->assign('limit_type', " ");
|
|
}else {
|
|
$this->assign('limit_type', $limit_type);
|
|
}
|
|
$this->assign('datas', $datas);
|
|
$this->display();
|
|
}
|
|
|
|
|
|
public function addLimitPay() {
|
|
if ($_POST) {
|
|
$pay_type = $_REQUEST['pay_type'];
|
|
$total_limit = empty($_REQUEST['total_limit']) ? 0 : $_REQUEST['total_limit'];
|
|
$user_total_limit = empty($_REQUEST['user_total_limit']) ? 0 : $_REQUEST['user_total_limit'];
|
|
$user_one_limit = empty($_REQUEST['user_one_limit']) ? 0 : $_REQUEST['user_one_limit'];
|
|
$limit_type = $_REQUEST['limit_type'];
|
|
$status = $_REQUEST['status'];
|
|
$startTime = '';
|
|
$endTime = '';
|
|
if (empty($pay_type)) {
|
|
return $this->error('限制支付渠道不能为空');
|
|
}
|
|
if (empty(intval($total_limit))&&empty(intval($user_total_limit))&&empty(intval($user_one_limit))) {
|
|
return $this->error('限额不能为空');
|
|
}
|
|
if (!is_numeric($total_limit) || !is_numeric($user_total_limit) || !is_numeric($user_one_limit) || $total_limit < 0 ||$user_total_limit < 0 ||$user_one_limit < 0 ) {
|
|
return $this->error('限制金额出错');
|
|
}
|
|
if (intval($total_limit) > 1000000000000.00 || intval($user_total_limit) > 1000000000000.00 ||intval($user_one_limit) > 1000000000000.00) {
|
|
return $this->error('限制金额超出范围');
|
|
}
|
|
if (empty($limit_type)) {
|
|
return $this->error('限制方式不能为空');
|
|
}
|
|
|
|
$paramsName = $status.'_start';
|
|
for ($i = 1; $i < 13; $i++) {
|
|
$name = $paramsName.$i;
|
|
if ($_REQUEST[$name] == '') {
|
|
return $this->error('时间选择不能为空');
|
|
}else {
|
|
if ($i < 7) {
|
|
$startTime .= $_REQUEST[$name];
|
|
}else {
|
|
$endTime .= $_REQUEST[$name];
|
|
}
|
|
}
|
|
|
|
$this->checkTimeFormat($i, $startTime, $endTime, $_REQUEST[$name]);
|
|
|
|
}
|
|
$start_timeArr = str_split($startTime, 1);
|
|
$startTimeStr = '';
|
|
foreach ($start_timeArr as $timeKey => $start_time) {
|
|
if ($timeKey == 1 || $timeKey == 3) {
|
|
$startTimeStr .= $start_time.':';
|
|
}else {
|
|
$startTimeStr .= $start_time;
|
|
}
|
|
|
|
}
|
|
|
|
$st = '2020-03-23'.' '.$startTimeStr;
|
|
$startTimeStamp = strtotime($st);
|
|
|
|
$end_timeArr = str_split($endTime, 1);
|
|
$endTimeStr = '';
|
|
foreach ($end_timeArr as $timeKey1 => $end_time) {
|
|
if ($timeKey1 == 1 || $timeKey1 == 3) {
|
|
$endTimeStr .= $end_time.':';
|
|
}else {
|
|
$endTimeStr .= $end_time;
|
|
}
|
|
|
|
}
|
|
|
|
$et = '2020-03-23'.' '.$endTimeStr;
|
|
$endTimeStamp = strtotime($et);
|
|
if ($startTimeStamp >= $endTimeStamp) {
|
|
return $this->error('开始时间不能大于结束时间');
|
|
}
|
|
switch($status) {
|
|
case 'daily':
|
|
$limit_time_type = 'day';
|
|
break;
|
|
case 'week':
|
|
$limit_time_type = 'week';
|
|
if (empty($_REQUEST['week_remark'])) {
|
|
return $this->error('每周限制时间未确定');
|
|
}else {
|
|
$data['limit_time_type_remark'] = $_REQUEST['week_remark'];
|
|
}
|
|
break;
|
|
case 'month':
|
|
$limit_time_type = 'month';
|
|
if (empty($_REQUEST['month_remark'])) {
|
|
return $this->error('每月限制时间未确定');
|
|
}else {
|
|
$data['limit_time_type_remark'] = $_REQUEST['month_remark'];
|
|
}
|
|
break;
|
|
case 'day':
|
|
$limit_time_type = 'fix';
|
|
if (empty($_REQUEST['day_remark'])) {
|
|
return $this->error('每月限制时间未确定');
|
|
}else {
|
|
$fixStr = str_replace('-','',$_REQUEST['day_remark']);
|
|
$data['limit_time_type_remark'] = $fixStr;
|
|
$data['fix_date'] = $fixStr;
|
|
}
|
|
break;
|
|
}
|
|
if (!is_numeric($startTime) || !is_numeric($endTime)) {
|
|
$this->error('时间格式出错');
|
|
}
|
|
|
|
$data['pay_type'] = $pay_type;
|
|
$data['limit_type'] = $limit_type;
|
|
$data['limit_time_type'] = $limit_time_type;
|
|
$data['start_time'] = $startTime;
|
|
$data['end_time'] = $endTime;
|
|
$data['total_limit'] = $total_limit;
|
|
$data['user_total_limit'] = $user_total_limit;
|
|
$data['user_one_limit'] = $user_one_limit;
|
|
$data['create_time'] = time();
|
|
$res = M('pay_limit_conf', 'tab_')->add($data);
|
|
|
|
if($res) {
|
|
$this->success('新增成功',U('limitPay'));
|
|
}
|
|
}else {
|
|
// $id = $_REQUEST['id'];
|
|
// $limitConf = M('pay_limit_conf', 'tab_')->where(['id'=>$id])->find();
|
|
// if (empty($limitConf)) {
|
|
// return $this->error('未找到该条信息');
|
|
// }
|
|
// foreach ($limitConf as $key => $conf) {
|
|
|
|
// }
|
|
|
|
$monthDay = $this->getMonthDay();
|
|
$this->assign('monthday', $monthDay);
|
|
$this->display();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public function editLimitPay() {
|
|
if ($_POST) {
|
|
$id = $_REQUEST['id'];
|
|
$pay_type = $_POST['pay_type'];
|
|
$total_limit = $_POST['total_limit'];
|
|
$user_total_limit = $_POST['user_total_limit'];
|
|
$user_one_limit = $_POST['user_one_limit'];
|
|
$limit_type = $_POST['limit_type'];
|
|
$status = $_POST['status'];
|
|
$startTime = '';
|
|
$endTime = '';
|
|
if (empty(intval($total_limit))&&empty(intval($user_total_limit))&&empty(intval($user_one_limit))) {
|
|
return $this->error('限额不能为空');
|
|
}
|
|
if (!is_numeric($total_limit) || !is_numeric($user_total_limit) || !is_numeric($user_one_limit) || $total_limit < 0 ||$user_total_limit < 0 ||$user_one_limit < 0 ) {
|
|
return $this->error('限额金额出错');
|
|
}
|
|
if (empty($id)) {
|
|
return $this->error('编辑信息出错');
|
|
}
|
|
if (intval($total_limit) > 1000000000000.00 || intval($user_total_limit) > 1000000000000.00 ||intval($user_one_limit) > 1000000000000.00) {
|
|
return $this->error('限制金额超出范围');
|
|
}
|
|
|
|
$confInfo = M('pay_limit_conf', 'tab_')->where(['id'=>$id])->find();
|
|
$confInfo['pay_type'] = $pay_type;
|
|
$confInfo['total_limit'] = $total_limit;
|
|
$confInfo['user_total_limit'] = $user_total_limit;
|
|
$confInfo['user_one_limit'] = $user_one_limit;
|
|
$confInfo['limit_type'] = $limit_type;
|
|
$paramsName = $status.'_start';
|
|
for ($i = 1; $i < 13; $i++) {
|
|
$name = $paramsName.$i;
|
|
if ($_REQUEST[$name] == '') {
|
|
return $this->error('时间选择不能为空');
|
|
}else {
|
|
if ($i < 7) {
|
|
$startTime .= $_REQUEST[$name];
|
|
}else {
|
|
$endTime .= $_REQUEST[$name];
|
|
}
|
|
}
|
|
|
|
$this->checkTimeFormat($i, $startTime, $endTime, $_REQUEST[$name]);
|
|
|
|
|
|
}
|
|
$st = '2020-03-23'.' '.$startTimeStr;
|
|
$startTimeStamp = strtotime($st);
|
|
|
|
$end_timeArr = str_split($endTime, 1);
|
|
$endTimeStr = '';
|
|
foreach ($end_timeArr as $timeKey1 => $end_time) {
|
|
if ($timeKey1 == 1 || $timeKey1 == 3) {
|
|
$endTimeStr .= $end_time.':';
|
|
}else {
|
|
$endTimeStr .= $end_time;
|
|
}
|
|
|
|
}
|
|
|
|
$et = '2020-03-23'.' '.$endTimeStr;
|
|
$endTimeStamp = strtotime($et);
|
|
if ($startTimeStamp >= $endTimeStamp) {
|
|
return $this->error('开始时间不能大于结束时间');
|
|
}
|
|
$confInfo['start_time'] = $startTime;
|
|
$confInfo['end_time'] = $endTime;
|
|
switch($status) {
|
|
case 'daily':
|
|
$limit_time_type = 'day';
|
|
$confInfo['limit_time_type_remark'] = "";
|
|
$confInfo['fix_date'] = '';
|
|
break;
|
|
case 'week':
|
|
$limit_time_type = 'week';
|
|
if (empty($_REQUEST['week_remark'])) {
|
|
return $this->error('每周限制时间未确定');
|
|
}else {
|
|
$confInfo['limit_time_type_remark'] = $_REQUEST['week_remark'];
|
|
}
|
|
$confInfo['fix_date'] = '';
|
|
break;
|
|
case 'month':
|
|
$limit_time_type = 'month';
|
|
if (empty($_REQUEST['month_remark'])) {
|
|
return $this->error('每月限制时间未确定');
|
|
}else {
|
|
$confInfo['limit_time_type_remark'] = $_REQUEST['month_remark'];
|
|
}
|
|
$confInfo['fix_date'] = '';
|
|
break;
|
|
case 'day':
|
|
$limit_time_type = 'fix';
|
|
if (empty($_REQUEST['day_remark'])) {
|
|
return $this->error('每月限制时间未确定');
|
|
}else {
|
|
$fixStr = str_replace('-','',$_REQUEST['day_remark']);
|
|
$confInfo['limit_time_type_remark'] = $fixStr;
|
|
$confInfo['fix_date'] = $fixStr;
|
|
}
|
|
// $confInfo['limit_time_type_remark'] = $_REQUEST['day_remark'];
|
|
break;
|
|
}
|
|
$confInfo['limit_time_type'] = $limit_time_type;
|
|
$update = M('pay_limit_conf', 'tab_')->where(['id'=>$id])->save($confInfo);
|
|
if ($update) {
|
|
$this->success('编辑成功',U('limitPay'));
|
|
}else {
|
|
$this->error('未修改资料,请确认');
|
|
}
|
|
|
|
}else {
|
|
$id = $_REQUEST['id'];
|
|
$data = M('pay_limit_conf', 'tab_')->where(['id'=>$id])->find();
|
|
$start_time = $data['start_time'];
|
|
|
|
$end_time = $data['end_time'];
|
|
$monthDay = $this->getMonthDay();
|
|
if ($data['limit_time_type'] == 'fix') {
|
|
$remarks = str_split($data['limit_time_type_remark'], 1);
|
|
$remarkStr = '';
|
|
foreach($remarks as $keyR => $remark) {
|
|
if ($keyR == 3 || $keyR == 5){
|
|
$remarkStr .= $remark. '-';
|
|
}else {
|
|
$remarkStr .= $remark;
|
|
}
|
|
}
|
|
$data['limit_time_type_remark'] = $remarkStr;
|
|
}
|
|
|
|
$this->assign('monthday', $monthDay);
|
|
$this->assign('startTime', $start_time);
|
|
$this->assign('endTime', $end_time);
|
|
$this->assign('data', $data);
|
|
// var_dump($this->pay_type);die();
|
|
$this->assign('pay_type', $this->pay_type);
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function delLimitPay($id) {
|
|
$res = M('pay_limit_conf', 'tab_')->where(['id'=>$id])->delete();
|
|
if($res) {
|
|
$this->success('删除成功',U('limitPay'));
|
|
}
|
|
}
|
|
|
|
public function getMonthDay() {
|
|
$arr = [];
|
|
for ($i = 1;$i < 32; $i++ ) {
|
|
$arr[] = $i;
|
|
}
|
|
return $arr;
|
|
|
|
}
|
|
|
|
public function checkTimeFormat($i, $startTime = '' , $endTime = '', $name) {
|
|
if ($i == 2) {
|
|
if ($startTime < 0 || $startTime > 23) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
|
|
if ($i == 3 || $i == 5) {
|
|
if ($name < 0 || $name > 5) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
if ($i == 4 || $i == 6) {
|
|
if ($name < 0 || $name > 9) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
|
|
if ($i == 8) {
|
|
if ($endTime < 0 || $endTime > 23) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
|
|
if ($i == 9 || $i == 11) {
|
|
if ($name < 0 || $name > 5) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
if ($i == 10 || $i == 12) {
|
|
if ($name < 0 || $name > 9) {
|
|
return $this->error("时间选择出错");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|