地图api

This commit is contained in:
2026-01-01 15:19:18 +08:00
parent b8a9f9b62e
commit 09f117e59c
17 changed files with 99 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ class Goods extends ApiBase{
*/
public function getGoodsList(){
$get = $this->request->get();
$goods_list = GoodsLogic::getGoodsList($this->user_id, $get, $this->page_no, $this->page_size);
$goods_list = GoodsLogic::getGoodsList($this->user_id, $get, $this->page_no, $this->page_size,$get['type']);
$this->_success('获取成功',$goods_list);
}

View File

@@ -14,7 +14,8 @@ class GoodsCategory extends ApiBase{
*/
public function lists(){
$client = $this->request->get('client',1);
$cateogry = GoodsCategoryLogic::categoryThirdTree($client);
$type = $this->request->get('type',1);
$cateogry = GoodsCategoryLogic::categoryThirdTree($client,$type);
$this->_success('获取成功',$cateogry);
}

View File

@@ -30,7 +30,12 @@ use app\common\server\Alisms;
class Index extends ApiBase
{
public $like_not_need_login = ['test','sedx','lists','appInit', 'downLine', 'share', 'config','pcLists','goods_stay_time','send_sms','get_pege'];
public function visit()
{
$this->_success('',['a'=>1]);
}
//短信宝接口
public function sedx(){
$nowtime = time();

View File

@@ -54,6 +54,9 @@ class Payment extends ApiBase
switch ($post['from']) {
case 'order':
$order = Order::get($post['order_id']);
if ($order == null) {
$this->_error('订单不存在');
}
if ($order['order_status'] == CommonOrder::STATUS_CLOSE || $order['del'] == 1) {
$this->_error('订单已关闭');
}
@@ -79,6 +82,11 @@ class Payment extends ApiBase
}
if (PaymentLogic::getReturnCode() != 0) {
/**
* 支付成功
* 添加对应商品积分
*/
$this->_success('', $result, PaymentLogic::getReturnCode());
}

View File

@@ -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();

View File

@@ -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();
//品牌筛选

View File

@@ -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);

View File

@@ -9,8 +9,9 @@ use think\facade\Config;
class CityService
{
// 腾讯地图API Key
private $tencentMapKey = 'EVOBZ-VX7YU-QKJVR-BVESA-AVFT3-7JBWG';
// private $tencentMapKey = 'EVOBZ-VX7YU-QKJVR-BVESA-AVFT3-7JBWG';
private $tencentMapKey = '66NBZ-KH3W4-7QSUS-K5OBA-7P552-F7F6T';
public function list()
{
$cacheKey = 'city_cache_keys';