77 行
4.4 KiB
PHP
可执行文件
77 行
4.4 KiB
PHP
可执行文件
<?php
|
||
namespace Common\Model;
|
||
use Think\Model;
|
||
//[1.4.13]
|
||
/**
|
||
* 订单商城分表 ZaiYuLi 2019-6-15
|
||
* Class RetailBillModel
|
||
* @package Common\Model
|
||
*/
|
||
class RetailBillOnlineModel extends BaseModel{
|
||
protected $tableName = 'retail_bill_online';
|
||
const BILL_ID = 'bill_id';//int(11) DEFAULT NULL COMMENT 'bill表id',
|
||
const STATUS = 'status';//tinyint(1) DEFAULT '0' COMMENT '1未发货 2已发货 3已收货',
|
||
const EVAL_STATUS = 'eval_status';//tinyint(1) DEFAULT '0' COMMENT '0未评价 1已评价',
|
||
const CANCEL_TIME = 'cancel_time';//int(2) DEFAULT '0' COMMENT '申请取消订单次数',
|
||
const REFUND_TIME = 'refund_time';//int(2) DEFAULT '0' COMMENT '申请退货退款次数',
|
||
const PICKUP_TYPE = 'pickup_type';//tinyint(3) DEFAULT '1' COMMENT '取货方式 1:自提 2:配送',
|
||
const USER_NAME = 'user_name';//varchar(30) DEFAULT NULL COMMENT '小程序自提联系人姓名',
|
||
const USER_PHONE = 'user_phone';//varchar(11) DEFAULT NULL COMMENT '小程序自提时的联系电话',
|
||
const USER_ADDRESS = 'user_address';//varchar(255) DEFAULT NULL COMMENT '收货地址',
|
||
const REMIND_STATE = 'remind_state';//int(1) DEFAULT '0' COMMENT '提醒发货:0,未提醒,1,已提醒。',
|
||
const REMIND_TIME = 'remind_time';//int(11) DEFAULT NULL COMMENT '用户提醒发货时间。(用于排序)',
|
||
const PICK_CODE = 'pick_code';//varchar(20) DEFAULT NULL COMMENT '提货码:用于小程序商城下单提货。',
|
||
const SHOPPING_IDS = 'shopping_ids';//varchar(255) DEFAULT NULL COMMENT '购物车id 字符串拼接',
|
||
const DELIVERY_TYPE = 'delivery_type';//tinyint(1) DEFAULT '1' COMMENT '配送方式 1门店自己配送 2达达配送 3uu跑腿',
|
||
const DELIVERY_RECORD_ID = 'delivery_record_id';//int(11) DEFAULT '0' COMMENT '达达、UU订单id',
|
||
const CANCEL_DELIVERY_STATUS = 'cancel_delivery_status';//tinyint(1) DEFAULT '1' COMMENT '是否取消过达达或UU配送 1 未取消 2取消',
|
||
const DELIVERY_FEE = 'delivery_fee';//decimal(10,2) DEFAULT '0.00' COMMENT '配送费',
|
||
const ORDER_GENRE = 'order_genre';//tinyint(3) DEFAULT '1' COMMENT '订单类型 1.普通订单 2.拼团订单 3.秒杀订单',
|
||
const REMARK = 'remark';//varchar(255) DEFAULT NULL COMMENT '用户备注',
|
||
const REFUND_DELIVERY_STATE = 'refund_delivery_state';//tinyint(1) DEFAULT '1' COMMENT '1退还配送费 2拒绝退还配送费 (退款专用字段)',
|
||
const DELIVERY_TIME = 'delivery_time';//varchar(20) DEFAULT NULL COMMENT '配送时间',
|
||
const RECEIVING_TIME = 'receiving_goods_time';//varchar(20) DEFAULT NULL COMMENT '确认收货时间',
|
||
const USER_SELECT_TIME = 'user_select_time';//varchar(20) DEFAULT NULL COMMENT '用户选择的配送或者自提时间',
|
||
const PREPAY_ID = 'prepay_id';//varchar(32) DEFAULT '' COMMENT '小程序用户微信支付的prepay_id',
|
||
const FORM_ID = 'form_id';//varchar(50) DEFAULT NULL COMMENT '小程序用户服务通知所用的form_id',
|
||
|
||
/**
|
||
* 配送验证订单是否可以配送
|
||
* $parameter bill_order 订单信息
|
||
*/
|
||
public function delivery_verify($parameter)
|
||
{
|
||
if(is_array($parameter)){
|
||
$where = array(
|
||
$this::BILL_ID => $parameter['id']
|
||
);
|
||
$onlineOrder = $this->getFind($where);
|
||
if (empty($onlineOrder)) {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '数据库操作有误';
|
||
return $res;
|
||
}
|
||
if ($onlineOrder[$this::STATUS] == 2) {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '订单已在配送,请勿重复操作';
|
||
return $res;
|
||
} else if ($onlineOrder[$this::STATUS] == 3) {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '订单已收货,请刷新页面查看';
|
||
return $res;
|
||
}
|
||
if ($parameter["refund_status"] == 1) {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '该订单存在退款申请,请先处理';
|
||
return $res;
|
||
}
|
||
$res['status'] = 1;
|
||
$res['online_order'] = $onlineOrder;
|
||
return $res;
|
||
}else{
|
||
$res['status'] = 0;
|
||
$res['msg'] = '参数格式错误';
|
||
}
|
||
return $res;
|
||
}
|
||
} |