地图api
This commit is contained in:
@@ -47,6 +47,7 @@ class GoodsCategoryLogic
|
|||||||
'level' => $level + 1,
|
'level' => $level + 1,
|
||||||
'is_recommend' => $post['pid'] == 0 ? $is_recommend : 0,
|
'is_recommend' => $post['pid'] == 0 ? $is_recommend : 0,
|
||||||
'remark' => $post['remark'],
|
'remark' => $post['remark'],
|
||||||
|
'type' => $post['type'], //1:普通分类 2:推荐分类
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
];
|
];
|
||||||
@@ -77,6 +78,7 @@ class GoodsCategoryLogic
|
|||||||
'pid' => $post['pid'],
|
'pid' => $post['pid'],
|
||||||
'is_recommend' => $post['pid'] == 0 ? $is_recommend : 0,
|
'is_recommend' => $post['pid'] == 0 ? $is_recommend : 0,
|
||||||
'remark' => $post['remark'],
|
'remark' => $post['remark'],
|
||||||
|
'type' => $post['type'], //1:普通分类 2:推荐分类
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@ class GoodsCategoryLogic
|
|||||||
$lists = Db::name('goods_category')
|
$lists = Db::name('goods_category')
|
||||||
->where(['del' => 0])
|
->where(['del' => 0])
|
||||||
->order('id asc')
|
->order('id asc')
|
||||||
->column('id,name,pid,is_recommend,is_show,level,image,sort');
|
->column('id,name,pid,is_recommend,is_show,level,image,sort,type');
|
||||||
foreach ($lists as $k => $item){
|
foreach ($lists as $k => $item){
|
||||||
$lists[$k]['image'] = UrlServer::getFileUrl($item['image']);
|
$lists[$k]['image'] = UrlServer::getFileUrl($item['image']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -481,7 +481,8 @@ class GoodsLogic
|
|||||||
'give_integral_type' => $give_integral_type,
|
'give_integral_type' => $give_integral_type,
|
||||||
'give_integral' => $give_integral,
|
'give_integral' => $give_integral,
|
||||||
'spec_type' => $post['spec_type'],
|
'spec_type' => $post['spec_type'],
|
||||||
'update_time' => $time
|
'update_time' => $time,
|
||||||
|
'type' => $post['type'],
|
||||||
];
|
];
|
||||||
|
|
||||||
Db::name('goods')
|
Db::name('goods')
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class Goods extends Validate
|
|||||||
'region_ratio' => 'lt:100',
|
'region_ratio' => 'lt:100',
|
||||||
'shareholder_ratio' => 'lt:100',
|
'shareholder_ratio' => 'lt:100',
|
||||||
'give_integral_ratio' => 'egt:0',
|
'give_integral_ratio' => 'egt:0',
|
||||||
|
'type' => 'require',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
@@ -69,6 +70,7 @@ class Goods extends Validate
|
|||||||
'region_ratio.lt' => '区域分红比例不能超过100',
|
'region_ratio.lt' => '区域分红比例不能超过100',
|
||||||
'shareholder_ratio.lt' => '股东分红比例不能超过100',
|
'shareholder_ratio.lt' => '股东分红比例不能超过100',
|
||||||
'give_integral_ratio.egt' => '赠送积分比例须大于或等于0',
|
'give_integral_ratio.egt' => '赠送积分比例须大于或等于0',
|
||||||
|
'type.require' => '请选择商品类型',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class GoodsCategory extends Validate
|
|||||||
'name' => 'require|checkName',
|
'name' => 'require|checkName',
|
||||||
'pid' => 'addPid|editPid',
|
'pid' => 'addPid|editPid',
|
||||||
'image' => 'require',
|
'image' => 'require',
|
||||||
|
'type' => 'require',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
@@ -37,6 +38,7 @@ class GoodsCategory extends Validate
|
|||||||
'name.require' => '分类名称不能为空!',
|
'name.require' => '分类名称不能为空!',
|
||||||
'name.unique' => '分类名称已存在',
|
'name.unique' => '分类名称已存在',
|
||||||
'image.require' => '请上传分类图标',
|
'image.require' => '请上传分类图标',
|
||||||
|
'type.require' => '请选择分类类型'
|
||||||
];
|
];
|
||||||
protected function sceneAdd()
|
protected function sceneAdd()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ class GoodsOneSpec extends Validate
|
|||||||
'one_stock' => 'require|integer',
|
'one_stock' => 'require|integer',
|
||||||
'one_volume' => 'egt:0',
|
'one_volume' => 'egt:0',
|
||||||
'one_weight' => 'egt:0',
|
'one_weight' => 'egt:0',
|
||||||
|
'type' => 'require',
|
||||||
|
'points' => 'egt:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
@@ -45,6 +47,8 @@ class GoodsOneSpec extends Validate
|
|||||||
'one_cost_price.egt' => '成本价必须大于或等于0.01',
|
'one_cost_price.egt' => '成本价必须大于或等于0.01',
|
||||||
'one_stock.require' => '请输入库存',
|
'one_stock.require' => '请输入库存',
|
||||||
'one_stock.integer' => '库存必须为整型',
|
'one_stock.integer' => '库存必须为整型',
|
||||||
|
'type.require' => '请选择规格类型',
|
||||||
|
'points.egt' => '积分必须为正整数',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,13 @@
|
|||||||
class="layui-input">
|
class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>商品类型:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="radio" name="type" value="1" title="服务商品" checked>
|
||||||
|
<input type="radio" name="type" value="2" title="普通商品">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">服务次数:</label>
|
<label class="layui-form-label">服务次数:</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
|||||||
@@ -45,6 +45,13 @@
|
|||||||
<input type="text" name="name" lay-verify="required" lay-verType="tips" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
<input type="text" name="name" lay-verify="required" lay-verType="tips" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>商品类型:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="radio" name="type" value="1" title="服务商品" checked>
|
||||||
|
<input type="radio" name="type" value="2" title="普通商品">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">父级分类:</label>
|
<label class="layui-form-label">父级分类:</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
|
|||||||
@@ -46,6 +46,13 @@
|
|||||||
<input type="text" name="name" value="{$info.name}" lay-verify="required" lay-verType="tips" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
<input type="text" name="name" value="{$info.name}" lay-verify="required" lay-verType="tips" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>商品类型:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="radio" name="type" value="1" title="服务商品" {if $info.type == 1} checked="checked" {/if}>
|
||||||
|
<input type="radio" name="type" value="2" title="普通商品" {if $info.type == 2} checked="checked" {/if}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">父级分类:</label>
|
<label class="layui-form-label">父级分类:</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
|
|||||||
@@ -93,6 +93,14 @@
|
|||||||
},
|
},
|
||||||
cols: [
|
cols: [
|
||||||
{field: 'name', title: '分类名称',width: 280},
|
{field: 'name', title: '分类名称',width: 280},
|
||||||
|
//类型 1服务商品 2普通商品
|
||||||
|
{field: 'type', title: '类型', width: 100, align: 'center',templet: function (d) {
|
||||||
|
if(d.type === 1){
|
||||||
|
return '服务商品';
|
||||||
|
}else{
|
||||||
|
return '普通商品';
|
||||||
|
}
|
||||||
|
}},
|
||||||
{field: '#image', title: '分类图标', width: 120,style:'height:100px;',toolbar: '#image', align: 'center'},
|
{field: '#image', title: '分类图标', width: 120,style:'height:100px;',toolbar: '#image', align: 'center'},
|
||||||
{templet: '#is_recommend', title: '首页推荐', width: 100,align: 'center'},
|
{templet: '#is_recommend', title: '首页推荐', width: 100,align: 'center'},
|
||||||
{templet: '#is_show', title: '显示', width: 100},
|
{templet: '#is_show', title: '显示', width: 100},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Goods extends ApiBase{
|
|||||||
*/
|
*/
|
||||||
public function getGoodsList(){
|
public function getGoodsList(){
|
||||||
$get = $this->request->get();
|
$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);
|
$this->_success('获取成功',$goods_list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class GoodsCategory extends ApiBase{
|
|||||||
*/
|
*/
|
||||||
public function lists(){
|
public function lists(){
|
||||||
$client = $this->request->get('client',1);
|
$client = $this->request->get('client',1);
|
||||||
$cateogry = GoodsCategoryLogic::categoryThirdTree($client);
|
$type = $this->request->get('type',1);
|
||||||
|
$cateogry = GoodsCategoryLogic::categoryThirdTree($client,$type);
|
||||||
|
|
||||||
$this->_success('获取成功',$cateogry);
|
$this->_success('获取成功',$cateogry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ 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 $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(){
|
public function sedx(){
|
||||||
$nowtime = time();
|
$nowtime = time();
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ class Payment extends ApiBase
|
|||||||
switch ($post['from']) {
|
switch ($post['from']) {
|
||||||
case 'order':
|
case 'order':
|
||||||
$order = Order::get($post['order_id']);
|
$order = Order::get($post['order_id']);
|
||||||
|
if ($order == null) {
|
||||||
|
$this->_error('订单不存在');
|
||||||
|
}
|
||||||
if ($order['order_status'] == CommonOrder::STATUS_CLOSE || $order['del'] == 1) {
|
if ($order['order_status'] == CommonOrder::STATUS_CLOSE || $order['del'] == 1) {
|
||||||
$this->_error('订单已关闭');
|
$this->_error('订单已关闭');
|
||||||
}
|
}
|
||||||
@@ -79,6 +82,11 @@ class Payment extends ApiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PaymentLogic::getReturnCode() != 0) {
|
if (PaymentLogic::getReturnCode() != 0) {
|
||||||
|
/**
|
||||||
|
* 支付成功
|
||||||
|
* 添加对应商品积分
|
||||||
|
*/
|
||||||
|
|
||||||
$this->_success('', $result, PaymentLogic::getReturnCode());
|
$this->_success('', $result, PaymentLogic::getReturnCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,38 @@ class GoodsCategoryLogic{
|
|||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
* @author: 2021/3/6 18:49
|
* @author: 2021/3/6 18:49
|
||||||
*/
|
*/
|
||||||
public static function categoryThirdTree($client){
|
public static function categoryThirdTree($client,$type){
|
||||||
$cache = Cache::get('goods_category_'.$client);
|
$cache = Cache::get('goods_category_'.$client);
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
return $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];
|
||||||
|
|
||||||
$level2 = Db::name('goods_category')->where(['is_show'=>1,'del'=>0,'level'=>2])->order('sort desc')->column('id,name,pid,image,level','id');
|
// 如果type参数存在,尝试添加type条件(如果表中存在该字段)
|
||||||
$level3 = Db::name('goods_category')->where(['is_show'=>1,'del'=>0,'level'=>3])->order('sort desc')->field('id,name,pid,image,level')->select();
|
// 注意:如果数据库表中没有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($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){
|
foreach ($level3 as $list3){
|
||||||
@@ -78,8 +100,15 @@ class GoodsCategoryLogic{
|
|||||||
|
|
||||||
//pc端不显示品牌
|
//pc端不显示品牌
|
||||||
if(1 == $client){
|
if(1 == $client){
|
||||||
|
$brandWhere = ['del'=>0,'is_show'=>1];
|
||||||
|
// 如果type参数存在,尝试添加type条件(如果表中存在该字段)
|
||||||
|
// 暂时注释掉type条件,避免报错
|
||||||
|
// if ($type) {
|
||||||
|
// $brandWhere['type'] = $type;
|
||||||
|
// }
|
||||||
|
|
||||||
$goods_brand = Db::name('goods_brand')
|
$goods_brand = Db::name('goods_brand')
|
||||||
->where(['del'=>0,'is_show'=>1])
|
->where($brandWhere)
|
||||||
->field('id,name,image')
|
->field('id,name,image')
|
||||||
->order('sort desc,id desc')
|
->order('sort desc,id desc')
|
||||||
->select();
|
->select();
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ use think\facade\Hook;
|
|||||||
|
|
||||||
class GoodsLogic{
|
class GoodsLogic{
|
||||||
//商品列表
|
//商品列表
|
||||||
public static function getGoodsList($user_id,$get,$page,$size){
|
public static function getGoodsList($user_id,$get,$page,$size,$type){
|
||||||
$where = [];
|
$where = [];
|
||||||
$order = [];
|
$order = [];
|
||||||
$where[] = ['status','=',1];
|
$where[] = ['status','=',1];
|
||||||
$where[] = ['del','=',0];
|
$where[] = ['del','=',0];
|
||||||
|
$where[] = ['type','=',$type];
|
||||||
|
|
||||||
$goods = new Goods();
|
$goods = new Goods();
|
||||||
//品牌筛选
|
//品牌筛选
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class UserLogic extends LogicBase {
|
|||||||
->where(['del'=>0,'user_id'=>$user_id])
|
->where(['del'=>0,'user_id'=>$user_id])
|
||||||
->where('status','<>',AfterSale::STATUS_SUCCESS_REFUND)
|
->where('status','<>',AfterSale::STATUS_SUCCESS_REFUND)
|
||||||
->count();
|
->count();
|
||||||
|
//查询名下优惠券
|
||||||
$user->coupon = Db::name('coupon_list')->where(['user_id'=>$user_id,'del'=>0,'status'=>0])->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);
|
$user->distribution_setting = ConfigServer::get('distribution', 'is_open',1);
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ use think\facade\Config;
|
|||||||
class CityService
|
class CityService
|
||||||
{
|
{
|
||||||
// 腾讯地图API Key
|
// 腾讯地图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()
|
public function list()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user