当前位置: 首页>>代码示例>>PHP>>正文


PHP add_credit函数代码示例

本文整理汇总了PHP中add_credit函数的典型用法代码示例。如果您正苦于以下问题:PHP add_credit函数的具体用法?PHP add_credit怎么用?PHP add_credit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_credit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reply

 function reply($dataArr, $keywordArr = array())
 {
     $this->config = getAddonConfig('Chat');
     // 获取后台插件的配置参数
     $content = $this->_tuling($dataArr['Content']);
     if ($content) {
         exit;
     }
     // 先尝试小九机器人 目前已不可用
     if (empty($content)) {
         // $content = $this->_xiaojo ( $dataArr ['Content'] );
     }
     // 再尝试小黄鸡
     if (empty($content)) {
         $content = $this->_simsim($dataArr['Content']);
     }
     // TODO 此处可继续增加其它API接口
     // 最后只能随机回复了
     if (empty($content)) {
         $content = $this->_rand();
     }
     // 增加积分,每隔5分钟才加一次,5分钟内只记一次积分
     add_credit('chat', 300);
     $res = $this->replyText($content);
     return $res;
 }
开发者ID:Rayuu,项目名称:weiphp,代码行数:26,代码来源:WeixinAddonModel.class.php

示例2: index

 function index()
 {
     add_credit('weisite', 86400);
     if (file_exists(ONETHINK_ADDON_PATH . 'WeiSite/View/default/pigcms/Index_' . $this->config['template_index'] . '.html')) {
         $this->pigcms_index();
         $this->display(ONETHINK_ADDON_PATH . 'WeiSite/View/default/pigcms/Index_' . $this->config['template_index'] . '.html');
     } else {
         $map['token'] = get_token();
         $map['is_show'] = 1;
         $map['pid'] = 0;
         // 获取一级分类
         // 幻灯片
         $slideshow = M('weisite_slideshow')->where($map)->order('sort asc, id desc')->select();
         foreach ($slideshow as &$vo) {
             $vo['img'] = get_cover_url($vo['img']);
         }
         $this->assign('slideshow', $slideshow);
         // dump($slideshow);
         // 分类
         $category = M('weisite_category')->where($map)->order('sort asc, id desc')->select();
         foreach ($category as &$vo) {
             $vo['icon'] = get_cover_url($vo['icon']);
             empty($vo['url']) && ($vo['url'] = addons_url('WeiSite://WeiSite/lists', array('cate_id' => $vo['id'])));
         }
         $this->assign('category', $category);
         $map2['token'] = $map['token'];
         $public_info = get_token_appinfo($map2['token']);
         $this->assign('publicid', $public_info['id']);
         $this->assign('manager_id', $this->mid);
         $this->_footer();
         $this->display(ONETHINK_ADDON_PATH . 'WeiSite/View/default/TemplateIndex/' . $this->config['template_index'] . '/index.html');
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:33,代码来源:WeiSiteController.class.php

示例3: reply

 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     if ($keywordArr['extra_text'] == 'custom_reply_mult') {
         // 多图文回复
         $mult = M('custom_reply_mult')->where($map)->find();
         $map_news['id'] = array('in', $mult['mult_ids']);
         $list = M('custom_reply_news')->where($map_news)->select();
         foreach ($list as $k => $info) {
             if ($k > 8) {
                 continue;
             }
             $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         }
         $res = $this->replyNews($articles);
     } elseif ($keywordArr['extra_text'] == 'custom_reply_news') {
         // 单条图文回复
         $info = M('custom_reply_news')->where($map)->find();
         // 组装微信需要的图文数据,格式是固定的
         $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         $res = $this->replyNews($articles);
     } else {
         // 增加积分
         add_credit('custom_reply', 300);
         // 文本回复
         $info = M('custom_reply_text')->where($map)->find();
         $contetn = replace_url(htmlspecialchars_decode($info['content']));
         $this->replyText($contetn);
     }
 }
开发者ID:noikiy,项目名称:weiphp,代码行数:32,代码来源:WeixinAddonModel.class.php

示例4: unsubscribe

 public function unsubscribe($dataArr)
 {
     // 增加积分
     add_credit('unsubscribe');
     //取消关注时的操作
     D('Common/Follow')->unsubscribeFollow($dataArr['FromUserName']);
 }
开发者ID:strivi,项目名称:siples,代码行数:7,代码来源:WeixinAddonModel.class.php

示例5: suggest

 function suggest()
 {
     $config = getAddonConfig('Suggestions');
     $this->assign($config);
     // dump ( $config );
     $map['id'] = $data['uid'] = $this->mid;
     $user = get_followinfo($this->mid);
     $this->assign('user', $user);
     if (IS_POST) {
         // 保存用户信息
         $nickname = I('nickname');
         if ($config['need_nickname'] && !empty($nickname)) {
             $data['nickname'] = $nickname;
         }
         $mobile = I('mobile');
         if ($config['need_mobile'] && !empty($mobile)) {
             $data['mobile'] = $mobile;
         }
         // 保存内容
         $data['cTime'] = time();
         $data['content'] = I('content');
         $data['token'] = get_token();
         $res = M('suggestions')->add($data);
         if ($res) {
             // 增加积分
             add_credit('suggestions');
             $this->success('增加成功,谢谢您的反馈');
         } else {
             $this->error('增加失败,请稍后再试');
         }
     } else {
         $this->display();
     }
 }
开发者ID:zqstudio2015,项目名称:myweiphp,代码行数:34,代码来源:SuggestionsController.class.php

示例6: receive

 function receive()
 {
     $info = D('Invite')->getInfo(I('id'));
     $this->assign('info', $info);
     $this->deal($info);
     $detail_url = addons_url('Invite://Wap/detail', array('id' => $info['id'], 'invite_uid' => $this->mid, 'token' => get_token()));
     $map['uid'] = $this->mid;
     $map['invite_id'] = $info['id'];
     $recode = M('invite_user')->where($map)->find();
     if ($recode) {
         redirect($detail_url);
     }
     // 优惠券是否领取 完或者到期
     $data = M('coupon')->find($info['coupon_id']);
     if ($data['start_time'] > NOW_TIME) {
         // 			$url = addons_url ( 'WeiSite://WeiSite/lists' );
         $url = addons_url('Invite://Wap/lists');
         $this->error('本次微邀约还没开始,下次再来吧。', $url);
     }
     if ($data['num'] <= $data['collect_count'] || $data['end_time'] > 0 && $data['end_time'] < NOW_TIME) {
         // 			$url = addons_url ( 'WeiSite://WeiSite/lists' );
         $url = addons_url('Invite://Wap/lists');
         $this->error('本次微邀约已经结束,下一次再来吧。', $url);
     }
     // 减少经历值
     $user = get_mult_userinfo($this->mid);
     //dump($user);die();
     if ($info['experience'] > $user['experience']) {
         $url = addons_url('Invite://Wap/lists');
         $this->error('你的经历值不足', $url);
     }
     // 增加领取记录
     $map['invite_num'] = 0;
     M('invite_user')->add($map);
     $credit['experience'] = 0 - $info['experience'];
     $credit['score'] = 0;
     add_credit('invite', 5, $credit);
     // 发放优惠券
     $data['sn'] = uniqid();
     $data['uid'] = $this->mid;
     $data['cTime'] = time();
     $data['addon'] = 'Coupon';
     $data['target_id'] = $info['coupon_id'];
     $data['can_use'] = 0;
     $data['prize_id'] = 0;
     $data['prize_title'] = '';
     unset($data['id']);
     // dump ( $data );
     $res = D('Common/SnCode')->delayAdd($data);
     if ($res) {
         // 更新获取数
         // M ( "coupon" )->where ( 'id=' . $info ['coupon_id'] )->setInc ( "collect_count" );
         M("invite")->where('id=' . $info['id'])->setInc("receive_num");
     } else {
         $this->error('优惠券发送失败');
     }
     redirect($detail_url);
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:58,代码来源:WapController.class.php

示例7: unsubscribe

 public function unsubscribe($data)
 {
     // 直接删除用户
     //$map1 ['openid'] = $data ['FromUserName'];
     //$map1 ['token'] = get_token ();
     //$map2 ['uid'] = D ( 'public_follow' )->where ( $map1 )->getField ( 'uid' );
     //M ( 'public_follow' )->where ( $map1 )->delete ();
     //M ( 'user' )->where ( $map2 )->delete ();
     //M ( 'credit_data' )->where ( $map2 )->delete ();
     //取消专注改变用户状态
     D('Common/Follow')->set_subscribe($data['FromUserName'], 0);
     session('mid', null);
     // 积分处理
     add_credit('unsubscribe');
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:15,代码来源:WeixinAddonModel.class.php

示例8: reply

 function reply($dataArr, $keywordArr = array())
 {
     $this->config = getAddonConfig('Chat');
     // 获取后台插件的配置参数
     $content = $this->_tuling($dataArr['Content']);
     if ($content) {
         exit;
     }
     // 最后只能随机回复了
     if (empty($content)) {
         $content = $this->_rand();
     }
     // 增加积分,每隔5分钟才加一次,5分钟内只记一次积分
     add_credit('chat', 300);
     $res = $this->replyText($content);
     return $res;
 }
开发者ID:215789586,项目名称:phpwei,代码行数:17,代码来源:WeixinAddonModel.class.php

示例9: suggest

 public function suggest()
 {
     $config = getAddonConfig('Suggestions');
     if (IS_AJAX) {
         // 保存用户信息
         $nickname = I('nickname');
         if ($config['need_nickname'] && !empty($nickname)) {
             $data['nickname'] = $nickname;
         }
         $mobile = I('mobile');
         if ($config['need_mobile'] && !empty($mobile)) {
             $data['mobile'] = $mobile;
         }
         // 保存内容
         $data['cTime'] = time();
         $data['content'] = I('content');
         $data['token'] = get_token();
         $res = M('suggestions')->add($data);
         if ($res) {
             // 增加积分
             add_credit('suggestions');
             $data['status'] = 1;
             $data['info'] = '反馈成功,感谢您的支持~';
             //$this->success ( '增加成功,谢谢您的反馈' );
             $openid = getOpenidByUid($config['admin_id']);
             $kf_data['touser'] = $openid;
             $kf_data['msgtype'] = 'text';
             $kf_data['text']['content'] = "新的反馈内容:" . $data['content'];
             //replyText(json_encode($kf_data));
             sendCustomMessage($kf_data);
         } else {
             $data['status'] = 0;
             $data['info'] = '反馈失败,请重新提交反馈内容~';
             //$this->error ( '增加失败,请稍后再试' );
         }
         $this->ajaxReturn($data);
     } else {
         $this->assign($config);
         // dump ( $config );
         $user = getUserInfo(get_mid());
         $this->assign('user', $user);
         $this->display();
     }
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:44,代码来源:SuggestionsController.class.php

示例10: reply

 function reply($dataArr, $keywordArr = array())
 {
     $config = getAddonConfig('Wecome');
     // 获取后台插件的配置参数
     if ($dataArr['Content'] == 'subscribe') {
         $info = D('Common/Follow')->init_follow($dataArr['FromUserName']);
         // 增加积分
         session('mid', $info['id']);
         add_credit('subscribe');
         // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统
         $param['token'] = get_token();
         $param['openid'] = get_openid();
         $sreach = array('[follow]', '[website]', '[token]', '[openid]');
         $replace = array(addons_url('UserCenter://Wap/bind', $param), addons_url('WeiSite://WeiSite/index', $param), $param['token'], $param['openid']);
         $config['description'] = str_replace($sreach, $replace, $config['description']);
         switch ($config['type']) {
             case '3':
                 $articles[0] = array('Title' => $config['title'], 'Description' => $config['description'], 'PicUrl' => get_cover_url($config['pic_url']), 'Url' => str_replace($sreach, $replace, $config['url']));
                 $res = $this->replyNews($articles);
                 break;
             case '2':
                 return false;
                 break;
             default:
                 $res = $this->replyText($config['description']);
         }
     } elseif ($dataArr['Content'] == 'unsubscribe') {
         // 增加积分
         add_credit('unsubscribe');
     } elseif ($dataArr['Content'] == 'scan') {
         $map['scene_id'] = $dataArr['EventKey'];
         $map['token'] = get_token();
         $qr = M('qr_code')->where($map)->find();
         if ($qr['addon'] == 'UserCenter') {
             // 设置用户分组
             $group = D('Home/AuthGroup')->move_group($GLOBALS['mid'], $qr['aim_id']);
             $this->replyText('您已加入' . $group['title']);
         }
     }
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:40,代码来源:WeixinAddonModel.class.php

示例11: reply

 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     if ($data['Content'] == 'location') {
         $latitude = $dataArr['Location_X'];
         $longitude = $dataArr['Location_Y'];
         $pos = file_get_contents('http://lbs.juhe.cn/api/getaddressbylngb?lngx=' . $latitude . '&lngy=' . $longitude);
         $pos_ar = json_decode($pos, true);
         $this->replyText(htmlspecialchars_decode($pos_ar['row']['result']['formatted_address']));
     } elseif ($keywordArr['extra_text'] == 'custom_reply_mult') {
         // 多图文回复
         $mult = M('custom_reply_mult')->where($map)->find();
         $map_news['id'] = array('in', $mult['mult_ids']);
         $list = M('custom_reply_news')->where($map_news)->select();
         foreach ($list as $k => $info) {
             if ($k > 8) {
                 continue;
             }
             $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         }
         $res = $this->replyNews($articles);
     } elseif ($keywordArr['extra_text'] == 'custom_reply_news') {
         // 单条图文回复
         $info = M('custom_reply_news')->where($map)->find();
         // 组装微信需要的图文数据,格式是固定的
         $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         $res = $this->replyNews($articles);
     } else {
         // 增加积分
         add_credit('custom_reply', 300);
         // 文本回复
         $info = M('custom_reply_text')->where($map)->find();
         $contetn = replace_url(htmlspecialchars_decode($info['content']));
         $this->replyText($contetn);
     }
 }
开发者ID:linksgo2011,项目名称:wechat,代码行数:38,代码来源:WeixinAddonModel.class.php

示例12: reply

 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     if ($keywordArr['extra_text'] == 'custom_reply_mult') {
         // 多图文回复
         $mult = M('custom_reply_mult')->where($map)->find();
         $map_news['id'] = array('in', $mult['mult_ids']);
         $list = M('custom_reply_news')->where($map_news)->select();
         foreach ($list as $k => $info) {
             if ($k > 8) {
                 continue;
             }
             $param['id'] = $info['id'];
             $url = addons_url('CustomReply://CustomReply/detail', $param);
             $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $url);
         }
         $res = $this->replyNews($articles);
     } elseif ($keywordArr['extra_text'] == 'custom_reply_news') {
         // 单条图文回复
         $info = M('custom_reply_news')->where($map)->find();
         // 组装用户在微信里点击图文的时跳转URL
         // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统
         $param['id'] = $info['id'];
         $url = addons_url('CustomReply://CustomReply/detail', $param);
         // 组装微信需要的图文数据,格式是固定的
         $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $url);
         $res = $this->replyNews($articles);
     } else {
         // 增加积分
         add_credit('custom_reply', 300);
         // 文本回复
         $info = M('custom_reply_text')->where($map)->find();
         $this->replyText(htmlspecialchars_decode($info['content']));
     }
 }
开发者ID:pondyond,项目名称:WeiPHP,代码行数:37,代码来源:WeixinAddonModel.class.php

示例13: index

 function index()
 {
     $map['token'] = get_token();
     $map['is_show'] = 1;
     // 幻灯片
     $slideshow = M('weisite_slideshow')->where($map)->order('sort asc, id desc')->select();
     foreach ($slideshow as &$vo) {
         $vo['img'] = get_cover_url($vo['img']);
     }
     $this->assign('slideshow', $slideshow);
     // dump($slideshow);
     // 分类
     $category = M('weisite_category')->where($map)->order('sort asc, id desc')->select();
     foreach ($category as &$vo) {
         $vo['icon'] = get_cover_url($vo['icon']);
         empty($vo['url']) && ($vo['url'] = addons_url('WeiSite://WeiSite/lists', array('cate_id' => $vo['id'])));
     }
     $this->assign('category', $category);
     // dump($category);
     // 增加积分
     add_credit('weisite', 86400);
     $this->_footer();
     $this->display(ONETHINK_ADDON_PATH . 'WeiSite/View/default/TemplateIndex/' . $this->config['template_index'] . '/index.html');
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:24,代码来源:WeiSiteController.class.php

示例14: join

 function join()
 {
     $token = get_token();
     $opts_ids = array_filter(I('post.optArr'));
     $vote_id = intval($_POST["vote_id"]);
     // 检查ID是否合法
     if (empty($vote_id) || 0 == $vote_id) {
         $this->error("错误的投票ID");
     }
     if ($this->_is_overtime($vote_id)) {
         $this->error("该投票已过期");
     }
     if ($this->_is_join($vote_id, $this->mid, $token)) {
         $this->error("您已经投过,请不要重复投");
     }
     if (empty($_POST['optArr'])) {
         $this->error("请先选择投票项");
     }
     // 如果没投过,就添加
     $data["user_id"] = $this->mid;
     $data["vote_id"] = $vote_id;
     $data["token"] = $token;
     $data["options"] = implode(',', $opts_ids);
     $data["cTime"] = time();
     $addid = M("vote_log")->add($data);
     // 投票选项信息的num+1
     foreach ($opts_ids as $v) {
         $v = intval($v);
         $res = M("vote_option")->where('id=' . $v)->setInc("opt_count");
     }
     // 投票信息的vote_count+1
     $res = M("vote")->where('id=' . $vote_id)->setInc("vote_count");
     // 增加积分
     add_credit('vote');
     // 连续投票
     $next_id = M("vote")->where('id=' . $vote_id)->getField("next_id");
     if (!empty($next_id)) {
         $vote_id = $next_id;
     }
     redirect(U('show', 'id=' . $vote_id));
 }
开发者ID:pondyond,项目名称:WeiPHP,代码行数:41,代码来源:VoteController.class.php

示例15: detail

 function detail()
 {
     $map['id'] = I('get.id', 0, 'intval');
     $info = M('custom_reply_news')->where($map)->find();
     $this->assign('info', $info);
     M('custom_reply_news')->where($map)->setInc('view_count');
     // 增加积分
     add_credit('custom_reply', 300);
     $this->display();
 }
开发者ID:pondyond,项目名称:WeiPHP,代码行数:10,代码来源:CustomReplyController.class.php


注:本文中的add_credit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。