作者 anyv
1 个管道 的构建 通过 耗费 15 秒

投票次数限制

... ... @@ -108,7 +108,16 @@ class VoteController extends WeChatBaseController{
$coupyh['cid'] = $tpyh['id'];
$coupyh['state'] = 0;
$coupyh['code'] = date('md').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
//限制投票次数
$toupiaoshu = Db::name('coupons_user') -> where("uid = ".$coupyh['uid']." and cid=".$coupyh['cid']) -> select();
$xianzhi = Db::name('vote') -> where("pid = 0") -> select();
if(count($toupiaoshu) < count($xianzhi)){
Db::name('coupons_user') -> insert($coupyh);
}
if($data){
... ... @@ -131,7 +140,16 @@ class VoteController extends WeChatBaseController{
$coupyh['cid'] = $tpyh['id'];
$coupyh['state'] = 0;
$coupyh['code'] = date('md').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
//限制投票次数
$toupiaoshu = Db::name('coupons_user') -> where("uid = ".$coupyh['uid']." and cid=".$coupyh['cid']) -> select();
$xianzhi = Db::name('vote') -> where("pid = 0") -> select();
if(count($toupiaoshu) < count($xianzhi)){
Db::name('coupons_user') -> insert($coupyh);
}
$ids = explode(',', input('post.ids'));
foreach ($ids as $key => $value) {
... ...