public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); $root['user_id'] = $user_id; if ($user_id > 0) { $sql = "select count(*) from " . DB_PREFIX . "user where id = '" . $user_id . "' and paypassword != '' and is_delete = 0"; $count = $GLOBALS['db']->getOne($sql); if ($count > 0) { $root['mobile'] = hideMobile($user['mobile']); $root['response_code'] = 1; } else { $root['show_err'] = "请设置支付密码!"; output($root); } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "支付密码"; output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); $root['user_id'] = $user_id; if ($user_id > 0) { $root['mobile'] = hideMobile($user['mobile']); } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "重置支付密码"; output($root); }
/** * 生成中奖信息 uid:用户id,mobile:用户手机号码; */ public function make($user = array()) { $uid = !empty($user["uid"]) ? (int) $user["uid"] : 0; $username = !empty($user["mobile"]) ? hideMobile($user["mobile"]) : ''; if (empty($user) || empty($uid) || empty($username)) { return array("is_win" => 0, "title" => "抽奖用户ID或用户手机号码不能为空"); } if (!empty($this->begin_time) && time() < strtotime($this->begin_time)) { return array("is_win" => 0, "title" => "抽奖还没有开始,开始时间为:" . $this->begin_time); } if (!empty($this->stop_time) && time() > strtotime($this->stop_time)) { return array("is_win" => 0, "title" => "本次抽奖已经结束,结束时间为:" . $this->stop_time); } //获取奖项信息数组,来源于私有成员 $date_day = date("Y-m-d"); //测试抽奖 //$date_day = date("Y-m-d",strtotime("+2 day")); $prize_arr_num = $this->prize_num; if (empty($prize_arr_num[$date_day])) { return array("is_win" => 0, "title" => "抽奖活动还未开始"); } $prize_arr = !empty($prize_arr_num[$date_day]) ? $prize_arr_num[$date_day] : array(); foreach ($prize_arr as $key => $val) { $arr[$val['id']] = $val['v']; } //$rid中奖的序列号码 $rid = $this->get_rand($arr); //根据概率获取奖项id $str = $prize_arr[$rid - 1]['prize']; //中奖项 //判断用户当天是否已经抽过奖 $star_day = date("Y-m-d" . " 00:00:00"); $end_day = date("Y-m-d" . " 23:59:59"); $res_user = $this->count_all(array("uid" => $uid, "start_time" => $star_day, "end_time" => $end_day)); //国庆中秋活动新增2次抽奖机会 if ($res_user >= 2) { return array("is_win" => 0, "title" => "您今天的抽奖次数已经用完"); } //判断今天奖品已经抽完; $res_win = $this->count_all(array("win_id" => $rid, "start_time" => $star_day, "end_time" => $end_day)); if ($res_win >= $prize_arr[$rid - 1]['num']) { $str = '国庆快乐'; $rid = 0; } //生成一个用户抽奖的数据,用来记录到数据库 $data = array('uid' => $uid, 'nickname' => $username, 'win_id' => $rid, 'title' => $str, 'is_win' => $rid == 0 ? 0 : 1); //将用户抽奖信息数组写入数据库 $sv_result = $this->save($data); if (!empty($sv_result)) { $cjtq_money = 0; $plus_id = 0; $gold_point = 0; switch ($data['win_id']) { case 1: $plus_id = 1; break; case 2: $plus_id = 2; break; case 3: $plus_id = 3; break; case 4: $cjtq_money = 2000; break; case 5: $cjtq_money = 1000; break; case 6: $cjtq_money = 500; break; case 7: $gold_point = rand(30, 100); break; } //自动发送特权金 if ($cjtq_money > 0 && !empty($uid)) { $userinfo = $this->user_info->get($uid); $this->recharge->add_counterfeit_money($userinfo, $cjtq_money, $sv_result, "lottery"); $_SESSION['user_info'] = $this->user_info->get($userinfo['uid']); } //自动发放加息券 if ($plus_id > 0 && !empty($uid)) { $this->plus_coupons->get_props($uid, $plus_id); } //自动发放图腾币 if ($gold_point > 0 && !empty($uid)) { $this->points->addPointsLog(array('uid' => $uid, 'tob' => 'activity', 'scores' => $gold_point, 'title' => '国庆活动')); $str = $gold_point . '个图腾币'; $this->save(array('title' => $str), $sv_result); } return array("is_win" => $data['is_win'], "win_id" => $data['win_id'], "status" => 'yes', "title" => $str); } else { return array("is_win" => 0, "title" => "抽奖失败"); } }