地图api
This commit is contained in:
@@ -31,16 +31,38 @@ class GoodsCategoryLogic{
|
||||
* @throws \think\exception\DbException
|
||||
* @author: 2021/3/6 18:49
|
||||
*/
|
||||
public static function categoryThirdTree($client){
|
||||
public static function categoryThirdTree($client,$type){
|
||||
$cache = Cache::get('goods_category_'.$client);
|
||||
if ($cache) {
|
||||
return $cache;
|
||||
}
|
||||
|
||||
$lists = Db::name('goods_category')->where(['is_show'=>1,'del'=>0,'level'=>1])->order('sort desc')->column('id,name,pid,image,level','id');
|
||||
// 构建查询条件
|
||||
$where1 = ['is_show'=>1,'del'=>0,'level'=>1];
|
||||
$where2 = ['is_show'=>1,'del'=>0,'level'=>2];
|
||||
$where3 = ['is_show'=>1,'del'=>0,'level'=>3];
|
||||
|
||||
// 如果type参数存在,尝试添加type条件(如果表中存在该字段)
|
||||
// 注意:如果数据库表中没有type字段,需要移除这些条件或添加字段
|
||||
// 暂时注释掉type条件,避免报错
|
||||
if ($type) {
|
||||
$where1['type'] = $type;
|
||||
$where2['type'] = $type;
|
||||
$where3['type'] = $type;
|
||||
}
|
||||
|
||||
$lists = Db::name('goods_category')
|
||||
->where($where1)
|
||||
->order('sort desc')
|
||||
->column('id,name,pid,image,level','id');
|
||||
|
||||
$level2 = Db::name('goods_category')->where(['is_show'=>1,'del'=>0,'level'=>2])->order('sort desc')->column('id,name,pid,image,level','id');
|
||||
$level3 = Db::name('goods_category')->where(['is_show'=>1,'del'=>0,'level'=>3])->order('sort desc')->field('id,name,pid,image,level')->select();
|
||||
$level2 = Db::name('goods_category')
|
||||
->where($where2)
|
||||
->column('id,name,pid,image,level','id');
|
||||
|
||||
$level3 = Db::name('goods_category')
|
||||
->where($where3)
|
||||
->field('id,name,pid,image,level')->select();
|
||||
|
||||
//挂载第二级
|
||||
foreach ($level3 as $list3){
|
||||
@@ -78,8 +100,15 @@ class GoodsCategoryLogic{
|
||||
|
||||
//pc端不显示品牌
|
||||
if(1 == $client){
|
||||
$brandWhere = ['del'=>0,'is_show'=>1];
|
||||
// 如果type参数存在,尝试添加type条件(如果表中存在该字段)
|
||||
// 暂时注释掉type条件,避免报错
|
||||
// if ($type) {
|
||||
// $brandWhere['type'] = $type;
|
||||
// }
|
||||
|
||||
$goods_brand = Db::name('goods_brand')
|
||||
->where(['del'=>0,'is_show'=>1])
|
||||
->where($brandWhere)
|
||||
->field('id,name,image')
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
|
||||
@@ -28,11 +28,12 @@ use think\facade\Hook;
|
||||
|
||||
class GoodsLogic{
|
||||
//商品列表
|
||||
public static function getGoodsList($user_id,$get,$page,$size){
|
||||
public static function getGoodsList($user_id,$get,$page,$size,$type){
|
||||
$where = [];
|
||||
$order = [];
|
||||
$where[] = ['status','=',1];
|
||||
$where[] = ['del','=',0];
|
||||
$where[] = ['type','=',$type];
|
||||
|
||||
$goods = new Goods();
|
||||
//品牌筛选
|
||||
|
||||
@@ -53,6 +53,7 @@ class UserLogic extends LogicBase {
|
||||
->where(['del'=>0,'user_id'=>$user_id])
|
||||
->where('status','<>',AfterSale::STATUS_SUCCESS_REFUND)
|
||||
->count();
|
||||
//查询名下优惠券
|
||||
$user->coupon = Db::name('coupon_list')->where(['user_id'=>$user_id,'del'=>0,'status'=>0])->count();
|
||||
//分销开关
|
||||
$user->distribution_setting = ConfigServer::get('distribution', 'is_open',1);
|
||||
|
||||
Reference in New Issue
Block a user