...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
namespace app\api\controller;
|
|
|
|
|
|
use addons\kdniao\library\Kdniao;
|
|
|
use app\api\model\AreaExtend;
|
|
|
use app\api\model\OrderDetail;
|
|
|
use app\api\model\UserScoreLog;
|
|
|
use app\common\controller\Api;
|
...
|
...
|
@@ -53,10 +54,10 @@ class Order extends Api |
|
|
* @ApiParams (name=car_id, type=string, required=true, description="购物车id 例 1,2,3")
|
|
|
* @ApiParams (name=ticket_user_id, type=string, required=false, description="用户优惠券id")
|
|
|
* @ApiParams (name=ticket_code, type=string, required=false, description="优惠码")
|
|
|
* @ApiParams (name=province_id, type=string, required=true, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=true, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=true, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=province_id, type=string, required=false, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=false, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=false, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=false, description="配送类型:1=闪送,2=普通配送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiRoute (/api/order/order)
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
...
|
...
|
@@ -84,15 +85,11 @@ class Order extends Api |
|
|
$carId = $this->request->param('car_id');
|
|
|
$ticketId = $this->request->param('ticket_user_id');
|
|
|
$ticketCode = $this->request->param('ticket_code');
|
|
|
$provinceId = $this->request->param('province_id');
|
|
|
$cityId = $this->request->param('city_id');
|
|
|
$countyId = $this->request->param('county_id');
|
|
|
$postageType = $this->request->param('postage_type');
|
|
|
$provinceId = $this->request->param('province_id',1); //默认地址为北京
|
|
|
$cityId = $this->request->param('city_id',2); //默认地址为北京
|
|
|
$countyId = $this->request->param('county_id',3); //默认地址为北京
|
|
|
$postageType = $this->request->param('postage_type',2); //默认普通配送
|
|
|
if (empty($carId)) $this->error('缺少参数 car_id!');
|
|
|
if (empty($provinceId)) $this->error('缺少参数 province_id!');
|
|
|
if (empty($cityId)) $this->error('缺少参数 city_id!');
|
|
|
if (empty($countyId)) $this->error('缺少参数 county_id!');
|
|
|
if (empty($postageType)) $this->error('缺少参数 postage_type!');
|
|
|
//判断优惠券和优惠码不能同时使用
|
|
|
if (!empty($ticketCode) && !empty($ticketId)) $this->error('优惠券与优惠码不能同时使用!');
|
|
|
//获取普通商品id
|
...
|
...
|
@@ -167,7 +164,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $provinceId, 'city_id' => $cityId, 'county_id' => $countyId];
|
|
|
if ($postageType == 2) {
|
|
|
if ($postageType == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
@@ -217,7 +214,7 @@ class Order extends Api |
|
|
* @ApiParams (name=name, type=string, required=true, description="商品收货人")
|
|
|
* @ApiParams (name=mobile, type=string, required=true, description="商品收货电话")
|
|
|
* @ApiParams (name=present_id, type=string, required=false, description="赠品id")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=闪送,2=普通配送")
|
|
|
* @ApiParams (name=postage_date, type=string, required=false, description="配送日期")
|
|
|
* @ApiParams (name=postage_time, type=string, required=false, description="配送时间")
|
|
|
* @ApiParams (name=invoice_status, type=string, required=true, description="发票状态:1=个人或事业单位,2=企业,3=不需要开发票")
|
...
|
...
|
@@ -340,7 +337,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $param['province_id'], 'city_id' => $param['city_id'], 'county_id' => $param['county_id']];
|
|
|
if ($param['postage_type'] == 2) {
|
|
|
if ($param['postage_type'] == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
@@ -483,10 +480,10 @@ class Order extends Api |
|
|
* @ApiParams (name=goods_id, type=string, required=true, description="商品id")
|
|
|
* @ApiParams (name=ticket_user_id, type=string, required=false, description="用户优惠券id")
|
|
|
* @ApiParams (name=ticket_code, type=string, required=false, description="优惠码")
|
|
|
* @ApiParams (name=province_id, type=string, required=true, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=true, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=true, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=province_id, type=string, required=false, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=false, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=false, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=false, description="配送类型:1=闪送,2=普通配送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiRoute (/api/order/orderIntegral)
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
...
|
...
|
@@ -514,15 +511,11 @@ class Order extends Api |
|
|
$goodsId = $this->request->param('goods_id');
|
|
|
$ticketId = $this->request->param('ticket_user_id');
|
|
|
$ticketCode = $this->request->param('ticket_code');
|
|
|
$provinceId = $this->request->param('province_id');
|
|
|
$cityId = $this->request->param('city_id');
|
|
|
$countyId = $this->request->param('county_id');
|
|
|
$postageType = $this->request->param('postage_type');
|
|
|
$provinceId = $this->request->param('province_id',1); //默认地址为北京
|
|
|
$cityId = $this->request->param('city_id',2); //默认地址为北京
|
|
|
$countyId = $this->request->param('county_id',3); //默认地址为北京
|
|
|
$postageType = $this->request->param('postage_type',2); //默认普通配送
|
|
|
if (empty($goodsId)) $this->error('缺少参数 goods_id!');
|
|
|
if (empty($provinceId)) $this->error('缺少参数 province_id!');
|
|
|
if (empty($cityId)) $this->error('缺少参数 city_id!');
|
|
|
if (empty($countyId)) $this->error('缺少参数 county_id!');
|
|
|
if (empty($postageType)) $this->error('缺少参数 postage_type!');
|
|
|
//判断优惠券和优惠码不能同时使用
|
|
|
if (!empty($ticketCode) && !empty($ticketId)) $this->error('优惠券与优惠码不能同时使用!');
|
|
|
|
...
|
...
|
@@ -572,7 +565,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $provinceId, 'city_id' => $cityId, 'county_id' => $countyId];
|
|
|
if ($postageType == 2) {
|
|
|
if ($postageType == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
@@ -622,7 +615,7 @@ class Order extends Api |
|
|
* @ApiParams (name=name, type=string, required=true, description="商品收货人")
|
|
|
* @ApiParams (name=mobile, type=string, required=true, description="商品收货电话")
|
|
|
* @ApiParams (name=present_id, type=string, required=false, description="赠品id")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=闪送,2=普通配送")
|
|
|
* @ApiParams (name=postage_date, type=string, required=false, description="配送日期")
|
|
|
* @ApiParams (name=postage_time, type=string, required=false, description="配送时间")
|
|
|
* @ApiParams (name=invoice_status, type=string, required=true, description="发票状态:1=个人或事业单位,2=企业,3=不需要开发票")
|
...
|
...
|
@@ -727,7 +720,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $param['province_id'], 'city_id' => $param['city_id'], 'county_id' => $param['county_id']];
|
|
|
if ($param['postage_type'] == 2) {
|
|
|
if ($param['postage_type'] == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
@@ -860,10 +853,10 @@ class Order extends Api |
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true description="请求的Token")
|
|
|
* @ApiParams (name=goods_id, type=string, required=true, description="商品id")
|
|
|
* @ApiParams (name=province_id, type=string, required=true, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=true, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=true, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=province_id, type=string, required=false, description="省id /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=city_id, type=string, required=false, description="市 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=county_id, type=string, required=false, description="县 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiParams (name=postage_type, type=string, required=false, description="配送类型:1=闪送,2=普通配送 /api/user_address/getUserAddressDefault 接口获取")
|
|
|
* @ApiRoute (/api/order/orderTeam)
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
...
|
...
|
@@ -884,15 +877,11 @@ class Order extends Api |
|
|
{
|
|
|
$userId = $this->getUserId();
|
|
|
$goodsId = $this->request->param('goods_id');
|
|
|
$provinceId = $this->request->param('province_id');
|
|
|
$cityId = $this->request->param('city_id');
|
|
|
$countyId = $this->request->param('county_id');
|
|
|
$postageType = $this->request->param('postage_type');
|
|
|
$provinceId = $this->request->param('province_id',1); //默认地址为北京
|
|
|
$cityId = $this->request->param('city_id',2); //默认地址为北京
|
|
|
$countyId = $this->request->param('county_id',3); //默认地址为北京
|
|
|
$postageType = $this->request->param('postage_type',2); //默认普通配送
|
|
|
if (empty($goodsId)) $this->error('缺少参数 goods_id!');
|
|
|
if (empty($provinceId)) $this->error('缺少参数 province_id!');
|
|
|
if (empty($cityId)) $this->error('缺少参数 city_id!');
|
|
|
if (empty($countyId)) $this->error('缺少参数 county_id!');
|
|
|
if (empty($postageType)) $this->error('缺少参数 postage_type!');
|
|
|
|
|
|
$goodsInfo = $this->goodsModel->where(['id' => $goodsId])->field('id,status,stock_num,is_group,group_num,group_price,grouptime,goods_price')->find();
|
|
|
//判断商品是否有库存和状态
|
...
|
...
|
@@ -923,7 +912,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $provinceId, 'city_id' => $cityId, 'county_id' => $countyId];
|
|
|
if ($postageType == 2) {
|
|
|
if ($postageType == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
@@ -960,7 +949,7 @@ class Order extends Api |
|
|
* @ApiParams (name=name, type=string, required=true, description="商品收货人")
|
|
|
* @ApiParams (name=mobile, type=string, required=true, description="商品收货电话")
|
|
|
* @ApiParams (name=present_id, type=string, required=false, description="赠品id")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=普通配送,2=闪送")
|
|
|
* @ApiParams (name=postage_type, type=string, required=true, description="配送类型:1=闪送,2=普通配送")
|
|
|
* @ApiParams (name=postage_date, type=string, required=false, description="配送日期")
|
|
|
* @ApiParams (name=postage_time, type=string, required=false, description="配送时间")
|
|
|
* @ApiParams (name=invoice_status, type=string, required=true, description="发票状态:1=个人或事业单位,2=企业,3=不需要开发票")
|
...
|
...
|
@@ -1058,7 +1047,7 @@ class Order extends Api |
|
|
} else {
|
|
|
//都不满足获取对应的运费
|
|
|
$postageWhere = ['province_id' => $param['province_id'], 'city_id' => $param['city_id'], 'county_id' => $param['county_id']];
|
|
|
if ($param['postage_type'] == 2) {
|
|
|
if ($param['postage_type'] == 1) {
|
|
|
//配送为闪送
|
|
|
$postage = $this->areaExtendModel->where($postageWhere)->value('postage2');
|
|
|
if (!$postage) {
|
...
|
...
|
|