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.

263 lines
6.9 KiB
PHTML

5 years ago
<?php
/**
* Created by PhpStorm.
* User: xmy 280564871@qq.com
* Date: 2017/4/18
* Time: 15:28
*/
/**
* 检测验证码
* @param integer $id 验证码ID
* @return boolean 检测结果
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
function check_verify($code, $id = 1){
$verify = new \Think\Verify();
return $verify->check($code, $id);
}
/* 获取状态列表 @author 鹿文学 */
function get_status_list($flag=1) {
switch($flag) {
case 1:$list = array('-1'=>'未通过', '0'=>'待审核','1'=>'已通过');break;
case 2:$list = array('-1'=>'未通过', '0'=>'待审核','1'=>'已通过','2'=>'更新已通过','3'=>'更新待审核','-2'=>'更新未通过');break;
case 3:$list = array('0'=>'锁定','1'=>'正常');break;
case 4:$list = array('-2'=>'已驳回','-1'=>'待审核','0'=>'锁定','1'=>'正常');break;
case 5:$list = array('-2'=>'未申请','0'=>'待审核','1'=>'已通过','2'=>'已驳回');break;
case 6:$list = array('0'=>'支付失败','1'=>'支付成功');break;
case 7:$list = array('0'=>'锁定','1'=>'正常');break;
case 8:$list = array('0'=>'待审核','1'=>'已通过','2'=>'未通过');break;
}
return $list;
}
//获取游戏平台 安卓ios
function get_game_version($game_id=null,$field='id'){
$map[$field]=$game_id;
$data=M('Game','tab_')->where($map)->find();
if(empty($data)){return ' ';}
return $data['sdk_version'];
}
//所有支付方式
function all_pay_way($type=false)
{
if($type){
$pay_way[0]=array('key'=>0,'value'=>'平台币');
}
$pay_way[1]=array('key'=>1,'value'=>'支付宝');
$pay_way[2]=array('key'=>2,'value'=>'微信(扫码)');
$pay_way[3]=array('key'=>3,'value'=>'微信APP');
$pay_way[4]=array('key'=>4,'value'=>'威富通');
$pay_way[5]=array('key'=>5,'value'=>'聚宝云');
$pay_way[6]=array('key'=>6,'value'=>'汇付宝');
$pay_way[7]=array('key'=>7,'value'=>'苹果支付');
return $pay_way;
}
function get_pay_way_list($type=1) {
switch($type) {
case 1:{
return array(
['key'=>-1,'value'=>'绑定平台币'],
['key'=>0,'value'=>'平台币'],
['key'=>1,'value'=>'支付宝'],
['key'=>3,'value'=>'微信'],
);
};break;
case 2:{
return array(
['key'=>-1,'value'=>'绑定平台币'],
['key'=>0,'value'=>'平台币'],
['key'=>1,'value'=>'支付宝'],
['key'=>2,'value'=>'微信(扫码)'],
['key'=>3,'value'=>'微信APP'],
['key'=>4,'value'=>'威富通'],
['key'=>5,'value'=>'威富通'],
['key'=>6,'value'=>'汇付宝'],
['key'=>7,'value'=>'苹果支付'],
);
};break;
default:return [];
}
}
function get_pay_way_name($id=null,$type=1) {
if(is_numeric($id)) {
$str = '';
$list = get_pay_way_list($type);
foreach($list as $k => $v) {
if($v['key']==$id) {
$str = $v['value'];break;
}
}
return $str;
} else {
return false;
}
}
/**
* [获取支付方式]
* @param [type] $id [description]
* @return [type] [description]
*/
function get_pay_way($id=null)
{
if(!isset($id)){
return false;
}
switch ($id) {
case -1: return "绑定平台币";break;
case 0:
return "平台币";
break;
case 1:
return "支付宝";
break;
case 2:
return "微信(扫码)";
break;
case 3:
return "微信APP";
break;
case 4:
return "平台币";
break;
case 5:
return "聚宝云";
break;
case 6:
return "汇付宝";
break;
case 7:
return "苹果支付";
break;
}
}
function array_status2value($status,$param,$array=array()){
foreach ($array as $key => $value) {
if($value[$status]!=1){
unset($array[$key]);
}
}
return $array;
}
function array_status2valuen($status,$param,$array=array()){
foreach ($array as $key => $value) {
if($value[$status]==1){
unset($array[$key]);
}
}
return $array;
}
function array_status2valueq($status,$param,$array=array()){
return $array;
}
/**
* [获取区服名称]
* @param [type] $id [description]
* @return [type] [description]
*/
function get_server_name($id){
if($id==''){
return false;
}
$map['id']=$id;
$area=M("Server","tab_")->where($map)->find();
return $area['server_name'];
}
/**
* 获取上周指定日期时间
* @param $str 指定时间
* @return unknown 时间
*/
function get_lastweek_name($str){
switch ($str) {
case '1':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-1,date('Y')));
break;
case '2':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-2,date('Y')));
break;
case '3':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-3,date('Y')));
break;
case '4':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-4,date('Y')));
break;
case '5':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-5,date('Y')));
break;
case '6':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-6,date('Y')));
break;
case '7':
$time = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-7,date('Y')));
break;
default:
$time =date("Y-m-d",mktime(0,0,0,date('m'),date('d'),date('Y')));
break;
}
return $time;
}
// 两个日期之间的所有日期
function prDates($start,$end){
$dt_start = strtotime($start);
$dt_end = strtotime($end);
while ($dt_start<=$dt_end){
$tt[]=date('Y-m-d',$dt_start);
$dt_start = strtotime('+1 day',$dt_start);
}
return $tt;
}
/**
* 银行列表
* @return array
* author: xmy 280564871@qq.com
*/
function bank_lists($key=""){
$lists = [
"boc"=> "中国银行",
"cmb"=> "招商银行",
"icbc"=> "工商银行",
"ccb"=> "建设银行",
"abc"=> "农业银行",
"cib"=> "兴业银行",
"ecitic"=> "中信银行",
"bcomm"=> "交通银行",
"cmbc"=> "民生银行",
"ceb"=> "光大银行",
"hxb"=> "华夏银行",
"cgb"=> "广发银行",
"cngold"=> "深圳发展银行",
"spdb"=> "浦东发展银行",
"other"=> "其它",
];
return empty($key) ? $lists : $lists[$key];
}
/**
* 获取用户未读消息数
* @param $develop_id
* @return mixed
* author: xmy 280564871@qq.com
*/
function getUnreadMsg($develop_id){
$model = new \Open\Model\OpenMessageModel();
$data = $model->countMsg($develop_id);
return $data;
}
/**
* 获取开放平台游戏列表
* @param $develop_id
* @return mixed
* author: xmy 280564871@qq.com
*/
function getDevelopGameList($develop_id){
$map['develop_id'] = $develop_id;
$model = new \Open\Model\GameModel();
$data = $model->getLists($develop_id);
return $data;
}