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

投票

... ... @@ -76,6 +76,17 @@ class VoteController extends WeChatBaseController{
Db::name('mevo') -> insert($tian);
$data = Db::name('vote') -> where('id',$id) -> setInc('votes');
//投票优惠券
$uid = Db::name('members_user') -> where('uid',$mid) -> find();
$tpyh = Db::name('coupons') -> where('type',4) -> find();
$coupyh['uid'] = $uid['id'];
$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);
Db::name('coupons_user') -> insert($coupyh);
if($data){
return false;
}else{
... ... @@ -88,6 +99,16 @@ class VoteController extends WeChatBaseController{
public function vshuang(){
$mid = cmf_get_current_user_id();
//投票优惠券
$uid = Db::name('members_user') -> where('uid',$mid) -> find();
$tpyh = Db::name('coupons') -> where('type',4) -> find();
$coupyh['uid'] = $uid['id'];
$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);
Db::name('coupons_user') -> insert($coupyh);
$ids = explode(',', input('post.ids'));
foreach ($ids as $key => $value) {
Db::name('vote') -> where('id',$value) -> setInc('votes');
... ... @@ -96,6 +117,9 @@ class VoteController extends WeChatBaseController{
$data['mid'] = $mid;
$data['vid'] = $tid;
$pan = Db::name('mevo') -> insert($data);
if($pan){
return true;
}else{
... ...