Example #1
0
function is_lucky_man($openId)
{
    $sqlArr = array();
    $sqlArr['where'] = "`openId` = '{$openId}' and `isLucky` = '1'";
    $data = select(LOG_TABLE, $sqlArr);
    if (is_array($data) && $data["openId"] == $openId) {
        $user = get_weixin_user_info($openId);
        $bResult = update_luck_man($data["openId"], $user["nickname"]);
        return true;
    } else {
        return false;
    }
}
Example #2
0
 /**
  * 进行抽奖
  *
  * @param string
  * @return array
  */
 public function rand_lucky()
 {
     $lucky = rand_lucky_man();
     if (is_array($lucky)) {
         //获取中奖者信息
         $user = get_weixin_user_info($lucky["openId"]);
         //标示中奖者
         $bResult = update_luck_man($lucky["openId"], $user["nickname"]);
         //推送中奖信息
         $msg = c("weixin_lucky_msg");
         if (c("wxPush")) {
             $bResult = send_weixin_msg($lucky["openId"], $msg);
         }
         if ($bResult) {
             return self::send_result($user["nickname"]);
         } else {
             return self::send_error(LR_API_SYSTEM_EXCEPTION, '抱歉,系统发生未知故障!');
         }
     } else {
         return self::send_error(LR_API_SYSTEM_EXCEPTION, '抱歉,系统发生未知故障!');
     }
 }