作者 Cool
1 个管道 的构建 通过 耗费 1 秒

商圈信息、发布信息接口调试

... ... @@ -57,7 +57,6 @@ class Hot extends Api
* @ApiMethod (POST)
* @ApiRoute (/api/hot/store_list)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="store_id", type="integer", required=false, description="店铺id")
* @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="返回成功")
... ... @@ -103,23 +102,23 @@ class Hot extends Api
{
if($this->request->isPost()){
$page = $this->request->param('page',1,'intval');
$this->store_id = $this->request->param('store_id',0,'intval');
$house_ids = $this->user_house_model->where('user_id',$this->user_id)->column('house_id');
$query = function ($query) use ($house_ids){
if($this->store_id) {
$query->where('store_id',$this->store_id);
}
foreach ($house_ids as $k=>$v){
$w = ['house_ids'=>['like','%,'.$v.',%']];
if($k == 0) {
$query->where($w);
} else {
$query->whereOr($w);
}
}
};
// $this->store_id = $this->request->param('store_id',0,'intval');
// $house_ids = $this->user_house_model->where('user_id',$this->user_id)->column('house_id');
// $query = function ($query) use ($house_ids){
// if($this->store_id) {
// $query->where('store_id',$this->store_id);
// }
// foreach ($house_ids as $k=>$v){
// $w = ['house_ids'=>['like','%,'.$v.',%']];
// if($k == 0) {
// $query->where($w);
// } else {
// $query->whereOr($w);
// }
// }
// };
$where = [
'where' => $query,
'where' => ['house_ids'=>['like',['%'.$this->auth->house_id.'%']]],
'with' => ['store']
];
$order = ['number'=>'DESC','createtime'=>'DESC'];
... ...
... ... @@ -581,6 +581,13 @@ class Store extends Api
$param = (new StoreValidate())->goCheck('red');
}
$store = $this->get_store();
$house_ids = explode(',',substr($store['house_ids'],1,strlen($store['house_ids'])-2));
$param_ids = explode(',',$param['house_ids']);
foreach ($param_ids as $v){
if(!in_array($v,$house_ids)) {
$this->error('包含未绑定的社区,请重新选择');
}
}
if($param['type'] == 1) {
$param['single'] = $param['red_package'] / $param['number'];
$param['score'] = bcadd(config('site.send_score'),$param['red_package'] * config('site.withdraw_percent'),2);
... ...
... ... @@ -26,7 +26,7 @@ class Auth
//默认配置
protected $config = [];
protected $options = [];
protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score'];
protected $allowFields = ['id', 'nickname', 'mobile', 'avatar', 'score', 'money', 'house_id', 'id_num', 'identity'];
public function __construct($options = [])
{
... ...