|
|
@@ -1122,7 +1122,138 @@ class User extends BaseController
|
|
|
'user_work_type_id' => $user_work_type_title['title'],
|
|
|
];
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取邀请海报小程序码
|
|
|
+ * @param Request $request
|
|
|
+ */
|
|
|
+ public function getWxmpShowQrcode(Request $request)
|
|
|
+ {
|
|
|
+ $inviteData = (new SysModel)->getDataInfo("invite");
|
|
|
+ $id = $request->param('id', 0);
|
|
|
+ $bgimg = $inviteData["img"];
|
|
|
+ // if(!empty($request->user["show_img"])){
|
|
|
+ // return app('json')->success(["qrcode"=>$request->user["show_img"],"bgimg"=>$bgimg]);
|
|
|
+ // }
|
|
|
+ $templateData = (new UserShowTemplate())->where("uid", $request->user["uid"])->where("id", $id)->where("is_default", 1)->find();
|
|
|
+// if(!empty($request->user["show_img"])){
|
|
|
+// return app('json')->success(["qrcode"=>$request->user["show_img"],"bgimg"=>$bgimg]);
|
|
|
+// }
|
|
|
+ if (!empty($templateData)) {
|
|
|
+ return app('json')->success(["qrcode" => $request->user["show_img"], "bgimg" => $bgimg]);
|
|
|
+ }
|
|
|
+ $weixinA = new weixina();
|
|
|
+// $data = $weixinA->getUnlimitedQRCode("pages/index/index","scene=".$request->user["uid"]);
|
|
|
+ $data = $weixinA->getUnlimitedQRCode("pages/user/model/model", $request->user["uid"] . '_' . $id);
|
|
|
+ $weixinA = new weixina();
|
|
|
+// $data = $weixinA->getUnlimitedQRCode("pages/index/index","scene=".$request->user["uid"]);
|
|
|
+ $data = $weixinA->getUnlimitedQRCode("pages/user/model/model", $request->user["uid"] . '_' . $id);
|
|
|
+ if (empty($data)) {
|
|
|
+ return app('json')->fail("小程序码获取失败" . $weixinA->error);
|
|
|
+ }
|
|
|
+ $base64 = 'data:' . $data['contentType'] . ';base64,' . base64_encode($data['buffer']);
|
|
|
+ $res = $this->uploadImageBase64("wximg", $base64, 1);
|
|
|
+ if ($res["code"] != 1) {
|
|
|
+ return app('json')->fail($res["msg"]);
|
|
|
+ }
|
|
|
+ (new UserModel)->where("uid", $request->user["uid"])->update(["show_img" => $res["url"]]);
|
|
|
+ return app('json')->success(["qrcode" => $res["url"], "bgimg" => $bgimg]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点赞/收藏
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ * @throws DataNotFoundException
|
|
|
+ * @throws DbException
|
|
|
+ * @throws ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function likeAndBookmark(Request $request)
|
|
|
+ {
|
|
|
+ $uid = $request->param('uid', 0);
|
|
|
+ $type = $request->param('type', 0);
|
|
|
+ $userData = (new UserModel)->where("uid", $uid)->find();
|
|
|
+ if (empty($userData)) {
|
|
|
+ return app('json')->fail("用户不存在");
|
|
|
+ }
|
|
|
+ if (empty($type)) {
|
|
|
+ return app('json')->fail("参数错误");
|
|
|
+ }
|
|
|
+ $likeBookmarkInfo = (new LikeBookmark())->where('uid', $request->user['uid'])->where('aid', $uid)->where('type', $type)->where('is_del', 0)->find();
|
|
|
+ if ($type == 1) {
|
|
|
+ $typeName = 'like_count';
|
|
|
+ } else {
|
|
|
+ $typeName = 'bookmark_count';
|
|
|
+ }
|
|
|
+ if (!$likeBookmarkInfo) {
|
|
|
+ (new LikeBookmark())->save([
|
|
|
+ 'uid' => $request->user['uid'],
|
|
|
+ 'aid' => $uid,
|
|
|
+ 'type' => $type,
|
|
|
+ 'add_time' => time()
|
|
|
+ ]);
|
|
|
+ (new UserModel)->where("uid", $uid)->inc($typeName, 1)->update();
|
|
|
+ } else {
|
|
|
+ (new LikeBookmark())->where('id', $likeBookmarkInfo['id'])->update(['is_del' => 1, 'del_time' => time()]);
|
|
|
+ (new UserModel)->where("uid", $uid)->dec($typeName, 1)->update();
|
|
|
+ }
|
|
|
+ return app("json")->success("操作成功");
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 收藏列表
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ * @throws DataNotFoundException
|
|
|
+ * @throws DbException
|
|
|
+ * @throws ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function BookmarkList(Request $request)
|
|
|
+ {
|
|
|
+ $post = UtilService::getMore([
|
|
|
+ ['page', 1],
|
|
|
+ ['pageSize', 20],
|
|
|
+ ], $request);
|
|
|
+ $likeBookMarkDb = new LikeBookmark();
|
|
|
+ $where = "l.uid = " . $request->user['uid'] . " and l.type =2 and l.is_del = 0";
|
|
|
+ $totalCount = $likeBookMarkDb->alias("l")
|
|
|
+ ->field("u.uid,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
|
|
|
+ ->leftJoin("user u", "l.aid=u.uid")
|
|
|
+ ->leftJoin("info_audit a", "u.uid=a.uid")
|
|
|
+ ->where($where)
|
|
|
+ ->count();
|
|
|
+ if ($totalCount > 0) {
|
|
|
+ $data = $likeBookMarkDb->alias("l")
|
|
|
+ ->field("u.uid,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
|
|
|
+ ->leftJoin("user u", "l.aid=u.uid")
|
|
|
+ ->leftJoin("info_audit a", "u.uid=a.uid")
|
|
|
+ ->leftJoin("user_show_template ut", "ut.uid = u.uid and ut.is_default = 1")//默认模板
|
|
|
+ ->where($where)
|
|
|
+ ->order("u.uid", "desc")
|
|
|
+ ->page((int)$post['page'], (int)$post['pageSize'])
|
|
|
+ ->select()->toArray();
|
|
|
+ $infoAuditDb = new InfoAudit();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $item = [
|
|
|
+ "name" => "",
|
|
|
+ "avatar" => "",
|
|
|
+ "age" => "",
|
|
|
+ "service_project_ar" => [],
|
|
|
+ "user_work_type_title" => "",
|
|
|
+ "service_area_all" => [],
|
|
|
+ "birthday" => ""
|
|
|
+ ];
|
|
|
+ $infoData = $infoAuditDb->getItem(["status" => 1, "uid" => $v["uid"]]);
|
|
|
+ if (!empty($infoData)) {
|
|
|
+ foreach ($item as $k2 => $v2) {
|
|
|
+ $item[$k2] = $infoData[$k2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data[$k] = array_merge($v, $item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = empty($data) ? [] : $data;
|
|
|
+ return app('json')->success(["list" => $data, "pageSize" => $post['pageSize'], "page" => $post['page'], "totalCount" => $totalCount]);
|
|
|
+ }
|
|
|
/**
|
|
|
* 合约列表
|
|
|
* @param \app\Request $request
|
|
|
@@ -1552,4 +1683,6 @@ class User extends BaseController
|
|
|
$data = empty($data) ? [] : $data;
|
|
|
return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount]);
|
|
|
}
|
|
|
+// 合同到期
|
|
|
+
|
|
|
}
|