Exemple #1
0
 /**
  * 幸运日辅助函数
  * @param  array $dbRes 身份信息,学号,易班id等
  * @return string        发网薪的msg
  * @author nili 
  */
 public function awardTmpLuck($dbRes)
 {
     if (Data_Db::getTodayLog($dbRes['yiban_uid'])) {
         return "您今日抽奖次数已用完,下次再来~";
     }
     $award = (rand() % 5 + 1) * 100;
     $msg = "你抽中了{$award}网薪,";
     $validAccessToken = Data_Db::getValidAccessToken($dbRes['yiban_uid']);
     if (!$validAccessToken) {
         $msg .= "但是易班身份已过期,可以重新绑定再来抽奖~";
         return $msg;
     }
     Data_Db::insertLog($dbRes['yiban_uid'], $dbRes['xmu_num'], $award);
     $requestUri = $_SERVER['REQUEST_URI'];
     Vera_Autoload::setApp('yiban');
     $_SERVER['REQUEST_URI'] = '/wechat/tmpLuck';
     $awardRes = Data_Yiban::awardSalary($dbRes['yiban_uid'], $validAccessToken, $award);
     Vera_Autoload::setApp('wechat');
     $_SERVER['REQUEST_URI'] = $requestUri;
     if ($awardRes) {
         $msg .= '网薪已发放至您的账户。';
     } else {
         $msg .= '未知原因发网薪失败,可截图找管理员找回~';
     }
     return $msg;
 }