|
|
@@ -280,7 +280,24 @@ class Pub extends BaseController
|
|
|
* @param Request $request
|
|
|
*/
|
|
|
public function getCommonUserCardInfo(Request $request){
|
|
|
- var_dump('1234');
|
|
|
+ [$uid] = UtilService::getMore([
|
|
|
+ ['uid', '','empty',"用户信息为空"],
|
|
|
+ ], $request,true);
|
|
|
+ $userData = (new UserModel)->where("uid",$uid)->find();
|
|
|
+ if(empty($userData)){
|
|
|
+ return app('json')->fail("用户不存在");
|
|
|
+ }
|
|
|
+ $userData->toArray();
|
|
|
+ $data = (new InfoAudit)->getItem(["uid"=>$uid,"status"=>1]);
|
|
|
+ if(empty($data)){
|
|
|
+ return app('json')->fail("当前用户还未通过审核");
|
|
|
+ }
|
|
|
+ $typeData = (new TypeAudit)->where("uid",$uid)->order("id","desc")->find();
|
|
|
+ $data["is_type_audit"] = (empty($typeData) || $typeData["status"]!=1)?0:1;
|
|
|
+ //名片浏览次数
|
|
|
+ (new UserModel)->where('uid', $uid)->inc('card_look_count', 1)->update();
|
|
|
+ $data["card_look_count"] = $userData["card_look_count"]+1;
|
|
|
+ return app('json')->success($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -288,8 +305,25 @@ class Pub extends BaseController
|
|
|
* @param Request $request
|
|
|
*/
|
|
|
public function getCardLookCountRank(Request $request) {
|
|
|
- var_dump('123456');
|
|
|
-
|
|
|
+ $time = $request->param('time', time()); // 时间戳,默认为当前时间
|
|
|
+ $list = (new UserModel)->where('card_look_count', '>', 0);
|
|
|
+ if ($time > 0) {
|
|
|
+ $list = $list->whereTime('create_time', '>=', $time);
|
|
|
+ }
|
|
|
+ $list = $list->order('card_look_count', 'desc')->select();
|
|
|
+ $rankList = [];
|
|
|
+ foreach ($list as $key => $value) {
|
|
|
+ $userInfo = (new UserModel)->where('uid', $value['uid'])->find();
|
|
|
+ $rankList[] = [
|
|
|
+ 'rank' => $key + 1,
|
|
|
+ 'uid' => $value['uid'],
|
|
|
+ 'nickname' => $userInfo['nickname'],
|
|
|
+ 'avatar' => $userInfo['avatar'],
|
|
|
+ 'card_look_count' => $value['card_look_count'],
|
|
|
+ 'template' => $this->getShowTemplateItem($value['uid']),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ return app('json')->success($rankList);
|
|
|
}
|
|
|
|
|
|
|