|
|
@@ -2,6 +2,7 @@
|
|
|
namespace app\api\logic;
|
|
|
|
|
|
|
|
|
+use app\common\model\goods\Goods;
|
|
|
use app\common\model\home_service\HomeSpecial;
|
|
|
use app\common\logic\BaseLogic;
|
|
|
use think\facade\Db;
|
|
|
@@ -18,18 +19,31 @@ class HomeSpecialLogic extends BaseLogic
|
|
|
/**
|
|
|
* @param array $where
|
|
|
* @param int $limit
|
|
|
+ * @param array $userInfo
|
|
|
* @return array
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
* @throws \think\db\exception\DbException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
*/
|
|
|
- public static function getLists(array $where, int $limit=6)
|
|
|
+ public static function getLists(array $where, int $limit, array $userInfo,$domain)
|
|
|
{
|
|
|
return HomeSpecial::where($where)
|
|
|
->field('id,cover_type,cover,title,vue_web,vue_param')
|
|
|
->order('weight desc')
|
|
|
->limit($limit)
|
|
|
->select()
|
|
|
+ ->each(function($item) use ($userInfo,$domain){
|
|
|
+ if($item->goods_id){
|
|
|
+ $item->goods = Goods::where('id',$item->goods_id)->field('goods_banners,goods_name,service_total,service_fee')->findOrEmpty();
|
|
|
+ }
|
|
|
+ if($item->vue_web=='pages/preview/videoPre' || $item->vue_web=='pages/preview/imagePre' || $item->vue_web=='pages/preview/richView'){
|
|
|
+ $item->vue_param = 'id='.$item->id;
|
|
|
+ }
|
|
|
+ if($item->vue_web=='pages/web_view/index'){
|
|
|
+ $token = !empty($userInfo['token'])?$userInfo['token']:'';
|
|
|
+ $item->vue_param = 'hrefUrl='.rawurlencode($domain.'/static/wxapp/H5/adver5/index.html?property_activity_id=14&token='.$token);
|
|
|
+ }
|
|
|
+ })
|
|
|
->toArray();
|
|
|
}
|
|
|
|