class Promotion extends BaseApi
{
/**
* 获取营销游戏列表
*/
public function promotionGamesList()
{
$page_index = isset($this->params['page_index']) ? $this->params['page_index'] : 1;
$page_size = isset($this->params['page_size']) ? $this->params['page_size'] : 0;
$condition = isset($this->params['condition']) ? $this->params['condition'] : "";
$order = isset($this->params['order']) ? $this->params['order'] : "";
$promotion = new PromotionService();
$res = $promotion->getPromotionGamesList($page_index, $page_size, $condition, $order);
return $this->outMessage("获取营销游戏列表", $res);
}
/**
* 是否开启
*/
public function checkGameOpen()
{
$game_id = isset($this->params['game_id']) ? $this->params['game_id'] : "";
if (empty($this->uid)) {
$_SESSION['login_pre_url'] = __URL(\think\Config::get('view_replace_str.APP_MAIN') . "/Game/index?gid=" . $game_id);
$redirect = __URL(__URL__ . "/wap/login");
return $this->outMessage("判断是否开启", $redirect);
} else {
return $this->outMessage("判断是否开启", null, -1);
}
}
/**
* 游戏检测
*/
public function checkGame()
{
$promotion = new PromotionService();
$game_id = isset($this->params['game_id']) ? $this->params['game_id'] : "";
$gameDetail = $promotion->getPromotionGameDetail($game_id);
if (empty($gameDetail["game_id"])) {
return $this->outMessage("未找到该活动信息!", "member/index", 0);
}
if ($gameDetail["start_time"] > time()) {
return $this->outMessage("该活动尚未开始!", "member/index", 1);
}
if ($gameDetail["end_time"] < time()) {
return $this->outMessage("该活动尚未开始!", "member/index", 2);
}
if ($gameDetail["member_level"] != 0) {
if ($gameDetail["member_level"] != $gameDetail["member_level"]) {
$error_message = "对不起,该活动只有" . $gameDetail["level_name"] . "才可以参与!";
$this->error($error_message, "member/index");
return $this->outMessage($error_message, "member/index", 3);
}
}
return $this->outMessage("游戏详情", $gameDetail, 4);
}
/**
* 获奖列表
*/
public function gameWinningList()
{
$promotion = new PromotionService();
$game_id = isset($this->params['game_id']) ? $this->params['game_id'] : "";
$gameDetail = $promotion->getPromotionGameDetail($game_id);
$condition = [
"game_id" => $game_id,
"shop_id" => $this->instance_id,
"is_winning" => 1
];
$winningRecordsList = array();
if ($gameDetail['winning_list_display'] == 1) {
$winningRecordsList = $promotion->getPromotionGameWinningRecordsList(1, 15, $condition, "add_time desc", "*");
}
return $this->outMessage("获奖列表", $winningRecordsList['data']);
}
/**
* 活动参与限制
*/
public function participationRestriction()
{
$promotion = new PromotionService();
$game_id = isset($this->params['game_id']) ? $this->params['game_id'] : "";
$participationRestriction = $promotion->getPromotionParticipationRestriction($game_id, $this->uid);
return $this->outMessage("活动限制", $participationRestriction);
}
/**
* 随机获取奖项
*/
public function randAward()
{
$title = "随机获取奖项";
$promotion = new PromotionService();
$game_id = isset($this->params['game_id']) ? $this->params['game_id'] : 0;
$participationRestriction = $promotion->getPromotionParticipationRestriction($game_id, $this->uid);
if (!empty($participationRestriction)) {
$res = array(
"is_winning" => -1,
"message" => $participationRestriction
);
return $this->outMessage($title, $res);
}
$res = $promotion->getRandAward($game_id);
if ($res['is_winning'] == -2) {
return $this->outMessage($title, $res);
}
//添加中奖记录
$data = array(
"uid" => $this->uid,
"game_id" => $game_id,
"rule_id" => $res["winning_info"]["rule_id"],
);
$result = $promotion->addPromotionGamesWinningRecords($data);
if ($result["code"] == 0) {
$res = array(
"is_winning" => 0,
"no_winning_instruction" => $res["no_winning_instruction"]
);
return $this->outMessage($title, $res);
} else if ($result["code"] == -1) {
$res = array(
"is_winning" => -1,
"message" => $result["message"]
);
return $this->outMessage($title, $res);
}
return $this->outMessage($title, $res);
}
/**
* 积分配置
*/
public function pointConfig()
{
$Promotion = new PromotionService();
$pointconfiginfo = $Promotion->getPointConfig();
return $this->outMessage("积分配置", $pointconfiginfo);
}
/**
* 获取赠品详情
*/
public function promotionGiftDetail()
{
if (empty($this->uid)) {
return $this->outMessage('', "", '-9999', "无法获取会员登录信息");
}
$gift_id = isset($this->params['id']) ? $this->params['id'] : '';
$promotion = new PromotionService();
$giftDetail = $promotion->getPromotionGiftDetail($gift_id);
return $this->outMessage('', $giftDetail);
}
}
public function memberInfo()
{
$title = "获取会员信息";
if (empty($this->uid)) {
return $this->outMessage($title, "", '-9999', "无法获取会员登录信息");
}
$sys_user = new User();
$member = new MemberService();
$field = 'uid,user_name,user_status,user_headimg,user_tel,user_qq,qq_openid,qq_info,user_email,wx_openid,wx_is_sub,wx_info,real_name,sex,location,nick_name,wx_unionid,birthday';
$user_info = $sys_user->getUserInfoByCondition([ 'uid' => $this->uid ], $field);
$member_info = $member->getMemberInfo([], 'member_level,member_label');
$member_detail = [];
if (!empty($user_info)) {
if ($user_info["user_status"] == 0) {
$user_info["user_status_name"] = "锁定";
} else {
$user_info["user_status_name"] = "正常";
}
if (!empty($user_info["birthday"])) {
$user_info["birthday"] = date('Y-m-d', $user_info["birthday"]);
}
$member_detail["user_info"] = $user_info;
}
if (!empty($member_info)) {
$member_detail['member_level'] = $member_info['member_level'];
$member_detail['member_label'] = $member_info['member_label'];
}
return $this->outMessage($title, $member_detail);
}
优享精灵首码介绍:
互联网已经成为人们生活最基本的保障,流量是互联网公司最大的价值,所有互联网创业项目都需要用户,而CPA拉新推广是互联网公司增长新用户最有效的方式之一,至此优享精灵顺应而生,为企业新增用户提高用户量以及知名度,解决商家获客难的问题,商家支付佣金,支付获客成本已成为常态,市场前景广阔。
优享精灵源码稳定性:
1、平台的稳定性!无论技术还是运营,都是保证平台长久发展的基础;
2、模式的合理性!这么庞大的一个聚合平台,佣金结算系统设计是否合理?是否能真正做到多劳多得,激励每个人都动起来,让平台永远充满活力!
3、平台任务单的数量保证!优享精灵的任务,涉及六大门类,40余种任务版块,几乎对接了全网所有的任务平台资源,保证注册进来的铁子们,有单做,有钱賺!
4、团队领导人的责任心!跟一个负责任的团队长,跟一个有战斗力的团队!很多人扔给你个码,注册完拉倒了,然后连基本的通知都不及时传达,一段时间之后,甚至连邀请人都找不到了…这样怎能保证团队成员的利益?