/** * 扫码送网薪接口 * @param string $num 厦大学号 * @param int $award 发放网薪额度 * @param string $act 扫码活动md5 * @param string $end 扫码活动结束时间 * @return string 网薪发放情况 * @author Nili */ public static function pay($num, $award, $act, $end) { $yibanInfo = Data_Db::getYibanInfoByXmuNum($num); $key = 'rollcall_' . $act . '_award' . $num; $cache = Vera_Cache::getInstance(); if (!empty($cache->get($key))) { return '您已在该活动获得过网薪'; } if (!$yibanInfo['yiban_islinked']) { return '未绑定易班身份,无法获得网薪'; } if ($yibanInfo['expire_time'] < date('Y-m-d H:i:s')) { return '易班身份已过期,无法获得网薪'; } Vera_Autoload::changeApp('yiban'); $ret = Data_Yiban::awardSalary($yibanInfo['yiban_uid'], $yibanInfo['access_token'], $award); Vera_Autoload::reverseApp(); if ($ret) { $cache->set($key, 1, $end); return "{$award}网薪已发往您的账户"; } else { return ''; //网薪发放失败 } }
public function run() { $wechatConf = Vera_Conf::getConf('global')['testWechat']; $appId = $wechatConf['AppID']; $appSecret = $wechatConf['AppSecret']; Vera_Autoload::changeApp('wechat'); $accessToken = Data_Base::getAccessToken($appId, $appSecret); Vera_Autoload::reverseApp(); $ret = array('access_token' => $accessToken); echo json_encode($ret); return false; }
public function run() { if (empty($_SERVER['HTTP_REFERER'])) { echo json_encode(array('errmsg' => 'referer is empty')); return false; } $wechatConf = Vera_Conf::getConf('global')['testWechat']; $url = $_SERVER['HTTP_REFERER']; $appId = $wechatConf['AppID']; $appSecret = $wechatConf['AppSecret']; Vera_Autoload::changeApp('wechat'); $ticket = Data_Base::getJsTicket($appId, $appSecret); $signArr = Data_Base::getJsSign($url, $ticket); Vera_Autoload::reverseApp(); $signArr['appId'] = $appId; echo json_encode($signArr); return false; }
public function checkin($act, $token) { $openId = self::$resource['FromUserName']; $nickname = Data_Wechat_User::getNick($openId); $avatar = Data_Wechat_User::getAvatar($openId); Vera_Autoload::changeApp('rollcall'); $service = new Service_Func(); $checkin = $service->checkin($act, $token, $openId, $nickname); Vera_Autoload::reverseApp(); if ($checkin['errno']) { $ret['type'] = 'text'; $ret['data']['Content'] = $checkin['errmsg']; return $ret; } $data = array('a' => $avatar, 'n' => $nickname); $ret['type'] = 'news'; $temp['Articles'][0]['Title'] = "您是第{$checkin['rank']}位在【{$checkin['actInfo']['name']}】签到"; $temp['Articles'][0]['Description'] = "点击大图参与大屏幕弹幕互动。"; $temp['Articles'][0]['PicUrl'] = 'http://www.novaxmu.cn/templates/rollcall/img/success.png'; $temp['Articles'][0]['Url'] = 'http://hackathontsubaki.github.io/Frontend/client.html?' . http_build_query($data); // Vera_Log::addNotice('url', $temp['Articles'][0]['Url']); $temp['Articles'][1]['Title'] = "SegmentFault"; $temp['Articles'][1]['PicUrl'] = 'http://tp1.sinaimg.cn/2036070420/180/40003289296/0'; $temp['Articles'][1]['Url'] = 'segmentfault.com'; $temp['Articles'][2]['Title'] = "FreesFund | 峰瑞资本"; $temp['Articles'][2]['PicUrl'] = 'http://freesvc.com/favicon.0bf61f76.ico'; $temp['Articles'][2]['Url'] = 'http://freesvc.com/'; $temp['Articles'][3]['Title'] = "有赞"; $temp['Articles'][3]['PicUrl'] = 'http://static.segmentfault.com/app/hackathon-2015/logos/youzan.8bf6b2b.png'; $temp['Articles'][3]['Url'] = 'https://www.youzan.com/'; $temp['Articles'][4]['Title'] = "TalkingData"; $temp['Articles'][4]['PicUrl'] = 'http://segmentfault.com/img/bVp4TP'; $temp['Articles'][4]['Url'] = 'https://www.talkingdata.com/'; $temp['Articles'][5]['Title'] = "阿里百川"; $temp['Articles'][5]['PicUrl'] = 'http://static.segmentfault.com/app/hackathon-2015/logos/baichuan.cabac3c0.png'; $temp['Articles'][5]['Url'] = 'https://baichuan.taobao.com/'; $ret['data'] = $temp; return $ret; }