From 8b5672a2036da5df4e8867954d969d19a04745c3 Mon Sep 17 00:00:00 2001 From: lisong <377344020@qq.com> Date: Mon, 10 Jan 2022 13:07:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 16 + .gitignore | 8 + .htaccess | 7 + .travis.yml | 42 ++ application/admin/controller/ShopSetting.php | 4 + application/admin/controller/Store.php | 99 ++++ application/admin/logic/StoreLogic.php | 104 ++++ application/admin/logic/SupplierLogic.php | 4 + application/admin/model/Store.php | 13 + application/admin/validate/Store.php | 53 ++ .../admin/view/shop_setting/policy.html | 20 + application/admin/view/store/add.html | 133 +++++ application/admin/view/store/edit.html | 156 ++++++ application/admin/view/store/lists.html | 333 +++++++++++ application/admin/view/supplier/add.html | 16 + application/admin/view/supplier/edit.html | 16 + application/api/controller/Goods.php | 12 +- application/api/controller/Pc.php | 64 ++- application/api/logic/GoodsLogic.php | 187 ++++--- application/api/logic/PcLogic.php | 526 +++++++++++++----- .../temp/15ae208a2b1fd2ad0862afae3944a015.php | 18 +- .../temp/7e2548ae2adc00d9defea97ef28ba856.php | 22 +- 22 files changed, 1639 insertions(+), 214 deletions(-) create mode 100755 .example.env create mode 100755 .gitignore create mode 100755 .htaccess create mode 100755 .travis.yml create mode 100755 application/admin/controller/Store.php create mode 100755 application/admin/logic/StoreLogic.php create mode 100755 application/admin/model/Store.php create mode 100755 application/admin/validate/Store.php create mode 100755 application/admin/view/store/add.html create mode 100755 application/admin/view/store/edit.html create mode 100755 application/admin/view/store/lists.html diff --git a/.example.env b/.example.env new file mode 100755 index 00000000..d3d8c3af --- /dev/null +++ b/.example.env @@ -0,0 +1,16 @@ +[app] +app_debug = true; +app_trace = false; + +[database] +hostname = like-mysql +database = test_likeshop +username = root +password = roixxx2008fffot +hostport = 3306 + + + +[project] +env_name = +file_domain = www.likeshopv2.localhost \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 00000000..bf08196b --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/config/install.lock +/public/uploads/* +!/public/uploads/index.html +/runtime/* +!/runtime/index.html +/.env +/public/upgrade/* +!/public/upgrade/version.json \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100755 index 00000000..63509b5c --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ + + RewriteEngine on + RewriteBase / + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100755 index 00000000..36f7b6f9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +sudo: false + +language: php + +branches: + only: + - stable + +cache: + directories: + - $HOME/.composer/cache + +before_install: + - composer self-update + +install: + - composer install --no-dev --no-interaction --ignore-platform-reqs + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . + - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" + - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . + +script: + - php think unit + +deploy: + provider: releases + api_key: + secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= + file: + - ThinkPHP_Core.zip + - ThinkPHP_Full.zip + skip_cleanup: true + on: + tags: true diff --git a/application/admin/controller/ShopSetting.php b/application/admin/controller/ShopSetting.php index c89986ef..fadefaef 100755 --- a/application/admin/controller/ShopSetting.php +++ b/application/admin/controller/ShopSetting.php @@ -74,6 +74,8 @@ class ShopSetting extends AdminBase 'service' => ConfigServer::get('policy', 'service'), 'privacy' => ConfigServer::get('policy', 'privacy'), 'after_sale' => ConfigServer::get('policy', 'after_sale'), + 'payment' => ConfigServer::get('policy', 'payment'), + 'reason' => ConfigServer::get('policy', 'reason'), ]; $this->assign('config', $config); @@ -87,6 +89,8 @@ class ShopSetting extends AdminBase ConfigServer::set('policy', 'service', $post['service']); ConfigServer::set('policy', 'privacy', $post['privacy']); ConfigServer::set('policy', 'after_sale', $post['after_sale']); + ConfigServer::set('policy', 'payment', $post['payment']); + ConfigServer::set('policy', 'reason', $post['reason']); $this->_success('修改成功'); } } diff --git a/application/admin/controller/Store.php b/application/admin/controller/Store.php new file mode 100755 index 00000000..d3d56375 --- /dev/null +++ b/application/admin/controller/Store.php @@ -0,0 +1,99 @@ +request->isAjax()) { + $get = $this->request->get(); + $this->_success('', StoreLogic::lists($get)); + } + return $this->fetch(); + } + + /** + * 添加文章 + */ + public function add() + { + if ($this->request->isAjax()) { + $post = $this->request->post(); + $post['del'] = 0; + $result = $this->validate($post, 'app\admin\validate\Store.add'); + if ($result === true) { + StoreLogic::addStore($post); + $this->_success('添加成功!'); + } + $this->_error($result); + + } + return $this->fetch(); + } + + /** + * 编辑文章 + */ + public function edit($id) + { + if ($this->request->isAjax()) { + + $post = $this->request->post(); + $post['del'] = 0; + $result = $this->validate($post, 'app\admin\validate\Store.edit'); + + if ($result === true) { + StoreLogic::editStore($post); + $this->_success('编辑成功!'); + } + $this->_error($result); + + } + $article = StoreLogic::getStore($id); + $this->assign('article', $article); + return $this->fetch(); + } + + /** + * 删除文章 + */ + public function del($id) + { + if ($this->request->isAjax()) { + $result = $this->validate(['id' => $id], 'app\admin\validate\Store.del'); + if ($result === true) { + StoreLogic::delStore($id); + $this->_success('删除成功'); + } + $this->_error($result); + } + } + + + /** + * 修改状态 + */ + public function switchStatus() + { + $post = $this->request->post(); + StoreLogic::switchStatus($post); + $this->_success('修改成功'); + } + + +} \ No newline at end of file diff --git a/application/admin/logic/StoreLogic.php b/application/admin/logic/StoreLogic.php new file mode 100755 index 00000000..ad02c798 --- /dev/null +++ b/application/admin/logic/StoreLogic.php @@ -0,0 +1,104 @@ +where($where)->count(); + $list = $store->where($where)->page($get['page'], $get['limit'])->order('id desc')->select(); + foreach ($list as &$item) { + $item['image'] = UrlServer::getFileUrl($item['image']); + $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); + if ($item['is_show'] == 1) { + $item['is_show_text'] = '显示'; + } else { + $item['is_show_text'] = '隐藏'; + } + } + return ['count' => $count, 'lists' => $list]; + } + + + public static function addStore($post) + { + $store = new Store(); + + $data = [ + 'title' => $post['title'], + 'address' => $post['address'], + 'image' => $post['image'], + 'business' => $post['business'], + 'is_show' => $post['is_show'], + 'traffic' => $post['traffic'], + 'create_time' => time(), + 'contact' => $post['contact'], + ]; + return $store->save($data); + } + + public static function editStore($post) + { + $store = new Store(); + $data = [ + 'title' => $post['title'], + 'address' => $post['address'], + 'image' => $post['image'], + 'business' => $post['business'], + 'is_show' => $post['is_show'], + 'traffic' => $post['traffic'], + 'update_time' => time(), + 'contact' => $post['contact'], + ]; + return $store->save($data, ['id' => $post['id'], 'del' => 0]); + } + + public static function getStore($id) + { + $store = new Store(); + $detail = $store::get(['id' => $id, 'del' => 0]); + $detail['abs_image'] = UrlServer::getFileUrl($detail['image']); + return $detail; + } + + public static function delStore($id) + { + $store = new Store(); + + $data = [ + 'del' => time(), + 'update_time' => 1 + ]; + return $article->save($data, ['id' => $id, 'del' => 0]); + } + + public static function switchStatus($post) + { + $data = [ + 'is_show' => $post['is_show'], + 'update_time' => time(), + ]; + return Db::name('store')->where(['del' => 0, 'id' => $post['id']])->update($data); + } + +} \ No newline at end of file diff --git a/application/admin/logic/SupplierLogic.php b/application/admin/logic/SupplierLogic.php index db529557..37669eee 100755 --- a/application/admin/logic/SupplierLogic.php +++ b/application/admin/logic/SupplierLogic.php @@ -50,6 +50,8 @@ class SupplierLogic{ 'cid' => $post['cid'], 'remark' => $post['remark'], 'honor' => $post['honor'], + 'is_notice' => $post['is_notice'], + 'position' => $post['position'], 'create_time' => time(), ]; @@ -68,6 +70,8 @@ class SupplierLogic{ 'cid' => $post['cid'], 'remark' => $post['remark'], 'honor' => $post['honor'], + 'is_notice' => $post['is_notice'], + 'position' => $post['position'], 'update_time' => time(), ]; diff --git a/application/admin/model/Store.php b/application/admin/model/Store.php new file mode 100755 index 00000000..d2b40cc2 --- /dev/null +++ b/application/admin/model/Store.php @@ -0,0 +1,13 @@ + 'require', + 'title' => 'require|unique:article,title^del', + 'address' => 'require', + 'image' => 'require', + 'business' => 'require', + 'traffic' => 'require', + 'contact' => 'require', + ]; + + protected $message = [ + 'id.require' => 'id不可为空', + 'title.require' => '请输入门店名称', + 'title.unique' => '标题不能重复!', + + 'address.require' => '请输入门店地址', + 'image.require' => '请商城门店图片', + 'business.require' => '请输入门店营业时间', + 'traffic.require' => '请输入门店交通情况', + 'contact.require' => '请输入门店联系方式', + ]; + + protected function sceneAdd() + { + $this->remove('id'); + + } + + protected function sceneEdit() + { + + } + + public function sceneDel() + { + $this->only(['id']); + } +} \ No newline at end of file diff --git a/application/admin/view/shop_setting/policy.html b/application/admin/view/shop_setting/policy.html index 1346c799..e695f91d 100755 --- a/application/admin/view/shop_setting/policy.html +++ b/application/admin/view/shop_setting/policy.html @@ -25,6 +25,8 @@
  • 服务协议
  • 隐私政策
  • 售后保障
  • +
  • 选择理由
  • +
  • 支付方式
  • @@ -47,6 +49,20 @@
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    @@ -84,12 +100,16 @@ var service = likeedit.build('service'); //建立编辑器 var privacy = likeedit.build('privacy'); //建立编辑器 var after_sale = likeedit.build('after_sale'); //建立编辑器 + var payment = likeedit.build('payment'); //建立编辑器 + var reason = likeedit.build('reason'); //建立编辑器 form.verify({ content: function() { likeedit.sync(service) likeedit.sync(privacy) likeedit.sync(after_sale) + likeedit.sync(payment) + likeedit.sync(reason) } }) form.verify({ diff --git a/application/admin/view/store/add.html b/application/admin/view/store/add.html new file mode 100755 index 00000000..406e46e7 --- /dev/null +++ b/application/admin/view/store/add.html @@ -0,0 +1,133 @@ +{layout name="layout2" /} + +
    + +
    + +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    + +
    + +
    +
    + \ No newline at end of file diff --git a/application/admin/view/store/edit.html b/application/admin/view/store/edit.html new file mode 100755 index 00000000..6c80b16a --- /dev/null +++ b/application/admin/view/store/edit.html @@ -0,0 +1,156 @@ +{layout name="layout2" /} + +
    + +
    + +
    + +
    +
    +
    + +
    +
    + + + {if !empty($article.image)} + +
    + + +
    + {else} +
    + {/if} +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + + +
    +
    + +
    + +
    +
    + \ No newline at end of file diff --git a/application/admin/view/store/lists.html b/application/admin/view/store/lists.html new file mode 100755 index 00000000..7f11281d --- /dev/null +++ b/application/admin/view/store/lists.html @@ -0,0 +1,333 @@ +{layout name="layout1" /} + +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + +
    + + +
    +
    +
    + +
    +
    + +
    + +
    + + + +
    +
    +
    + + \ No newline at end of file diff --git a/application/admin/view/supplier/add.html b/application/admin/view/supplier/add.html index 3b534ecd..0615efbc 100755 --- a/application/admin/view/supplier/add.html +++ b/application/admin/view/supplier/add.html @@ -65,6 +65,22 @@
    +
    + +
    + + +
    +
    + +
    +
    +
    + +
    + +
    +
    diff --git a/application/admin/view/supplier/edit.html b/application/admin/view/supplier/edit.html index e4497a75..27d0f45f 100755 --- a/application/admin/view/supplier/edit.html +++ b/application/admin/view/supplier/edit.html @@ -73,6 +73,22 @@
    +
    + +
    + + +
    +
    + +
    +
    +
    + +
    + +
    +
    diff --git a/application/api/controller/Goods.php b/application/api/controller/Goods.php index 70116931..3d9f0d14 100755 --- a/application/api/controller/Goods.php +++ b/application/api/controller/Goods.php @@ -9,17 +9,25 @@ namespace app\api\controller; use app\api\logic\GoodsLogic; class Goods extends ApiBase{ - public $like_not_need_login = ['getgoodsdetail', 'getgoodslist','getbestlist','gethostlist','getsearchpage']; + public $like_not_need_login = ['getgoodsdetail', 'getgoodslist','getbestlist','gethostlist','getsearchpage','tjgoodslist']; /** * note 商品列表 - * create_time 2020/10/20 11:12 */ public function getGoodsList(){ $get = $this->request->get(); $goods_list = GoodsLogic::getGoodsList($this->user_id, $get, $this->page_no, $this->page_size); $this->_success('获取成功',$goods_list); + } + + /** + * note 商品列表筛选条件 + */ + public function tjGoodsList(){ + $get = $this->request->get(); + $tjgoods_list = GoodsLogic::tjGoodsList(); + $this->_success('获取成功',$tjgoods_list); } diff --git a/application/api/controller/Pc.php b/application/api/controller/Pc.php index 3c0790b4..1594d7ae 100755 --- a/application/api/controller/Pc.php +++ b/application/api/controller/Pc.php @@ -9,7 +9,27 @@ namespace app\api\controller; use app\api\logic\PcLogic; class Pc extends ApiBase{ - public $like_not_need_login = ['index','commonData','goodsList']; + public $like_not_need_login = ['index','commonData','goodsList','supplierList','supplierclassList','temaigoods','baijianclass','cangpingoods','getsupplierDetail']; + /** + * Notes: 惠藏百件分类 + * @author: kiki + */ + public function baijianclass(){ + $lists = PcLogic::baijian_goods_category(); + return $this->_success('',$lists); + } + + + /** + * Notes: 惠藏藏品接口 + * @author: kiki + */ + public function cangpingoods(){ + $lists = PcLogic::cangpingoods(); + return $this->_success('',$lists); + } + + /** * Notes: pc端首页接口 * @author: kiki @@ -19,6 +39,48 @@ class Pc extends ApiBase{ return $this->_success('',$lists); } + /** + * Notes: 获取分类专家列表 + * @author: kiki + */ + public function supplierclassList(){ + $lists = PcLogic::supplierclssList(); + return $this->_success('',$lists); + } + + /** + * Notes:获取专家列表 + * @author:kiki + */ + public function supplierList(){ + $cid = $this->request->get('category_id',''); + $list = PcLogic::supplierList($this->page_no,$this->page_size,$cid); + return $this->_success('',$list); + + } + + /** + * Notes:获取专家详情 + * @author:kiki + */ + public function getsupplierDetail(){ + $id = $this->request->get('id'); + $supplier = PcLogic::getsupplierDetail($id); + if($supplier){ + $this->_success('获取成功',$supplier); + } + $this->_error('专家不存在',[],0,0); + } + + /** + * Notes: 特卖商城接口 + * @author: kiki + */ + public function temaigoods(){ + $lists = PcLogic::temaigoods(); + return $this->_success('',$lists); + } + /** * Notes:pc广告公告数据 * @author: kiki diff --git a/application/api/logic/GoodsLogic.php b/application/api/logic/GoodsLogic.php index a6e8d750..f115b7e0 100755 --- a/application/api/logic/GoodsLogic.php +++ b/application/api/logic/GoodsLogic.php @@ -12,57 +12,126 @@ use app\common\model\TeamActivity; use app\common\model\TeamFound; use app\common\model\TeamGoodsItem; use app\common\server\ConfigServer; +use app\common\server\UrlServer; use think\Db; use think\facade\Hook; class GoodsLogic{ + + //商品列表筛选条件 + public static function tjGoodsList(){ + //容量筛选表 + $capacity_list = Db::name('screen_capacity') + ->where(['del'=>0,'is_show'=>1]) + ->order('sort desc') + ->field('id,name') + ->select(); + + //泥料筛选表 + $mud_list = Db::name('screen_mud') + ->where(['del'=>0,'is_show'=>1]) + ->order('sort desc') + ->field('id,name') + ->select(); + + //价格筛选表 + $price_list = Db::name('screen_price') + ->where(['del'=>0,'is_show'=>1]) + ->order('sort desc') + ->field('id,name') + ->select(); + + //尺寸筛选表 + $size_list = Db::name('screen_size') + ->where(['del'=>0,'is_show'=>1]) + ->order('sort desc') + ->field('id,name') + ->select(); + + //壶型筛选表 + $category_list = Db::name('goods_brand') + ->where(['del'=>0,'is_show'=>1]) + ->order('sort desc') + ->field('id,name,image') + ->select(); + foreach ($category_list as $key => $v1){ + $category_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } + $list = [ + 'capacity_list' => $capacity_list,//容量筛选表 + 'mud_list' => $mud_list,//泥料筛选表 + 'price_list' => $price_list,//价格筛选表 + 'size_list' => $size_list,//尺寸筛选表 + 'category_list' => $category_list //壶型筛选表 + ]; + return $list; + } + //商品列表 public static function getGoodsList($user_id,$get,$page,$size){ $where = []; $order = []; - $where[] = ['status','=',1]; - $where[] = ['del','=',0]; + $where[] = ['g.status','=',1]; + $where[] = ['g.del','=',0]; $goods = new Goods(); - //品牌筛选 - if(isset($get['brand_id']) && $get['brand_id']) { - $where[] = ['brand_id', '=', $get['brand_id']]; - } - //分类筛选 + //壶型筛选 if(isset($get['category_id']) && $get['category_id']){ $where[] = ['first_category_id|second_category_id|third_category_id','=',$get['category_id']]; } + //价格 + if(isset($get['price']) && $get['price']) { + $screen_price_info = Db::name('screen_price')->field('start_price,end_price')->where(['id'=>$get['price'],'del'=>0])->find(); + if($screen_price_info){ + $where[] = ['min_price','>=',strtotime($screen_price_info['start_price'])]; + $where[] = ['min_price','<=',strtotime($screen_price_info['end_price'])]; + } + } + + //容量 + if(isset($get['rongliang']) && $get['rongliang']) { + $screen_capacity_info = Db::name('screen_capacity')->field('start_capacity,end_capacity')->where(['id'=>$get['rongliang'],'del'=>0])->find(); + if($screen_capacity_info){ + $where[] = ['rongliang_name','>=',strtotime($screen_capacity_info['start_capacity'])]; + $where[] = ['rongliang_name','<=',strtotime($screen_capacity_info['end_capacity'])]; + } + } + //泥料 + if(isset($get['mud_id']) && $get['mud_id']) { + $where[] = ['mud_id', '=', $get['mud_id']]; + } + + //尺寸 + if(isset($get['size_id']) && $get['size_id']) { + $where[] = ['size_id', '=', $get['size_id']]; + } + //关键词搜索 if(isset($get['keyword']) && $get['keyword']){ - $where[] = ['name','like','%'.$get['keyword'].'%']; + $where[] = ['g.name','like','%'.$get['keyword'].'%']; if($user_id){//记录关键词 self::recordKeyWord(trim($get['keyword']),$user_id); } } - //销量排序 - if(isset($get['sales_sum']) && $get['sales_sum']){ - $order['sales_sum'] = $get['sales_sum']; - } - //价格排序 - if(isset($get['price']) && $get['price']){ - $order['min_price'] = $get['price']; - } - - $order['sort'] = 'desc'; - $order['id'] = 'desc'; - - $goods_count = $goods + $order['g.sort'] = 'desc'; + $order['g.id'] = 'desc'; + $goods_count =Db::name('goods g') ->where($where) + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') ->count(); - - $goods_list = $goods + $goods_list =Db::name('goods g') ->where($where) ->page($page,$size) ->order($order) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum,sort') - ->select(); - + ->field('g.id as goods_id,g.name as goods_name,g.code,g.image,min_price as price,rongliang_name,sm.name as mud_name,s.name as supplier_name,g.code') + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') + ->select(); + foreach ($goods_list as $key => $v1){ + $goods_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } $more = is_more($goods_count,$page,$size); //是否有下一页 $data = [ @@ -87,69 +156,33 @@ class GoodsLogic{ } //商品详情 public static function getGoodsDetail($user_id,$id){ - $goods = Goods::get(['id'=>$id,'status'=>1],['goods_image','goods_item']); - if($goods){ //点击量 $goods->click_count = $goods->click_count + 1; $goods->save(); $goods->sales_sum += $goods->virtual_sales_sum; - $goods->is_collect = 0; - $goods->member_price = 0; - $goods->append(['order_give_integral', 'commission_price']); - //检查商品是否整在参加活动,如果正在参加活动替换商品的价格为活动价 - $goods = self::checkActivity($goods); - if($user_id) { - //是否收藏 - $collect = Db::name('goods_collect')->where(['user_id'=>$user_id,'goods_id'=>$id])->find(); - $goods->is_collect= $collect ? 1 : 0; + //专家信息 + $supplier = Db::name('supplier') + ->where(['del'=>0,'id'=>$goods->supplier_id]) + ->order('create_time desc') + ->field('id,name,remark,avatar') + ->find(); + $supplier['avatar']=UrlServer::getFileUrl($supplier['avatar']); + $goods->supplier_list=$supplier; + + $goods->payment=ConfigServer::get('policy', 'payment'); + $goods->reason = ConfigServer::get('policy', 'reason'); + $goods->after_sale =ConfigServer::get('policy', 'after_sale'); - //会员折扣 - $member_discount = Db::name('user_level l') - ->join('user u', 'u.level = l.id') - ->where(['u.id' => $user_id]) - ->value('discount'); - $price_array = []; - //处理会员折扣价格 - if ($goods->is_member > 0 && $member_discount > 0) { - //会员价格 - foreach ($goods->goods_item as $item => $value){ - $goods->goods_item[$item]['member_price'] = 0; - if($member_discount){ - $member_price = round($value['price'] * $member_discount / 10,2); - $goods->goods_item[$item]['member_price'] = $member_price; - $price_array[] = $member_price; - } - } - $price_array && $goods->member_price = min($price_array); - } - //多规格,按最高的价格计算积分 - if($price_array && 2 === $goods->give_integral_type){ - $price = $price_array ? max($price_array) : $goods->max_price; - $goods->order_give_integral = intval($price * $goods->give_integral / 100); - } - } - //猜你喜欢 - $goods->Like(); //商品规格 $goods->GoodsSpec(); $goods->append(['comment'])->hidden(['Spec','GoodsSpecValue']) - ->visible(['id','name','image','video','stock','remark','content','sales_sum', - 'click_count','price','market_price','is_collect','goods_spec','goods_image', - 'goods_item','activity','member_price']); + ->visible(['id','name','code','image','stock','content', + 'price','market_price','goods_spec','goods_image', + 'goods_item','supplier_list','payment','reason','after_sale']); - //判断是否开启了拼团 - if ($goods['is_team']) { - $resTeam = self::getTeam($goods); - // 如果活动没结束,则返回拼团数据, 否则把商品是否已开团状态改为,不是开团商品 - if ($resTeam !== 100 and is_array($resTeam)) { - $goods['activity'] = $resTeam; - } else { - $goods['is_team'] = 0; - } - } // 钩子-记录足迹(浏览商品) Hook::listen('footprint', [ diff --git a/application/api/logic/PcLogic.php b/application/api/logic/PcLogic.php index a5680f65..90617a58 100755 --- a/application/api/logic/PcLogic.php +++ b/application/api/logic/PcLogic.php @@ -13,52 +13,45 @@ use app\common\server\UrlServer; use think\Db; class PcLogic{ + + /** + * Notes:惠藏百件分类 + * @return array + * @author:kiki + */ + public static function baijian_goods_category(){ + $category_list = Db::name('goods_category') + ->where(['del'=>0,'is_recommend'=>1]) + ->order('sort desc') + ->field('id,name') + ->select(); + return $category_list; + } /** * Notes:pc端首页接口 * @return array * @author:kiki */ public static function pcLists(){ - $goods = new Goods(); - - //热销榜单 - $host_list = $goods - ->where(['del'=>0,'status'=>1]) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum') - ->order('sales_sum desc,click_count desc') - ->limit(10) - ->select(); - - //新品推荐 - $new_list = $goods - ->where(['del'=>0,'status'=>1,'is_new'=>1]) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum') - ->order('id desc,sort desc') - ->limit(10) - ->select(); - - - //好物优选 - $best_list = $goods - ->where(['del'=>0,'status'=>1,'is_best'=>1]) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum') - ->order('id desc,sort desc') + //新品上架 + $new_list = Db::name('goods g') + ->where(['g.del'=>0,'g.status'=>1,'g.is_new'=>1]) + ->field('g.id as goods_id,g.name as goods_name,g.code,g.image,min_price as price,rongliang_name,sm.name as mud_name,s.name as supplier_name') + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') + ->order('g.id desc,g.sort desc') ->limit(10) ->select(); $ad_list = Db::name('ad a') ->join('ad_position ap', 'a.pid = ap.id') - ->where(['pid' =>[18,19,20,21],'a.status' => 1,'a.del' => 0,'ap.status' => 1,'ap.del' => 0]) + ->where(['pid' =>[2],'a.status' => 1,'a.del' => 0,'ap.status' => 1,'ap.del' => 0]) ->order('a.id desc') ->field('a.*') ->select(); - $host_ad = []; //热销榜单广告 - $new_ad = []; //新品推荐广告 - $best_ad = []; //好物优选广告 - $category_ad = []; //分类广告 - + $index_ad = []; //首页轮播图广告 foreach ($ad_list as $ad){ $url = $ad['link']; $is_tab = 0; @@ -77,9 +70,9 @@ class PcLogic{ ]; break; } - //首页热销榜单广告 - if(empty($host_ad) && 18 == $ad['pid']){ - $host_ad = [ + //首页轮播图广告 + if(empty($index_ad) && 2 == $ad['pid']){ + $index_ad = [ 'image' => UrlServer::getFileUrl($ad['image']), 'link' => $url, 'link_type' => $ad['link_type'], @@ -87,85 +80,147 @@ class PcLogic{ 'is_tab' => $is_tab, ]; } - //首页新品推荐广告 - if(empty($new_ad) && 19 == $ad['pid']){ - $new_ad = [ - 'image' => UrlServer::getFileUrl($ad['image']), - 'link' => $url, - 'link_type' => $ad['link_type'], - 'params' => $params, - 'is_tab' => $is_tab, - ]; - } - //首页好物优选广告 - if(empty($best_ad) && 20 == $ad['pid']){ - $best_ad = [ - 'image' => UrlServer::getFileUrl($ad['image']), - 'link' => $url, - 'link_type' => $ad['link_type'], - 'params' => $params, - 'is_tab' => $is_tab, - ]; - } - //首页分类广告 - if(21 == $ad['pid']){ - - $category_ad[$ad['category_id']] = [ - 'image' => UrlServer::getFileUrl($ad['image']), - 'link' => $url, - 'link_type' => $ad['link_type'], - 'params' => $params, - 'is_tab' => $is_tab, - ]; - } - } - //分类信息 - $goods_category = new \app\admin\model\GoodsCategory(); - $goods_category_list = $goods_category - ->where(['del'=>0, 'level'=>1,'is_recommend'=>1]) - ->with(['sons']) - ->field('id,name') + //紫砂资讯 + $article = Db::name('article') + ->where(['del'=>0,'is_notice'=>1,'is_show'=>1]) + ->order('create_time desc') + ->field('id,title,synopsis,image,create_time') + ->limit(4) ->select(); + foreach ($article as $key => $v1){ + $article[$key]['image']=UrlServer::getFileUrl($v1['image']); + $article[$key]['create_time'] = date('Y-m-d', $v1['create_time']); + } - $category_list = []; - foreach ($goods_category_list as $key => $goods_category){ - $sons = []; - $goods_list = $goods - ->where(['first_category_id'=>$goods_category['id'],'del'=>0,'status'=>1]) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum') - ->limit(8) - ->select(); - foreach ($goods_category['sons'] as $son){ - $sons[] = [ - 'id' => $son['id'], - 'name' => $son['name'], - ]; - } - $ad = $category_ad[$goods_category['id']] ?? []; - $category_list[] = [ - 'id' => $goods_category['id'], - 'name' => $goods_category['name'], - 'ad' => $ad, - 'sons' => $sons, - 'goods_list'=> $goods_list, - ]; + //专家信息 + $supplier = Db::name('supplier') + ->where(['del'=>0,'is_notice'=>1]) + ->order('create_time desc') + ->field('id,name,remark,avatar') + ->limit(6) + ->select(); + foreach ($supplier as $key => $v2){ + $supplier[$key]['avatar']=UrlServer::getFileUrl($v2['avatar']); + } + + //门店信息 + $store = Db::name('store') + ->where(['del'=>0,'is_show'=>1]) + ->order('create_time desc') + ->field('id,title,address,image,business,traffic,contact') + ->limit(4) + ->select(); + foreach ($store as $key => $v2){ + $store[$key]['image']=UrlServer::getFileUrl($v1['image']); } $list = [ - 'host_ad' => $host_ad, - 'host_list' => $host_list, - 'new_ad' => $new_ad, - 'new_list' => $new_list, - 'best_ad' => $best_ad, - 'best_list' => $best_list, - 'category_list' => $category_list, + 'new_list' => $new_list, + 'index_ad' => $index_ad, + 'article' => $article, + 'supplier' => $supplier, + 'store' => $store ]; - return $list; } + + //专家信息 + public static function supplierclssList(){ + $supplier_category = new \app\admin\model\SupplierCategory(); + $supplier_category_list = $supplier_category + ->where(['del'=>0, 'is_show'=>1]) + ->field('id,name') + ->select(); + $category_list = []; + foreach ($supplier_category_list as $key => $supplier_category){ + $supplier_list = Db::name('supplier') + ->where(['cid'=>$supplier_category['id'],'del'=>0]) + ->field('id,name') + ->select(); + if(!$supplier_list){ + continue; + } + $category_list[] = [ + 'id' => $supplier_category['id'], + 'name' => $supplier_category['name'], + 'supplier_list'=> $supplier_list, + ]; + } + return $category_list; + } + + + /** + * Notes:获取专家列表 + * @param $page int 页码 + * @param $size int 每页数量 + * @param $cid int 分类id + * @return array + * @author: kiki + */ + public static function supplierList($page,$size,$cid){ + + $where[] = ['del','=',0]; + //按商品分类搜索 + if($cid){ + $where[] = ['cid','=',$cid]; + } + $count =Db::name('supplier') + ->field('id,name,remark,avatar') + ->where($where) + ->count(); + + $list =Db::name('supplier') + ->order('create_time desc') + ->field('id,name,remark,avatar') + ->where($where) + ->page($page, $size) + ->select(); + $more = is_more($count, $page, $size); //是否有下一页 + return [ + 'list' => $list, + 'page' => $page, + 'size' => $size, + 'count' => $count, + 'more' => $more + ]; + } + + + /** + * Notes:获取专家详情 + * @param $cid int 专家id + * @return array + * @author: kiki + */ + public static function getsupplierDetail($id){ + + $where[] = ['del','=',0]; + $where[] = ['id','=',$id]; + $info =Db::name('supplier') + ->order('create_time desc') + ->field('id,name,remark,avatar,honor,position') + ->where($where) + ->find(); + + $goods_list=Db::name('goods g') + ->where(['g.del'=>0,'g.status'=>1,'g.supplier_id'=>$info['id']]) + ->field('g.id as goods_id,g.name as goods_name,g.code,g.image,min_price as price,rongliang_name,sm.name as mud_name,s.name as supplier_name') + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') + ->order('g.id desc,g.sort desc') + ->select(); + return [ + 'info' => $info, + 'goods_list' => $goods_list, + ]; + } + + + /** * Notes:pc端获取公共数据 * @param $user_id int 用户id @@ -173,31 +228,220 @@ class PcLogic{ * @author: kiki */ public static function commonData($user_id){ - $article = Db::name('article') - ->where(['del'=>0,'is_notice'=>1,'is_show'=>1]) - ->order('create_time desc') - ->field('id,title') - ->limit(3) - ->select(); - $cart_num = 0; - $coupon_num = 0; $nickname = ''; if($user_id){ - $cart_num = Db::name('cart')->where(['user_id'=>$user_id])->sum('goods_num'); - $coupon_num = Db::name('coupon_list')->where(['user_id'=>$user_id,'del'=>0,'status'=>0])->count(); $nickname = Db::name('user')->where(['id'=>$user_id])->value('nickname'); } + $help_category_list = DB::name('help_category') + ->where('is_show', 1) + ->where(['del' => 0]) + ->field('id,name') + ->select(); + $h_category_list = []; + foreach ($help_category_list as $key => $help_category){ + $help_list = Db::name('help') + ->where(['cid'=>$help_category['id'],'del'=>0]) + ->field('id,title') + ->select(); + $h_category_list[] = [ + 'id' => $help_category['id'], + 'name' => $help_category['name'], + 'help_list'=> $help_list, + ]; + } + return [ + 'logo' => UrlServer::getFileUrl(ConfigServer::get('website', 'pc_logo')), + 'name' => ConfigServer::get('website', 'name',''), + 'nickname' => $nickname, + 'kfphone' => ConfigServer::get('service','phone',''), + 'kf_qr_code' => UrlServer::getFileUrl(ConfigServer::get('service','image','')), + 'oa_qr_code' => UrlServer::getFileUrl(ConfigServer::get('oa', 'qr_code', '')), + 'h_category_list'=>$h_category_list, + ]; + } + + /** + * Notes:惠藏藏品列表 + * @author: kiki + */ + public static function cangpingoods(){ + + $ad_list = Db::name('ad a') + ->join('ad_position ap', 'a.pid = ap.id') + ->where(['pid' =>[24],'a.status' => 1,'a.del' => 0,'ap.status' => 1,'ap.del' => 0]) + ->order('a.id desc') + ->field('a.*') + ->select(); + + + $ad = []; //广告 + foreach ($ad_list as $ad){ + $url = $ad['link']; + $is_tab = 0; + $params = []; + switch ($ad['link_type']) { + case 1: + $page = Ad::getLinkPage($ad['client'], $ad['link']); + $url = $page['path']; + $is_tab = $page['is_tab'] ?? 0; + break; + case 2: + $goods_path = Ad::getGoodsPath($ad['client']); + $url = $goods_path; + $params = [ + 'id' => $ad['link'], + ]; + break; + } + //广告 + if(empty($tiemai_tup_ad) && 24 == $ad['pid']){ + $tiemai_tup_ad = [ + 'image' => UrlServer::getFileUrl($ad['image']), + 'link' => $url, + 'link_type' => $ad['link_type'], + 'params' => $params, + 'is_tab' => $is_tab, + ]; + } + } + + + $where[] = ['g.del','=',0]; + $where[] = ['g.status','=',1]; + //藏品捡宝 + $where1[] = ['is_jiantreasure','=',1]; + //镇店藏品 + $where2[] = ['is_zdtreasure','=',1]; + + $jiantreasure_list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.image,remark') + ->where($where) + ->where($where1) + ->page(0,7) + ->select(); + foreach ($jiantreasure_list as $key => $v1){ + $jiantreasure_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } + + $zdtreasure_list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.image,remark') + ->where($where) + ->where($where2) + ->page(0,7) + ->select(); + foreach ($zdtreasure_list as $key => $v1){ + $zdtreasure_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } + return [ + 'ad' => $tiemai_tup_ad,//广告 + 'jiantreasure_list' => $jiantreasure_list,//藏品捡宝 + 'zdtreasure_list' => $zdtreasure_list,//镇店藏品 + ]; + } + + /** + * Notes:特卖商品列表 + * @author: kiki + */ + public static function temaigoods(){ + + $ad_list = Db::name('ad a') + ->join('ad_position ap', 'a.pid = ap.id') + ->where(['pid' =>[16,21],'a.status' => 1,'a.del' => 0,'ap.status' => 1,'ap.del' => 0]) + ->order('a.id desc') + ->field('a.*') + ->select(); + + $tiemai_tup_ad = []; //特卖大图广告 + $tiemai_bott_ad = []; //特卖小图广告 + foreach ($ad_list as $ad){ + $url = $ad['link']; + $is_tab = 0; + $params = []; + switch ($ad['link_type']) { + case 1: + $page = Ad::getLinkPage($ad['client'], $ad['link']); + $url = $page['path']; + $is_tab = $page['is_tab'] ?? 0; + break; + case 2: + $goods_path = Ad::getGoodsPath($ad['client']); + $url = $goods_path; + $params = [ + 'id' => $ad['link'], + ]; + break; + } + //特卖大图广告 + if(empty($tiemai_tup_ad) && 21 == $ad['pid']){ + $tiemai_tup_ad = [ + 'image' => UrlServer::getFileUrl($ad['image']), + 'link' => $url, + 'link_type' => $ad['link_type'], + 'params' => $params, + 'is_tab' => $is_tab, + ]; + } + //特卖小图广告 + if(16 == $ad['pid']){ + $tiemai_bott_ad[] = [ + 'image' => UrlServer::getFileUrl($ad['image']), + 'link' => $url, + 'link_type' => $ad['link_type'], + 'params' => $params, + 'is_tab' => $is_tab, + ]; + } + } + + + $where[] = ['g.del','=',0]; + $where[] = ['g.status','=',1]; + //新品上架 + $where1[] = ['is_new','=',1]; + //精品推荐 + $where2[] = ['is_best','=',1]; + //今日促销 + $where3[] = ['is_like','=',1]; + + $xinpin_list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.code,g.image,min_price as price,rongliang_name,s.name as supplier_name') + ->join('supplier s', 'g.supplier_id = s.id') + ->where($where) + ->where($where1) + ->page(0,7) + ->select(); + foreach ($xinpin_list as $key => $v1){ + $xinpin_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } + + $jingpin_list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.image,min_price as price') + ->where($where) + ->where($where2) + ->page(0,6) + ->select(); + foreach ($jingpin_list as $key => $v1){ + $jingpin_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } + + $cuxiao_list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.image,min_price as price') + ->where($where) + ->where($where3) + ->page(0,6) + ->select(); + foreach ($cuxiao_list as $key => $v1){ + $cuxiao_list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } return [ - 'article' => $article, - 'logo' => UrlServer::getFileUrl(ConfigServer::get('website', 'pc_logo')), - 'name' => ConfigServer::get('website', 'name',''), - 'cart_num' => $cart_num, - 'coupon_num' => $coupon_num, - 'nickname' => $nickname, - 'oa_qr_code' => UrlServer::getFileUrl(ConfigServer::get('oa', 'qr_code', '')), - 'mnp_qr_code' => UrlServer::getFileUrl(ConfigServer::get('mnp', 'qr_code', '')), + 'da_ad' => $tiemai_tup_ad,//大图 + 'xiao_ad' => $tiemai_bott_ad,//4小图 + 'xinpin_list' => $xinpin_list,//新品 + 'jingpin_list' => $jingpin_list,//精品 + 'cuxiao_list' => $cuxiao_list//促销 ]; } @@ -215,11 +459,11 @@ class PcLogic{ */ public static function goodsList($page,$size,$name,$category_id,$type,$sort_type,$sort){ - $where[] = ['del','=',0]; - $where[] = ['status','=',1]; + $where[] = ['g.del','=',0]; + $where[] = ['g.status','=',1]; //按商品名称搜索 if($name){ - $where[] = ['name','like','%'.$name.'%']; + $where[] = ['g.name','like','%'.$name.'%']; } //按商品分类搜索 @@ -230,11 +474,25 @@ class PcLogic{ if(1 != $type){ switch ($type){ case 2: + //新品上架 $where[] = ['is_new','=',1]; break; case 3: + //精品推荐 $where[] = ['is_best','=',1]; break; + case 4: + //今日促销 + $where[] = ['is_like','=',1]; + break; + case 5: + //藏品捡宝 + $where[] = ['is_jiantreasure','=',1]; + break; + case 6: + //镇店藏品 + $where[] = ['is_zdtreasure','=',1]; + break; } } //按排序条件显示 @@ -242,20 +500,24 @@ class PcLogic{ if($sort_type && $sort){ $order = [$sort_type=>$sort]; } - $goods = new Goods(); - - $count = $goods + $count =Db::name('goods g') + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') ->where($where) ->count(); - $list = $goods - ->where($where) - ->field('id,name,image,min_price as price,market_price,sales_sum+virtual_sales_sum as sales_sum') - ->order($order) - ->page($page, $size) - ->select(); - + $list =Db::name('goods g') + ->field('g.id as goods_id,g.name as goods_name,g.code,g.image,min_price as price,rongliang_name,sm.name as mud_name,s.name as supplier_name') + ->join('screen_mud sm', 'g.mud_id = sm.id') + ->join('supplier s', 'g.supplier_id = s.id') + ->where($where) + ->order($order) + ->page($page, $size) + ->select(); + foreach ($list as $key => $v1){ + $list[$key]['image']=UrlServer::getFileUrl($v1['image']); + } $more = is_more($count, $page, $size); //是否有下一页 return [ diff --git a/runtime/temp/15ae208a2b1fd2ad0862afae3944a015.php b/runtime/temp/15ae208a2b1fd2ad0862afae3944a015.php index 3129076b..a1f3f51a 100644 --- a/runtime/temp/15ae208a2b1fd2ad0862afae3944a015.php +++ b/runtime/temp/15ae208a2b1fd2ad0862afae3944a015.php @@ -1,4 +1,4 @@ - + @@ -89,6 +89,22 @@
    +
    + +
    + checked> + checked> +
    +
    + +
    +
    +
    + +
    + +
    +
    diff --git a/runtime/temp/7e2548ae2adc00d9defea97ef28ba856.php b/runtime/temp/7e2548ae2adc00d9defea97ef28ba856.php index 76703f92..9fceaacb 100644 --- a/runtime/temp/7e2548ae2adc00d9defea97ef28ba856.php +++ b/runtime/temp/7e2548ae2adc00d9defea97ef28ba856.php @@ -1,4 +1,4 @@ - + @@ -43,6 +43,8 @@
  • 服务协议
  • 隐私政策
  • 售后保障
  • +
  • 选择理由
  • +
  • 支付方式
  • @@ -65,6 +67,20 @@
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    @@ -102,12 +118,16 @@ var service = likeedit.build('service'); //建立编辑器 var privacy = likeedit.build('privacy'); //建立编辑器 var after_sale = likeedit.build('after_sale'); //建立编辑器 + var payment = likeedit.build('payment'); //建立编辑器 + var reason = likeedit.build('reason'); //建立编辑器 form.verify({ content: function() { likeedit.sync(service) likeedit.sync(privacy) likeedit.sync(after_sale) + likeedit.sync(payment) + likeedit.sync(reason) } }) form.verify({