Showing
3 changed files
with
68 additions
and
0 deletions
@@ -149,6 +149,28 @@ class UserData | @@ -149,6 +149,28 @@ class UserData | ||
149 | } | 149 | } |
150 | 150 | ||
151 | /** | 151 | /** |
152 | + * 浏览记录数据 | ||
153 | + * | ||
154 | + * @param int $uid 用户ID | ||
155 | + * @param int $udid 客户端唯一标识 | ||
156 | + * @param int $page 第几页,默认为1 | ||
157 | + * @param int $limit 限制多少条,默认100 | ||
158 | + * @return array 接口返回的数据 | ||
159 | + */ | ||
160 | + public static function browseRecord($uid, $udid, $page = 1, $limit = 100) | ||
161 | + { | ||
162 | + $param = Yohobuy::param(); | ||
163 | + $param['method'] = 'app.browse.product'; | ||
164 | + $param['uid'] = $uid; | ||
165 | + $param['udid'] = $udid; | ||
166 | + $param['page'] = $page; | ||
167 | + $param['limit'] = $limit; | ||
168 | + $param['client_secret'] = Sign::getSign($param); | ||
169 | + | ||
170 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
152 | * YOHO币数据 | 174 | * YOHO币数据 |
153 | * | 175 | * |
154 | * @param int $uid 用户ID | 176 | * @param int $uid 用户ID |
@@ -118,6 +118,29 @@ class HomeController extends AbstractAction | @@ -118,6 +118,29 @@ class HomeController extends AbstractAction | ||
118 | } | 118 | } |
119 | 119 | ||
120 | /** | 120 | /** |
121 | + * 浏览记录 | ||
122 | + */ | ||
123 | + public function recordAction() | ||
124 | + { | ||
125 | + $result = array(); | ||
126 | + | ||
127 | + if ($this->isAjax()) { | ||
128 | + $uid = $this->getUid(); | ||
129 | + $udid = $this->getUdid(); | ||
130 | + $page = $this->get('page', 1); | ||
131 | + $limit = $this->get('limit', 100); | ||
132 | + | ||
133 | + $result = UserModel::browserRecord($uid, $udid, $page, $limit); | ||
134 | + } | ||
135 | + | ||
136 | + if (empty($result)) { | ||
137 | + echo ' '; | ||
138 | + } else { | ||
139 | + $this->echoJson($result); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
121 | * 个人信息 | 144 | * 个人信息 |
122 | */ | 145 | */ |
123 | public function personalDetailsAction() | 146 | public function personalDetailsAction() |
@@ -234,6 +234,29 @@ class UserModel | @@ -234,6 +234,29 @@ class UserModel | ||
234 | } | 234 | } |
235 | 235 | ||
236 | /** | 236 | /** |
237 | + * 处理浏览记录数据 | ||
238 | + * | ||
239 | + * @param int $uid 用户ID | ||
240 | + * @param int $udid 客户端唯一标识 | ||
241 | + * @param int $page 第几页,默认为1 | ||
242 | + * @param int $limit 限制多少条,默认100 | ||
243 | + * @return array处理之后的数据 | ||
244 | + */ | ||
245 | + public static function browserRecord($uid, $udid, $page, $limit) | ||
246 | + { | ||
247 | + $result = array(); | ||
248 | + | ||
249 | + $records = UserData::browseRecord($uid, $udid, $page, $limit); | ||
250 | + | ||
251 | + // 处理数据 | ||
252 | + if (isset($records['data']['product_list']) && !empty($records['data']['product_list'])) { | ||
253 | + $result = $records['data']['product_list']; | ||
254 | + } | ||
255 | + | ||
256 | + return $result; | ||
257 | + } | ||
258 | + | ||
259 | + /** | ||
237 | * 处理YOHO币数据 | 260 | * 处理YOHO币数据 |
238 | * | 261 | * |
239 | * @param int $uid 用户ID | 262 | * @param int $uid 用户ID |
-
Please register or login to post a comment