配置修改

This commit is contained in:
2026-04-17 21:30:19 +08:00
parent 7813ec22b6
commit 5e5d201de5
2 changed files with 15 additions and 3 deletions

View File

@ -35,11 +35,12 @@ class Shop extends Api
{
if($this->request->isGet()) {
$shopId = $this->request->get('shop_id', '', 'trim');
$city_id = $this->request->get('city_id', 0);
$validate = Validate::rule('shop_id', 'require|integer|gt:0');
if(!$validate->check(['shop_id'=>$shopId])) {
return JsonServer::error($validate->getError());
}
$data = ShopLogic::getShopInfo($shopId, $this->user_id, input());
$data = ShopLogic::getShopInfo($city_id,$shopId, $this->user_id, input());
return JsonServer::success('获取店铺信息成功', $data);
}else{
return JsonServer::error('请求类型错误');

View File

@ -22,12 +22,22 @@ class ShopLogic extends Logic
/**
* 获取店铺信息
*/
public static function getShopInfo($shopId, $userId, $params = [])
public static function getShopInfo($city_id,$shopId, $userId, $params = [])
{
// 记录统计信息(访问商铺用户量)
Event::listen('ShopStat', 'app\common\listener\ShopStat');
event('ShopStat', $shopId);
$shop_msg = Shop::where("city_id",$city_id)
->where("is_run",1)
->where("is_freeze",0)
->where("del",0)
->find();
$c = "";
if($shop_msg == null){
$c = "id = 0";
}else{
$c = "city_id = ".$city_id."";
}
$where = [
'del' => 0,
'id' => $shopId
@ -41,6 +51,7 @@ class ShopLogic extends Logic
'run_start_time', 'run_end_time', 'weekdays',
];
$shop = Shop::field($field)
->where($c)
->where($where)
->append([ 'type_desc', 'is_expire' ])
->findOrEmpty();