public function qiandao() { if (mc_is_qiandao()) { $this->error('您已签到过了哦~'); } else { if (mc_user_id()) { $coins = 3; mc_update_coins(mc_user_id(), $coins); mc_add_action(mc_user_id(), 'coins', $coins); $this->success('签到成功!', U('home/index/index')); } else { $this->success('请先登陆', U('user/login/index')); } } }
<div class="modal-header"> </div> <div class="modal-body"> <div id="mycoins" class="text-center"> <h4>我的积分:<span id="mycoinscount"><?php echo mc_coins(mc_user_id()); ?> </span></h4> <p><a href="<?php echo U('user/index/coins?id=' . mc_user_id()); ?> ">查看积分记录</a></p> <p>每日签到最多可获得<span class="text-danger">3</span>积分!</p> <?php if (mc_is_qiandao()) { ?> <a href="javascript:;" id="qiandao" class="btn btn-warning mb-10">已签到</a> <?php } else { ?> <a href="javascript:mc_qiandao();" id="qiandao" class="btn btn-warning mb-10">签到</a> <script> function mc_qiandao() { $.ajax({ url: '<?php echo U('home/perform/qiandao'); ?> ', type: 'GET', dataType: 'html',