pull/1/head
limu 10 months ago
parent e1834dc8a2
commit 5d3e1b4652
  1. 6
      app/api/controller/Controller.php
  2. 7
      app/api/controller/Goods.php
  3. 42
      app/api/service/Goods.php
  4. 30
      app/common/model/goods/GoodsHotWord.php
  5. 12
      app/common/model/store/Shop.php

@ -121,9 +121,9 @@ class Controller extends BaseController
if (!class_exists($item['class'])) { if (!class_exists($item['class'])) {
throwError("很抱歉,当前{$item['name']}不存在"); throwError("很抱歉,当前{$item['name']}不存在");
} }
if (!call_user_func([$item['class'], $item['method']])) { // if (!call_user_func([$item['class'], $item['method']])) {
throwError("很抱歉,当前{$item['name']}暂未开启访问"); // throwError("很抱歉,当前{$item['name']}暂未开启访问");
} // }
if (!empty($item['moduleKey']) && !StoreModuleModel::checkModuleKey($item['moduleKey'])) { if (!empty($item['moduleKey']) && !StoreModuleModel::checkModuleKey($item['moduleKey'])) {
throwError("很抱歉,当前{$item['name']}暂不支持访问"); throwError("很抱歉,当前{$item['name']}暂不支持访问");
} }

@ -243,6 +243,13 @@ class Goods extends Controller
return $this->renderSuccess($goodsList); return $this->renderSuccess($goodsList);
} }
public function hotWord(): Json
{
$service = new GoodsService;
$list = $service->hotWord($this->request->param('page'));
return $this->renderSuccess($list);
}
/** /**
* 生成商品海报 * 生成商品海报

@ -18,6 +18,7 @@ use app\api\model\GoodsSku as GoodsSkuModel;
use app\api\model\Category as CategoryModel; use app\api\model\Category as CategoryModel;
use app\api\service\User as UserService; use app\api\service\User as UserService;
use app\common\model\store\Shop as ShopModel; use app\common\model\store\Shop as ShopModel;
use app\common\model\goods\GoodsHotWord;
use app\api\service\sharp\Active as ActiveService; use app\api\service\sharp\Active as ActiveService;
use app\common\enum\Setting as SettingEnum; use app\common\enum\Setting as SettingEnum;
use app\common\service\Goods as GoodsService; use app\common\service\Goods as GoodsService;
@ -203,29 +204,38 @@ class Goods extends GoodsService
public function cityInfo($storeid): array public function cityInfo($storeid): array
{ {
$model = new ShopModel; $model = new ShopModel;
$info = $model->where([ $info = $model->with(['wechatImage'])->where([
'is_delete' => 0, 'is_delete' => 0,
'status' => 1, 'status' => 1,
'store_id' => $storeid, 'store_id' => $storeid,
'is_main' => 1, 'is_main' => 1,
])->field('shop_name,star,shop_hours,summary,phone, ])->field('shop_name,star,shop_hours,summary,phone,
province_id,city_id,region_id,shop_id,address,latitude,longitude')->find()->toArray(); province_id,city_id,region_id,shop_id,address,latitude,longitude,wechat_img_id,history1,history2,history3,remark')->find()->toArray();
//todo wmc //todo wmc
$info['remark'] = ['手机选购', '电脑选购']; $info['remark'] = json_decode($info['remark']);
$info['star'] = 5;
$info['fuwu_hours'] = 5; $info['fuwu_hours'] = 5;
$info['fuwu_num'] = 15; $info['fuwu_num'] = 15;
$info['star'] = 5; // $info['wechat'] = 'https://www.saas.njrenzhou.com/uploads/10001/20240127/12bb1b1747e652d258443247a5c4777c.png';
$info['wechat'] = 'https://www.saas.njrenzhou.com/uploads/10001/20240127/12bb1b1747e652d258443247a5c4777c.png'; $history = [];
$info['history'] = ['time' => '2022-01-01', 'contenmt' => 'yml与2000年成立']; if (!empty($info['history1'])) {
$info['evaluate'] = [ $history[] = json_decode($info['history1'], true);
'image' => 'https://www.saas.njrenzhou.com/uploads/10001/20240116/18adc22ad9ea021ab2586878fe1035b0.png', }
if (!empty($info['history2'])) {
$history[] = json_decode($info['history2'], true);
}
if (!empty($info['history3'])) {
$history[] = json_decode($info['history3'], true);
}
$info['history'] = $history;
// $info['history'] = ['time' => '2023-01-01', 'contenmt' => 'yml上市'];
$info['evaluate'][] = [
'image' => 'http://qiniu.shop.royaum.com.cn/10001/20240201/13f2e675794e25176352fc039dfb6dcb.jpg',
'nickname' => 'wmc', 'nickname' => 'wmc',
'content' => '很好', 'content' => '很好',
]; ];
$info['imageList'] = [ $info['imageList'] = [
'https://www.saas.njrenzhou.com/uploads/10001/20240116/18adc22ad9ea021ab2586878fe1035b0.png', 'http://qiniu.shop.royaum.com.cn/10001/20240201/13f2e675794e25176352fc039dfb6dcb.jpg',
'https://www.saas.njrenzhou.com/uploads/10001/20240116/18adc22ad9ea021ab2586878fe1035b0.png' 'http://qiniu.shop.royaum.com.cn/10001/20240201/13f2e675794e25176352fc039dfb6dcb.jpg'
]; ];
//读取门店停车场 //读取门店停车场
@ -238,6 +248,16 @@ class Goods extends GoodsService
return $info; return $info;
} }
public function hotWord($page): array
{
if(empty($page) || $page == 1){
$offset = 0;
}else{
$offset = $page * 5;
}
return GoodsHotWord::order('sort desc')->limit($offset,5)->select()->toArray();
}
// //抢购会场列表 // //抢购会场列表
// public function panicList() // public function panicList()
// { // {

@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\common\model\goods;
use cores\BaseModel;
use think\model\relation\HasOne;
/**
* 商品服务与承诺模型
* Class Service
*/
class GoodsHotWord extends BaseModel
{
// 定义表名
protected $name = 'goods_hot_word';
// 定义主键
protected $pk = 'id';
}

@ -46,6 +46,18 @@ class Shop extends BaseModel
->bind(['logo_url' => 'preview_url']); ->bind(['logo_url' => 'preview_url']);
} }
/**
* 关联文章封面图
* @return HasOne
*/
public function wechatImage(): HasOne
{
$module = self::getCalledModule();
return $this->hasOne("app\\{$module}\\model\\UploadFile", 'file_id', 'wechat_img_id')
->bind(['wechat' => 'preview_url']);
}
/** /**
* 获取器:省市区id集 * 获取器:省市区id集
* @param $value * @param $value

Loading…
Cancel
Save