From 83667b137c5e1cf3c0b62c77ee445d8d5dc6314b Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Fri, 28 Dec 2018 02:18:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Answer.php | 92 +++++++++ application/api/controller/Buy.php | 100 ++++++++++ application/api/controller/Cart.php | 92 +++++++++ application/api/controller/Goods.php | 16 ++ application/api/controller/Message.php | 76 ++++++++ application/api/controller/Order.php | 179 ++++++++++++++++++ application/api/controller/OrderNotify.php | 45 +++++ application/api/controller/Region.php | 47 +++++ application/api/controller/Search.php | 57 ++++++ application/api/controller/User.php | 2 +- application/api/controller/UserAddress.php | 111 +++++++++++ .../api/controller/UserGoodsBrowse.php | 90 +++++++++ application/api/controller/UserGoodsFavor.php | 89 +++++++++ application/api/controller/UserIntegral.php | 75 ++++++++ .../index/view/default/search/index.html | 2 +- application/service/AnswerService.php | 56 +++++- application/service/SearchService.php | 6 +- application/service/UserService.php | 20 +- public/appmini/old/alipay/app.js | 2 +- public/appmini/old/alipay/app.json | 4 +- public/appmini/old/alipay/pages/buy/buy.axml | 4 +- public/appmini/old/alipay/pages/buy/buy.js | 4 +- .../appmini/old/alipay/pages/cart/cart.acss | 3 +- .../appmini/old/alipay/pages/cart/cart.axml | 4 +- .../pages/goods-category/goods-category.js | 2 +- .../pages/goods-detail/goods-detail.acss | 4 +- .../alipay/pages/goods-detail/goods-detail.js | 52 +++-- .../alipay/pages/goods-search/goods-search.js | 4 +- .../user-address-save/user-address-save.js | 10 +- .../alipay/pages/user-address/user-address.js | 6 +- .../user-order-detail/user-order-detail.acss | 1 + .../user-order-detail/user-order-detail.axml | 6 +- .../user-order-detail/user-order-detail.js | 2 +- .../alipay/pages/user-order/user-order.axml | 6 +- .../old/alipay/pages/user-order/user-order.js | 8 +- 35 files changed, 1205 insertions(+), 72 deletions(-) create mode 100755 application/api/controller/Answer.php create mode 100644 application/api/controller/Buy.php create mode 100644 application/api/controller/Cart.php create mode 100755 application/api/controller/Message.php create mode 100644 application/api/controller/Order.php create mode 100755 application/api/controller/OrderNotify.php create mode 100644 application/api/controller/Region.php create mode 100644 application/api/controller/Search.php create mode 100644 application/api/controller/UserAddress.php create mode 100755 application/api/controller/UserGoodsBrowse.php create mode 100755 application/api/controller/UserGoodsFavor.php create mode 100755 application/api/controller/UserIntegral.php diff --git a/application/api/controller/Answer.php b/application/api/controller/Answer.php new file mode 100755 index 000000000..62e0dcb7c --- /dev/null +++ b/application/api/controller/Answer.php @@ -0,0 +1,92 @@ +Is_Login(); + + // 参数 + $params = input(); + $params['user'] = $this->user; + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = AnswerService::AnswerListWhere($params); + + // 获取总数 + $total = AnswerService::AnswerTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'm' => $start, + 'n' => $number, + 'where' => $where, + ); + $data = AnswerService::AnswerList($data_params); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + ]; + return json(DataReturn('success', 0, $result)); + } + + /** + * 用户留言添加 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-17 + * @desc description + */ + public function Add() + { + // 登录校验 + $this->Is_Login(); + + $params = $this->data_post; + $params['user'] = $this->user; + $ret = AnswerService::Add($params); + return json($ret); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Buy.php b/application/api/controller/Buy.php new file mode 100644 index 000000000..e80182333 --- /dev/null +++ b/application/api/controller/Buy.php @@ -0,0 +1,100 @@ +Is_Login(); + } + + /** + * [Index 首页] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-22T16:50:32+0800 + */ + public function Index() + { + // 获取商品列表 + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BuyService::BuyTypeGoodsList($params); + + // 商品校验 + if(isset($ret['code']) && $ret['code'] == 0) + { + // 用户默认地址 + $address = UserService::UserDefaultAddress(['user'=>$this->user]); + + // 商品/基础信息 + $base = [ + 'total_price' => empty($ret['data']) ? 0 : array_sum(array_column($ret['data'], 'total_price')), + 'total_stock' => empty($ret['data']) ? 0 : array_sum(array_column($ret['data'], 'stock')), + 'address' => empty($address['data']) ? null : $address['data'], + ]; + + // 支付方式 + $payment_list = PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]); + + // 扩展展示数据 + $extension_list = [ + // ['name'=>'感恩节9折', 'tips'=>'-¥23元'], + // ['name'=>'运费', 'tips'=>'+¥10元'], + ]; + + // 数据返回组装 + $result = [ + 'goods_list' => $ret['data'], + 'payment_list' => $payment_list, + 'base' => $base, + 'extension_list' => $extension_list, + 'common_order_is_booking' => (int) MyC('common_order_is_booking', 0), + ]; + return json(DataReturn('success', 0, $result)); + } else { + return json($ret); + } + } + + /** + * 订单添加 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-25 + * @desc description + */ + public function Add() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BuyService::OrderAdd($params); + return json($ret); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Cart.php b/application/api/controller/Cart.php new file mode 100644 index 000000000..9a6e9249e --- /dev/null +++ b/application/api/controller/Cart.php @@ -0,0 +1,92 @@ +Is_Login(); + } + + /** + * [Index 首页] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-22T16:50:32+0800 + */ + public function Index() + { + $ret = BuyService::CartList(['user'=>$this->user]); + return json($ret); + } + + /** + * 购物车保存 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-13 + * @desc description + */ + public function Save() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BuyService::CartAdd($params); + return json($ret); + } + + /** + * 购物车删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-14 + * @desc description + */ + public function Delete() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BuyService::CartDelete($params); + return json($ret); + } + + /** + * 数量保存 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-14 + * @desc description + */ + public function Stock() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BuyService::CartStock($params); + return json($ret); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Goods.php b/application/api/controller/Goods.php index 206f789b6..33179cd38 100644 --- a/application/api/controller/Goods.php +++ b/application/api/controller/Goods.php @@ -128,5 +128,21 @@ class Goods extends Common $ret = GoodsService::GoodsSpecDetail($params); return json($ret); } + + /** + * 商品分类 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-12-14 + * @desc description + */ + public function Category() + { + // 开始处理 + $params = $this->data_post; + $data = GoodsService::GoodsCategory($params); + return json(DataReturn('success', 0, $data)); + } } ?> \ No newline at end of file diff --git a/application/api/controller/Message.php b/application/api/controller/Message.php new file mode 100755 index 000000000..7ba7d4208 --- /dev/null +++ b/application/api/controller/Message.php @@ -0,0 +1,76 @@ +Is_Login(); + } + + /** + * [Index 获取记录] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-04-08T15:08:01+0800 + */ + public function Index() + { + // 参数 + $params = $this->data_post; + $params['user'] = $this->user; + + // 消息更新未已读 + MessageService::MessageRead($params); + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = MessageService::MessageListWhere($params); + + // 获取总数 + $total = MessageService::MessageTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'limit_start' => $start, + 'limit_number' => $number, + 'where' => $where, + ); + $data = MessageService::MessageList($data_params); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + ]; + return json(DataReturn('success', 0, $result)); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Order.php b/application/api/controller/Order.php new file mode 100644 index 000000000..6e721b7e0 --- /dev/null +++ b/application/api/controller/Order.php @@ -0,0 +1,179 @@ +Is_Login(); + } + + /** + * [Index 获取订单列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-22T16:50:32+0800 + */ + public function Index() + { + // 参数 + $params = $this->data_post; + $params['user'] = $this->user; + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = OrderService::OrderListWhere($params); + + // 获取总数 + $total = OrderService::OrderTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'limit_start' => $start, + 'limit_number' => $number, + 'where' => $where, + ); + $data = OrderService::OrderList($data_params); + + // 支付方式 + $payment_list = PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + 'payment_list' => $payment_list, + ]; + return json(DataReturn('success', 0, $result)); + } + + /** + * [Detail 获取详情] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-05-21T10:18:27+0800 + */ + public function Detail() + { + // 参数 + $params = $this->data_post; + $params['user'] = $this->user; + + // 条件 + $where = OrderService::OrderListWhere($params); + + // 获取列表 + $data_params = array( + 'limit_start' => 0, + 'limit_number' => 1, + 'where' => $where, + ); + $data = OrderService::OrderList($data_params); + if(!empty($data['data'][0])) + { + return json(DataReturn('success', 0, $data['data'][0])); + } + return json(DataReturn('数据不存在或已删除', -100)); + } + + /** + * 订单支付 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-28 + * @desc description + */ + public function Pay() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = OrderService::Pay($params); + return json($ret); + } + + + /** + * [Cancel 订单取消] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-05-21T10:48:48+0800 + */ + public function Cancel() + { + $params = $this->data_post; + $params['user_id'] = $this->user['id']; + $params['creator'] = $this->user['id']; + $params['creator_name'] = $this->user['user_name_view']; + $ret = OrderService::OrderCancel($params); + return json($ret); + } + + /** + * [Collect 订单收货] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-05-21T10:48:48+0800 + */ + public function Collect() + { + $params = $this->data_post; + $params['user_id'] = $this->user['id']; + $params['creator'] = $this->user['id']; + $params['creator_name'] = $this->user['user_name_view']; + $ret = OrderService::OrderCollect($params); + return json($ret); + } + + /** + * 订单删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-30 + * @desc description + */ + public function Delete() + { + $params = $this->data_post; + $params['user_id'] = $this->user['id']; + $params['creator'] = $this->user['id']; + $params['creator_name'] = $this->user['user_name_view']; + $params['user_type'] = 'user'; + $ret = OrderService::OrderDelete($params); + return json($ret); + } + +} +?> \ No newline at end of file diff --git a/application/api/controller/OrderNotify.php b/application/api/controller/OrderNotify.php new file mode 100755 index 000000000..a21270228 --- /dev/null +++ b/application/api/controller/OrderNotify.php @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/application/api/controller/Region.php b/application/api/controller/Region.php new file mode 100644 index 000000000..ed36fde14 --- /dev/null +++ b/application/api/controller/Region.php @@ -0,0 +1,47 @@ + [ + 'pid' => isset($this->data_post['pid']) ? intval($this->data_post['pid']) : 0, + ], + ]; + $data = RegionService::RegionNode($params); + return json(DataReturn('success', 0, $data)); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Search.php b/application/api/controller/Search.php new file mode 100644 index 000000000..e8e52391f --- /dev/null +++ b/application/api/controller/Search.php @@ -0,0 +1,57 @@ +data_post['user_id'] = isset($this->user['id']) ? $this->user['id'] : 0; + SearchService::SearchAdd($this->data_post); + + // 获取数据 + $result = SearchService::GoodsList($this->data_post); + + // 分类 + if(!empty($this->data_post['category_id'])) + { + $result['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]); + } else { + $result['category'] = []; + } + + return json(DataReturn('success', 0, $result)); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 37d144780..595a92127 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -7,7 +7,7 @@ use app\service\GoodsService; use app\service\MessageService; /** - * 首页 + * 用户 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/application/api/controller/UserAddress.php b/application/api/controller/UserAddress.php new file mode 100644 index 000000000..d6e5159fa --- /dev/null +++ b/application/api/controller/UserAddress.php @@ -0,0 +1,111 @@ +Is_Login(); + } + + /** + * 获取用户地址详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-18 + * @desc description + */ + public function Detail() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = UserService::UserAddressRow($params); + return json($ret); + } + + /** + * 获取用户地址列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-18 + * @desc description + */ + public function Index() + { + $ret = UserService::UserAddressList(['user'=>$this->user]); + return json($ret); + + } + + /** + * 用户地址保存 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-18 + * @desc description + */ + public function Save() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = UserService::UserAddressSave($params); + return json($ret); + } + + /** + * 删除地址 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-18 + * @desc description + */ + public function Delete() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = UserService::UserAddressDelete($params); + return json($ret); + } + + /** + * 默认地址设置 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-18 + * @desc description + */ + public function SetDefault() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = UserService::UserAddressDefault($params); + return json($ret); + } + +} +?> \ No newline at end of file diff --git a/application/api/controller/UserGoodsBrowse.php b/application/api/controller/UserGoodsBrowse.php new file mode 100755 index 000000000..eb9f4b256 --- /dev/null +++ b/application/api/controller/UserGoodsBrowse.php @@ -0,0 +1,90 @@ +Is_Login(); + } + + /** + * 商品浏览列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-10-09 + * @desc description + */ + public function Index() + { + // 参数 + $params = $this->data_post; + $params['user'] = $this->user; + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = GoodsService::UserGoodsBrowseListWhere($params); + + // 获取总数 + $total = GoodsService::GoodsBrowseTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'limit_start' => $start, + 'limit_number' => $number, + 'where' => $where, + ); + $data = GoodsService::GoodsBrowseList($data_params); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + ]; + return json(DataReturn('success', 0, $result)); + } + + /** + * 商品浏览删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-14 + * @desc description + */ + public function Delete() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = GoodsService::GoodsBrowseDelete($params); + return json($ret); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/UserGoodsFavor.php b/application/api/controller/UserGoodsFavor.php new file mode 100755 index 000000000..b3e94ff2b --- /dev/null +++ b/application/api/controller/UserGoodsFavor.php @@ -0,0 +1,89 @@ +Is_Login(); + } + + /** + * [Index 获取列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-22T16:50:32+0800 + */ + public function Index() + { + // 参数 + $params = input(); + $params['user'] = $this->user; + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = GoodsService::UserGoodsFavorListWhere($params); + + // 获取总数 + $total = GoodsService::GoodsFavorTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'm' => $start, + 'n' => $number, + 'where' => $where, + ); + $data = GoodsService::GoodsFavorList($data_params); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + ]; + return json(DataReturn('success', 0, $result)); + } + + /** + * 用户商品收藏取消 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-17 + * @desc description + */ + public function Cancel() + { + $params = $this->data_post; + $params['user'] = $this->user; + $ret = GoodsService::GoodsFavor($params); + return json($ret); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/UserIntegral.php b/application/api/controller/UserIntegral.php new file mode 100755 index 000000000..f3fa0377b --- /dev/null +++ b/application/api/controller/UserIntegral.php @@ -0,0 +1,75 @@ +Is_Login(); + } + + /** + * 用户积分列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-28 + * @desc description + */ + public function Index() + { + // 参数 + $params = $this->data_post; + $params['user'] = $this->user; + + // 分页 + $number = 10; + $page = max(1, isset($this->data_post['page']) ? intval($this->data_post['page']) : 1); + + // 条件 + $where = IntegralService::UserIntegralLogListWhere($params); + + // 获取总数 + $total = IntegralService::UserIntegralLogTotal($where); + $page_total = ceil($total/$number); + $start = intval(($page-1)*$number); + + // 获取列表 + $data_params = array( + 'limit_start' => $start, + 'limit_number' => $number, + 'where' => $where, + ); + $data = IntegralService::UserIntegralLogList($data_params); + + // 返回数据 + $result = [ + 'total' => $total, + 'page_total' => $page_total, + 'data' => $data['data'], + ]; + return json(DataReturn('success', 0, $result)); + } + +} +?> \ No newline at end of file diff --git a/application/index/view/default/search/index.html b/application/index/view/default/search/index.html index 24720c655..0a283c8f0 100755 --- a/application/index/view/default/search/index.html +++ b/application/index/view/default/search/index.html @@ -91,7 +91,7 @@ -
  • +
  • 价格 diff --git a/application/service/AnswerService.php b/application/service/AnswerService.php index 764087af7..971df16c1 100755 --- a/application/service/AnswerService.php +++ b/application/service/AnswerService.php @@ -2,7 +2,6 @@ namespace app\service; use think\Db; -use app\service\GoodsService; /** * 问答/留言服务层 @@ -126,6 +125,61 @@ class AnswerService return $where; } + /** + * 用户留言添加 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-07-17 + * @desc description + * @param [array] $params [输入参数] + */ + public static function Add($params = []) + { + // 参数校验 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'name', + 'error_msg' => '联系人有误', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'tel', + 'error_msg' => '联系电话有误', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'content', + 'error_msg' => '详细内容有误', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'user', + 'error_msg' => '用户信息有误', + ], + ]; + $ret = ParamsChecked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 开始操作 + $data = [ + 'user_id' => $params['user']['id'], + 'name' => $params['name'], + 'tel' => $params['tel'], + 'content' => $params['content'], + 'add_time' => time(), + ]; + if(Db::name('Answer')->insertGetId($data) > 0) + { + return DataReturn('提交成功', 0); + } + return DataReturn('提交失败', -100); + } + /** * 删除 * @author Devil diff --git a/application/service/SearchService.php b/application/service/SearchService.php index 98b6a42d5..ec1d8e77b 100755 --- a/application/service/SearchService.php +++ b/application/service/SearchService.php @@ -112,9 +112,9 @@ class SearchService $order_by = ''; if(!empty($params['order_by_field']) && !empty($params['order_by_type']) && $params['order_by_field'] != 'default') { - $order_by = $params['order_by_field'].' '.$params['order_by_type']; + $order_by = 'g.'.$params['order_by_field'].' '.$params['order_by_type']; } else { - $order_by = 'access_count '.$params['order_by_type'].', sales_count '.$params['order_by_type']; + $order_by = 'g.access_count desc, g.sales_count desc'; } // 分页计算 @@ -157,7 +157,7 @@ class SearchService $params['screening_price'] = $screening_price; $params['ymd'] = date('Ymd'); $params['add_time'] = time(); - unset($params['screening_price_id']); + unset($params['screening_price_id'], $params['page'], $params['max_price'], $params['min_price']); // 添加日志 Db::name('SearchHistory')->insert($params); diff --git a/application/service/UserService.php b/application/service/UserService.php index 1fc9779d0..b31b1c29f 100755 --- a/application/service/UserService.php +++ b/application/service/UserService.php @@ -462,16 +462,25 @@ class UserService $is_default = isset($params['is_default']) ? intval($params['is_default']) : 0; $data = [ 'name' => $params['name'], - 'alias' => $params['alias'], 'tel' => $params['tel'], 'province' => $params['province'], 'city' => $params['city'], 'county' => $params['county'], 'address' => $params['address'], 'is_default' => $is_default, - 'lng' => floatval($params['lng']), - 'lat' => floatval($params['lat']), ]; + if(!empty($params['alias'])) + { + $data['alias'] = floatval($params['alias']); + } + if(!empty($params['lng'])) + { + $data['lng'] = floatval($params['lng']); + } + if(!empty($params['lat'])) + { + $data['lat'] = floatval($params['lat']); + } Db::startTrans(); @@ -1399,6 +1408,11 @@ class UserService 'key_name' => 'mobile', 'error_msg' => '手机号码不能为空', ], + [ + 'checked_type' => 'empty', + 'key_name' => 'verify', + 'error_msg' => '验证码不能为空', + ], [ 'checked_type' => 'empty', 'key_name' => 'app_type', diff --git a/public/appmini/old/alipay/app.js b/public/appmini/old/alipay/app.js index 036e969a3..e78cb4331 100755 --- a/public/appmini/old/alipay/app.js +++ b/public/appmini/old/alipay/app.js @@ -50,7 +50,7 @@ App({ // 请求地址 //request_url: "{{request_url}}", - //request_url: "https://demo.shopxo.net/", + //request_url: "https://demo.shopxo.net/index.php?s=", request_url: 'http://tp5-dev.com/index.php?s=', // 基础信息 diff --git a/public/appmini/old/alipay/app.json b/public/appmini/old/alipay/app.json index a81475191..418bb49ab 100755 --- a/public/appmini/old/alipay/app.json +++ b/public/appmini/old/alipay/app.json @@ -1,5 +1,5 @@ { - "pages": ["pages/goods-detail/goods-detail", + "pages": [ "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", @@ -8,7 +8,7 @@ "pages/login/login", "pages/paytips/paytips", "pages/goods-search/goods-search", - + "pages/goods-detail/goods-detail", "pages/goods-attribute/goods-attribute", "pages/buy/buy", "pages/user-address/user-address", diff --git a/public/appmini/old/alipay/pages/buy/buy.axml b/public/appmini/old/alipay/pages/buy/buy.axml index bd8703d00..831615552 100755 --- a/public/appmini/old/alipay/pages/buy/buy.axml +++ b/public/appmini/old/alipay/pages/buy/buy.axml @@ -25,8 +25,8 @@ {{item.title}} - - {{attr.attr_type_name}}:{{attr.attr_name}} + + {{spec.type}}:{{spec.value}} diff --git a/public/appmini/old/alipay/pages/buy/buy.js b/public/appmini/old/alipay/pages/buy/buy.js index e8a8402d0..f3bf0cf65 100755 --- a/public/appmini/old/alipay/pages/buy/buy.js +++ b/public/appmini/old/alipay/pages/buy/buy.js @@ -72,7 +72,7 @@ Page({ var data = this.data.params; data['address_id'] = this.data.address_id; my.httpRequest({ - url: app.get_request_url("Index", "Buy"), + url: app.get_request_url("index", "buy"), method: "POST", data: data, dataType: "json", @@ -157,7 +157,7 @@ Page({ this.setData({ buy_submit_disabled_status: true }); my.httpRequest({ - url: app.get_request_url("Add", "Buy"), + url: app.get_request_url("add", "buy"), method: "POST", data: data, dataType: "json", diff --git a/public/appmini/old/alipay/pages/cart/cart.acss b/public/appmini/old/alipay/pages/cart/cart.acss index c78ace19a..12d729771 100755 --- a/public/appmini/old/alipay/pages/cart/cart.acss +++ b/public/appmini/old/alipay/pages/cart/cart.acss @@ -24,6 +24,7 @@ } .goods-base { min-height: 160rpx; + margin-left: 180rpx; } .goods-price { position: relative; @@ -55,7 +56,7 @@ font-weight: bold; } .number-content input { - width: 50px; + width: 30px; } .number-content .number-submit, .number-content input diff --git a/public/appmini/old/alipay/pages/cart/cart.axml b/public/appmini/old/alipay/pages/cart/cart.axml index 0ed4bfa24..c8b8dc8bf 100755 --- a/public/appmini/old/alipay/pages/cart/cart.axml +++ b/public/appmini/old/alipay/pages/cart/cart.axml @@ -17,8 +17,8 @@ {{item.title}} - - {{attr.attr_type_name}}:{{attr.attr_name}} + + {{spec.type}}:{{spec.value}} diff --git a/public/appmini/old/alipay/pages/goods-category/goods-category.js b/public/appmini/old/alipay/pages/goods-category/goods-category.js index 455872a2e..6df16286b 100755 --- a/public/appmini/old/alipay/pages/goods-category/goods-category.js +++ b/public/appmini/old/alipay/pages/goods-category/goods-category.js @@ -23,7 +23,7 @@ Page({ // 加载loding my.httpRequest({ - url: app.get_request_url("GoodsCategory", "Resources"), + url: app.get_request_url("category", "goods"), method: "POST", data: {}, dataType: "json", diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss index 4d6c0411c..e2915e59e 100755 --- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss +++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss @@ -19,7 +19,7 @@ z-index: 2; } .goods-popup-base { - height: 220rpx; + height: 230rpx; position: relative; } .goods-popup-base image { @@ -32,7 +32,7 @@ .goods-popup-base-content { position: absolute; left: 220rpx; - bottom: 20rpx; + bottom: 30rpx; } .goods-popup-base-content .goods-price { margin-bottom: 10rpx; diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.js b/public/appmini/old/alipay/pages/goods-detail/goods-detail.js index 60e522b0c..5b375c57d 100755 --- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.js +++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.js @@ -31,7 +31,7 @@ Page({ }, onLoad(params) { - params['goods_id']=12; + //params['goods_id']=12; this.setData({params: params}); this.init(); }, @@ -251,7 +251,7 @@ Page({ }, // 加入购物车事件 - goods_cart_event(e) { + goods_cart_event(e, spec) { var user = app.GetUserInfo(this, 'goods_cart_event'); if (user != false) { // 用户未绑定用户则转到登录页面 @@ -261,21 +261,11 @@ Page({ }); return false; } else { - var attribute_all_cart = {}; - var temp_attribute_active = this.data.temp_attribute_active; - if (app.get_length(temp_attribute_active) > 0) - { - var goods_specifications_choose = this.data.goods_specifications_choose; - for (var i in temp_attribute_active) { - attribute_all_cart[goods_specifications_choose[i]['id']] = goods_specifications_choose[i]['find'][temp_attribute_active[i]]['id']; - } - } my.showLoading({ content: '处理中...' }); - my.httpRequest({ url: app.get_request_url('save', 'cart'), method: 'POST', - data: { "goods_id": this.data.goods.id, "stock": this.data.temp_buy_number, "attr": JSON.stringify(attribute_all_cart) }, + data: { "goods_id": this.data.goods.id, "stock": this.data.temp_buy_number, "spec": JSON.stringify(spec) }, dataType: 'json', success: (res) => { my.hideLoading(); @@ -409,7 +399,6 @@ Page({ break; } } - console.log(temp_value, temp_status, res.data) if(temp_status == true) { temp_data[i]['value'][k]['is_disabled'] = ''; @@ -521,7 +510,7 @@ Page({ goods_buy_number_func(buy_number) { var buy_min_number = parseInt(this.data.goods.buy_min_number) || 1; var buy_max_number = parseInt(this.data.goods.buy_max_number) || 0; - var inventory = parseInt(this.data.goods.inventory); + var inventory = parseInt(this.data.goods.goods_spec_base_inventory); var inventory_unit = this.data.goods.inventory_unit; if(buy_number < buy_min_number) { @@ -556,25 +545,30 @@ Page({ return false; } else { // 属性 - var goods_specifications_choose = this.data.goods_specifications_choose; - var temp_attribute_active = this.data.temp_attribute_active; - var attr_count = goods_specifications_choose.length; - var attribute_all = {}; - if(attr_count > 0) + var temp_data = this.data.goods_specifications_choose; + var sku_count = temp_data.length; + var active_count = 0; + var spec = []; + if(sku_count > 0) { - var attr_active_count = app.get_length(temp_attribute_active); - if(attr_active_count < attr_count) + for(var i in temp_data) + { + for(var k in temp_data[i]['value']) + { + if((temp_data[i]['value'][k]['is_active'] || null) != null) + { + active_count++; + spec.push({"type": temp_data[i]['name'], "value": temp_data[i]['value'][k]['name']}); + } + } + } + if(active_count < sku_count) { my.showToast({ type: 'fail', content: '请选择属性' }); return false; - } else { - for(var i in temp_attribute_active) - { - attribute_all[goods_specifications_choose[i]['id']] = goods_specifications_choose[i]['find'][temp_attribute_active[i]]['id']; - } } } @@ -586,7 +580,7 @@ Page({ "buy_type": "goods", "goods_id": this.data.goods.id, "stock": this.data.temp_buy_number, - "attr": JSON.stringify(attribute_all) + "spec": JSON.stringify(spec) }; my.navigateTo({ url: '/pages/buy/buy?data=' + JSON.stringify(data) @@ -595,7 +589,7 @@ Page({ break; case 'cart' : - this.goods_cart_event(); + this.goods_cart_event(e, spec); break; default : diff --git a/public/appmini/old/alipay/pages/goods-search/goods-search.js b/public/appmini/old/alipay/pages/goods-search/goods-search.js index 6361279b5..f1d514392 100755 --- a/public/appmini/old/alipay/pages/goods-search/goods-search.js +++ b/public/appmini/old/alipay/pages/goods-search/goods-search.js @@ -13,7 +13,7 @@ Page({ search_nav_sort_list: [ { name: "综合", field: "default", sort: "asc", "icon": null }, { name: "销量", field: "sales_count", sort: "asc", "icon": "default" }, - { name: "价格", field: "price", sort: "asc", "icon": "default" }, + { name: "价格", field: "min_price", sort: "asc", "icon": "default" }, ], }, @@ -64,7 +64,7 @@ Page({ // 获取数据 my.httpRequest({ - url: app.get_request_url("Index", "Search"), + url: app.get_request_url("index", "search"), method: "POST", data: post_data, dataType: "json", diff --git a/public/appmini/old/alipay/pages/user-address-save/user-address-save.js b/public/appmini/old/alipay/pages/user-address-save/user-address-save.js index ab23ae891..f9748b652 100755 --- a/public/appmini/old/alipay/pages/user-address-save/user-address-save.js +++ b/public/appmini/old/alipay/pages/user-address-save/user-address-save.js @@ -60,7 +60,7 @@ Page({ my.showLoading({ content: "加载中..." }); my.httpRequest({ - url: app.get_request_url("Detail", "UserAddress"), + url: app.get_request_url("detail", "useraddress"), method: "POST", data: self.data.params, dataType: "json", @@ -104,7 +104,7 @@ Page({ get_province_list() { var self = this; my.httpRequest({ - url: app.get_request_url("Index", "Region"), + url: app.get_request_url("index", "region"), method: "POST", data: {}, dataType: "json", @@ -134,7 +134,7 @@ Page({ var self = this; if (self.data.province_id) { my.httpRequest({ - url: app.get_request_url("Index", "Region"), + url: app.get_request_url("index", "region"), method: "POST", data: { pid: self.data.province_id @@ -168,7 +168,7 @@ Page({ if (self.data.city_id) { // 加载loding my.httpRequest({ - url: app.get_request_url("Index", "Region"), + url: app.get_request_url("index", "region"), method: "POST", data: { pid: self.data.city_id @@ -282,7 +282,7 @@ Page({ my.showLoading({ content: "处理中..." }); my.httpRequest({ - url: app.get_request_url("Save", "UserAddress"), + url: app.get_request_url("save", "useraddress"), method: "POST", data: form_data, dataType: "json", diff --git a/public/appmini/old/alipay/pages/user-address/user-address.js b/public/appmini/old/alipay/pages/user-address/user-address.js index 5a77fe997..167fb4b1a 100755 --- a/public/appmini/old/alipay/pages/user-address/user-address.js +++ b/public/appmini/old/alipay/pages/user-address/user-address.js @@ -44,7 +44,7 @@ Page({ // 获取数据 my.httpRequest({ - url: app.get_request_url("Index", "UserAddress"), + url: app.get_request_url("index", "useraddress"), method: "POST", data: {}, dataType: "json", @@ -132,7 +132,7 @@ Page({ // 获取数据 my.httpRequest({ - url: app.get_request_url("Delete", "UserAddress"), + url: app.get_request_url("delete", "useraddress"), method: "POST", data: {id: value}, dataType: "json", @@ -212,7 +212,7 @@ Page({ // 获取数据 my.httpRequest({ - url: app.get_request_url("SetDefault", "UserAddress"), + url: app.get_request_url("setdefault", "useraddress"), method: "POST", data: {id: value}, dataType: "json", diff --git a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.acss b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.acss index 8b8fb452a..7e108d205 100755 --- a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.acss +++ b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.acss @@ -26,6 +26,7 @@ .goods-base { min-height: 160rpx; + margin-left: 180rpx; } .goods .goods-item:not(:last-child) { border-bottom: 1px dashed #efefef; diff --git a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.axml b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.axml index a30bce7b8..28e4cccef 100755 --- a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.axml +++ b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.axml @@ -16,9 +16,9 @@ {{item.title}} - - - {{attr.attr_type_name}}:{{attr.attr_name}} + + + {{spec.type}}:{{spec.value}} diff --git a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.js b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.js index 309ae3ef3..3b5e927f8 100755 --- a/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.js +++ b/public/appmini/old/alipay/pages/user-order-detail/user-order-detail.js @@ -26,7 +26,7 @@ Page({ }); my.httpRequest({ - url: app.get_request_url("Detail", "Order"), + url: app.get_request_url("detail", "order"), method: "POST", data: { id: this.data.params.id diff --git a/public/appmini/old/alipay/pages/user-order/user-order.axml b/public/appmini/old/alipay/pages/user-order/user-order.axml index 14b93e7c1..5e525692d 100755 --- a/public/appmini/old/alipay/pages/user-order/user-order.axml +++ b/public/appmini/old/alipay/pages/user-order/user-order.axml @@ -19,9 +19,9 @@ {{detail.title}} - - - {{attr.attr_type_name}}:{{attr.attr_name}} + + + {{spec.type}}:{{spec.value}} diff --git a/public/appmini/old/alipay/pages/user-order/user-order.js b/public/appmini/old/alipay/pages/user-order/user-order.js index c5e0a581c..70dd05d8b 100755 --- a/public/appmini/old/alipay/pages/user-order/user-order.js +++ b/public/appmini/old/alipay/pages/user-order/user-order.js @@ -89,7 +89,7 @@ Page({ // 获取数据 my.httpRequest({ - url: app.get_request_url("Index", "Order"), + url: app.get_request_url("index", "order"), method: "POST", data: { page: this.data.data_page, @@ -222,7 +222,7 @@ Page({ my.showLoading({ content: "请求中..." }); my.httpRequest({ - url: app.get_request_url("Pay", "Order"), + url: app.get_request_url("pay", "order"), method: "POST", data: { id: order_id, @@ -306,7 +306,7 @@ Page({ my.showLoading({ content: "处理中..." }); my.httpRequest({ - url: app.get_request_url("Cancel", "Order"), + url: app.get_request_url("cancel", "order"), method: "POST", data: {id: id}, dataType: "json", @@ -359,7 +359,7 @@ Page({ my.showLoading({ content: "处理中..." }); my.httpRequest({ - url: app.get_request_url("Collect", "Order"), + url: app.get_request_url("collect", "order"), method: "POST", data: {id: id}, dataType: "json",