...
|
...
|
@@ -12,6 +12,8 @@ use app\api\model\Report; |
|
|
use app\api\model\StoreApply;
|
|
|
use app\api\model\StoreComment;
|
|
|
use app\api\model\StoreInform;
|
|
|
use app\api\model\StoreInformGood;
|
|
|
use app\api\model\StoreInformView;
|
|
|
use app\api\model\StoreOrder;
|
|
|
use app\api\model\UserScoreLog;
|
|
|
use app\api\validate\StoreValidate;
|
...
|
...
|
@@ -33,22 +35,22 @@ class Store extends Api |
|
|
protected $noNeedLogin = [];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
protected $store_model;
|
|
|
protected $store_inform_model;
|
|
|
protected $industry_model;
|
|
|
protected $deposit_model;
|
|
|
protected $deposit_order_model;
|
|
|
protected $favorite_model;
|
|
|
protected $comment_model;
|
|
|
protected $good_model;
|
|
|
protected $follow_model;
|
|
|
protected $house_model;
|
|
|
protected $user_id;
|
|
|
|
|
|
public function __construct(Request $request,\app\api\model\Store $store,Industry $industry,Deposit $deposit,DepositOrder $deposit_order)
|
|
|
public function __construct(Request $request,\app\api\model\Store $store,Industry $industry,Deposit $deposit,DepositOrder $deposit_order,StoreInform $inform,\app\api\model\House $house)
|
|
|
{
|
|
|
parent::__construct($request);
|
|
|
$this->store_model = $store;
|
|
|
$this->store_inform_model = $inform;
|
|
|
$this->industry_model = $industry;
|
|
|
$this->deposit_model = $deposit;
|
|
|
$this->deposit_order_model = $deposit_order;
|
|
|
$this->store_model = $store;
|
|
|
$this->house_model = $house;
|
|
|
$this->user_id = $this->auth->id;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -526,6 +528,7 @@ class Store extends Api |
|
|
"id"://小区id
|
|
|
"name"://小区名称
|
|
|
"area"://所在区
|
|
|
"address"://地址
|
|
|
}
|
|
|
]
|
|
|
}
|
...
|
...
|
@@ -547,7 +550,7 @@ class Store extends Api |
|
|
}
|
|
|
$data = Db::name('house')
|
|
|
->where($where)
|
|
|
->field('id,name,area')
|
|
|
->field('id,name,area,address')
|
|
|
->order('createtime desc')
|
|
|
->select();
|
|
|
$this->success('success',$data);
|
...
|
...
|
@@ -637,6 +640,161 @@ class Store extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 商圈信息列表
|
|
|
* @ApiWeigh (29)
|
|
|
*
|
|
|
* @ApiTitle (商圈信息列表)
|
|
|
* @ApiSummary (商圈信息列表)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/store/store_list)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="status", type="integer", required=true, description="状态0=全部1=审核中2=已发布3=已下架")
|
|
|
* @ApiParams (name="page", type="integer", required=true, description="页数")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功',
|
|
|
"data": {
|
|
|
"list": [
|
|
|
{
|
|
|
"id": 5,
|
|
|
"user_id": 1,
|
|
|
"store_id": 1,
|
|
|
"content": "标题",
|
|
|
"images": "/assets/img/qrcode.png",
|
|
|
"house_ids": ",1,",
|
|
|
"type": 2,
|
|
|
"score": "0",
|
|
|
"red_package": "红包总金额",
|
|
|
"number": 红包数量,
|
|
|
"single": "单个红包金额",
|
|
|
"get": 已领取数量,
|
|
|
"surplus": 剩余数量,
|
|
|
"views": 0,
|
|
|
"status": 状态1=审核中2=已发布3=已下架4=审核失败,
|
|
|
"createtime": "2020-08-27 20:10:50",
|
|
|
"image_arr"图片: [
|
|
|
"http://cloud.caiyunpan.brotop.cn/assets/img/qrcode.png"
|
|
|
],
|
|
|
"store": {
|
|
|
"id": 1,
|
|
|
"store_name": "店铺名称",
|
|
|
"store_icon": "图标",
|
|
|
"industry_id": "行业标签",
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
"this_page": 当前页数,
|
|
|
"total_page": 总页数
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function store_list()
|
|
|
{
|
|
|
if($this->request->isPost()){
|
|
|
$page = $this->request->param('page',1,'intval');
|
|
|
$status = $this->request->param('status',0,'intval');
|
|
|
$store = $this->get_store();
|
|
|
$where_s = [
|
|
|
'store_id' => $store['id']
|
|
|
];
|
|
|
if($status) {
|
|
|
$where_s['status'] = $status;
|
|
|
}
|
|
|
$where = [
|
|
|
'where' => $where_s,
|
|
|
'with' => ['store']
|
|
|
];
|
|
|
$order = ['number'=>'DESC','createtime'=>'DESC'];
|
|
|
$inform = $this->store_inform_model->pageSelect($page,$where,'*',$order,config('option.num'));
|
|
|
$list = $inform->items();
|
|
|
$return = [
|
|
|
'list' => $list,
|
|
|
'this_page' => $inform->currentPage(),
|
|
|
'total_page' => $inform->lastPage()
|
|
|
];
|
|
|
$this->success('请求成功',$return);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 商圈信息详情
|
|
|
* @ApiWeigh (28)
|
|
|
*
|
|
|
* @ApiTitle (商圈信息详情)
|
|
|
* @ApiSummary (商圈信息详情)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/store/store_detail)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="inform_id", type="integer", required=true, description="商圈信息id")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功',
|
|
|
"data": {
|
|
|
"inform": {
|
|
|
"id": 1,
|
|
|
"user_id": 1,
|
|
|
"store_id": 1,
|
|
|
"content": "内容",
|
|
|
"images": "/assets/img/qrcode.png",
|
|
|
"house_ids": ",1,",
|
|
|
"type": 2,
|
|
|
"score": "0",
|
|
|
"red_package": "红包总金额",
|
|
|
"number": 红包数量,
|
|
|
"single": "单个红包金额",
|
|
|
"get": 已领取数量,
|
|
|
"surplus": 剩余数量,
|
|
|
"views": 0,
|
|
|
"status": 状态1=审核中2=已发布3=已下架4=审核失败,
|
|
|
"createtime": "2020-08-27 20:10:50",
|
|
|
"updatetime": 1598530250,
|
|
|
"image_arr"图片: [
|
|
|
"http://community.qiniu.brotop.cn/assets/img/qrcode.png"
|
|
|
],
|
|
|
"house_names": "社区名称",
|
|
|
"surplus_package": 剩余红包金额,
|
|
|
"good_count": 点赞总数,
|
|
|
"is_good": 是否点赞0=否1=是
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function store_detail()
|
|
|
{
|
|
|
if($this->request->isPost()){
|
|
|
$inform_id = $this->request->param('inform_id',0,'intval');
|
|
|
$store = $this->get_store();
|
|
|
$where_s = [
|
|
|
'id' => $inform_id
|
|
|
];
|
|
|
$where = [
|
|
|
'where' => $where_s
|
|
|
];
|
|
|
$order = ['createtime'=>'DESC'];
|
|
|
$inform = $this->store_inform_model->findOrFail($where,true,'*',$order);
|
|
|
$house_name = $this->house_model->whereIn('id',$inform['house_ids'])->column('name');
|
|
|
$inform['house_names'] = implode(',',$house_name);
|
|
|
$inform['surplus_package'] = $inform['single'] * $inform['surplus'];
|
|
|
// 获取点赞数及是否点赞
|
|
|
$good_model = new StoreInformGood();
|
|
|
$where_g = [
|
|
|
'object_id' => $inform['id']
|
|
|
];
|
|
|
$inform['good_count'] = $good_model->getCount($where_g);
|
|
|
$where_g['user_id'] = $this->user_id;
|
|
|
$inform['is_good'] = $good_model->getCount($where_g);
|
|
|
$return = [
|
|
|
'inform' => $inform,
|
|
|
];
|
|
|
$this->success('请求成功',$return);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 绑定新社区
|
|
|
* @ApiWeigh (25)
|
|
|
*
|
...
|
...
|
|