|
@@ -26,43 +26,14 @@ class Gift extends Api
|
|
* 获取礼物列表
|
|
* 获取礼物列表
|
|
*/
|
|
*/
|
|
public function getGiftList() {
|
|
public function getGiftList() {
|
|
- $type = $this->request->request("type");
|
|
|
|
|
|
|
|
- // 获取基本信息
|
|
|
|
- $where = [];
|
|
|
|
- $type != '' && $where["type"] = $type;
|
|
|
|
- $giftList = Db::name('gift')->where($where)->order("value","asc")->select();
|
|
|
|
- $giftList = list_domain_image($giftList,['image','special']);
|
|
|
|
- $this->success("获取成功!",$giftList);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取礼物类型
|
|
|
|
- */
|
|
|
|
- public function getGiftType() {
|
|
|
|
// 获取基本信息
|
|
// 获取基本信息
|
|
- $where = [];
|
|
|
|
- $where["is_show"] = 1;
|
|
|
|
- $giftList = $this->gifttypeModel->field("id,name")->where($where)->order("weight","desc")->select();
|
|
|
|
- $this->success("获取成功!",$giftList);
|
|
|
|
- }
|
|
|
|
|
|
+ $where = ['is_show'=>1];
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取我的背包礼物
|
|
|
|
- */
|
|
|
|
- public function getMyBackGift() {
|
|
|
|
- $userid = $this->auth->id;
|
|
|
|
- $page = $this->request->request('page',1); // 分页
|
|
|
|
- $pageNum = $this->request->request('pageNum',10); // 分页
|
|
|
|
- // 分页搜索构建
|
|
|
|
- $pageStart = ($page-1)*$pageNum;
|
|
|
|
- $list = \app\common\model\GiftBack::field("id,name,image,gif_image,value,sum(number) as number")
|
|
|
|
- ->where(["user_id"=>$userid,"is_use"=>0])
|
|
|
|
- ->limit($pageStart,$pageNum)
|
|
|
|
- ->order('value', 'asc')
|
|
|
|
- ->group("name")
|
|
|
|
- ->select();
|
|
|
|
- $this->success("获取成功!",$list);
|
|
|
|
|
|
+ $giftList = Db::name('gift')->where($where)->order("weigh","desc")->select();
|
|
|
|
+ $giftList = list_domain_image($giftList,['image','special']);
|
|
|
|
+ $this->success("获取成功!",$giftList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -73,10 +44,12 @@ class Gift extends Api
|
|
$user_id = $this->request->request("user_id", 0);
|
|
$user_id = $this->request->request("user_id", 0);
|
|
|
|
|
|
$userid = $user_id ? $user_id : $this->auth->id;
|
|
$userid = $user_id ? $user_id : $this->auth->id;
|
|
- $list = \app\common\model\GiftUserParty::alias('a')->join("hx_gift g", "g.id = a.gift_id", "inner")->field("gift_id,g.name,g.image,sum(number) as number")
|
|
|
|
- ->where(["user_to_id" => $userid, 'g.type' => ['<>', 6]])
|
|
|
|
- ->group("gift_id")
|
|
|
|
- ->order('g.value desc')
|
|
|
|
|
|
+
|
|
|
|
+ $list = Db::name('gift_user_typing')->alias('log')
|
|
|
|
+ ->join('gift', 'gift.id = log.gift_id', 'LEFT')->field('log.*,sum(number) as number,gift.name,gift.image,gift.special')
|
|
|
|
+ ->where(['log.user_to_id' => $userid])
|
|
|
|
+ ->group('log.gift_id')
|
|
|
|
+ ->order('gift.price desc')
|
|
->select();
|
|
->select();
|
|
$this->success("获取成功!", $list);
|
|
$this->success("获取成功!", $list);
|
|
}
|
|
}
|