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.
64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?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 Site\Model;
|
|
|
|
/**
|
|
* 分类模型
|
|
*/
|
|
class SiteGroupModel extends SiteModel{
|
|
|
|
protected $_validate = array(
|
|
array('site_game_id', 'check_game', '该游戏已经存在', self::EXISTS_VALIDATE, 'callback', self::MODEL_BOTH),
|
|
array('group_code', 'is_numeric', '群号必须是数字', self::EXISTS_VALIDATE, 'function', self::MODEL_BOTH),
|
|
array('in_num', 'is_numeric', '入驻必须是数字', self::EXISTS_VALIDATE, 'function', self::MODEL_BOTH),
|
|
array('in_num', [0,10000], '入驻人数错误', self::EXISTS_VALIDATE, 'between', self::MODEL_BOTH),
|
|
);
|
|
|
|
protected $_auto = array(
|
|
array('create_time', NOW_TIME, self::MODEL_INSERT),
|
|
array('promote_id', PID, self::MODEL_BOTH),
|
|
);
|
|
|
|
/**
|
|
* @param int $promote_id
|
|
* @return mixed
|
|
*/
|
|
public function get_promote_data($promote_id=PID){
|
|
$map['promote_id'] = $promote_id;
|
|
$map['status'] = 1;
|
|
$data = $this->where($map)->select();
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* 检查游戏是否存在
|
|
* @return bool
|
|
*/
|
|
public function check_game(){
|
|
$map['id'] = ['neq',I('id')];
|
|
$map['promote_id'] = PID;
|
|
$map['site_game_id'] = I('site_game_id');
|
|
$data = $this->where($map)->find();
|
|
if(empty($data)){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function saveData($data = "")
|
|
{
|
|
$data = I('post.');
|
|
$data['game_name'] = get_site_game_name($data['site_game_id']);
|
|
return parent::saveData($data); // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
}
|