Yuanxiao.php
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
namespace Cuxiao;
use LibModels\Wap\Cuxiao\ActivityData;
use LibModels\Wap\Home\UserData;
/**
* Created by PhpStorm.
* User: Gtskk
* Date: 2016/2/18
* Time: 16:26
*
* @name YuanxiaoModel
* @package models/Cuxiao
* @author Gtskk(tttt6399998@126.com)
*/
class YuanxiaoModel
{
/**
* 处理用户详情数据
*
* @param int $uid 用户ID
* @return array|mixed 处理之后的个人详情数据
*/
public static function getUserProfileData($uid)
{
$result = array(
'birthday' => '2000-01-01',
'gender' => 2
);
// 调用接口获取个人详情
$userData = UserData::userData($uid, false);
// 处理个人详情数
if (isset($userData['data']) && !empty($userData['data'])) {
$result['birthday'] = $userData['data']['birthday'] ?: '2000-01-01';
$result['gender'] = $userData['data']['gender'];
}
return $result;
}
/**
* @param int $uid 用户UID
* @param sring $nickName 用户昵称
* @param string $birthday 用户生日
* @param int $gender 用户性别
* @return array 处理之后抽签的结果
*/
public static function getChouqianInfo($uid, $nickName, $birthday, $gender)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($uid)) {
break;
}
if (empty($nickName)) {
$result['message'] = '昵称不能为空';
break;
}
if (empty($birthday)) {
$result['message'] = '生日不能为空';
break;
}
if (empty($gender)) {
$result['message'] = '性别不能为空';
break;
}
$chouqian = ActivityData::getYuanxiaoInfo($uid, $nickName, $birthday, $gender);
if ($chouqian) {
$result = $chouqian;
}
} while (false);
return $result;
}
/**
* @param int $uid 用户UID
* @return array|mixed 抽奖的结果
*/
public static function getChoujiangShareInfo($uid)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($uid)) {
break;
}
$chouqian = ActivityData::getYuanxiaoShareInfo($uid);
if (isset($chouqian['data'])) {
$result = array(
'name' => $chouqian['data']['nickname'],
'type' => $chouqian['data']['randomCode'],
'total' => $chouqian['data']['total']
);
}
} while (false);
return $result;
}
}