| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use Codeception\PHPUnit\ResultPrinter\HTML;
- /**
- * This is the model class for table "{{%order_pospal}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property integer $user_id
- * @property string $order_no
- * @property string $total_price
- * @property string $pay_price
- * @property string $express_price
- * @property string $name
- * @property string $mobile
- * @property string $address
- * @property string $remark
- * @property integer $is_pay
- * @property integer $pay_type
- * @property integer $pay_time
- * @property integer $send_time
- * @property string $express
- * @property string $express_no
- * @property integer $confirm_time
- * @property integer $is_comment
- * @property integer $apply_delete
- * @property integer $created_at
- * @property integer $is_delete
- * @property integer $is_price
- * @property integer $parent_id
- * @property string $first_price
- * @property string $second_price
- * @property string $third_price
- * @property string $coupon_sub_price
- * @property string $content
- * @property integer $is_offline
- * @property integer $clerk_id
- * @property string $address_data
- * @property string $offline_qrcode
- * @property string $before_update_price
- * @property integer $shop_id
- * @property string $discount
- * @property integer $user_coupon_id
- * @property string $integral
- * @property integer $give_integral
- * @property integer $parent_id_1
- * @property integer $parent_id_2
- * @property integer $is_sale
- * @property string $words
- * @property string $version
- * @property string $express_price_1
- * @property integer $mch_id
- * @property integer $is_recycle
- * @property string $seller_comments
- * @property integer $order_union_id
- * @property string $rebate
- * @property string $before_update_express
- * @property integer $is_transfer
- * @property integer $type
- * @property string $share_price
- * @property integer $is_show
- * @property integer $order_origin
- * @property integer $is_open_offline
- * @property integer $trade_status
- * @property string $transaction_id
- * @property string $alipay_trade_no
- * @property string $is_platform
- * @property integer $combine_money
- * @property integer $is_combine_pay
- * @property integer $order_type
- * @property string $book_info
- * @property string $updated_at
- * @property string $is_delivery
- * @property integer $md_id
- * @property integer $is_trans
- * @property integer $profit
- * @property integer $province_id
- * @property integer $city_id
- * @property integer $district_id
- * @property integer $food_flag_id
- * @property integer $food_book_ext
- * @property integer $pay_user_id
- * @property string $food_code
- * @property integer $ag_rebate
- * @property integer $verify_card_id
- * @property integer $holder_first_price
- * @property integer $holder_second_price
- * @property integer $holder_third_price
- * @property integer $holder_is_price
- * @property integer $share_send_type
- * @property integer $share_order_profit
- * @property integer $limit_id
- * @property integer $limit_price
- * @property integer $is_send_limit
- * @property integer $old_holder_first_price
- * @property integer $old_holder_second_price
- * @property integer $old_holder_third_price
- * @property integer $old_parent_id
- * @property integer $old_parent_id_1
- * @property integer $old_parent_id_2
- */
- class OrderPospal extends \yii\db\ActiveRecord
- {
- /**
- * 订单流转状态:默认
- */
- const ORDER_FLOW_DEFAULT = -1;
- /**
- * 订单流转状态:待发货
- */
- const ORDER_FLOW_NO_SEND = 0;
- /**
- * 订单流转状态:已取消
- */
- const ORDER_FLOW_CANCEL = 1;
- /**
- * 订单流转状态:已发货
- */
- const ORDER_FLOW_SEND = 2;
- /**
- * 订单流转状态:已完成
- */
- const ORDER_FLOW_CONFIRM = 3;
- public $valid_order_flow = [
- self::ORDER_FLOW_DEFAULT,
- self::ORDER_FLOW_NO_SEND,
- self::ORDER_FLOW_SEND,
- self::ORDER_FLOW_CANCEL,
- self::ORDER_FLOW_CONFIRM
- ];
- /**
- * 申请取消订单: 默认
- */
- const ORDER_APPLY_DELETE_DEFAULT = 0;
- /**
- * 申请取消订单: 申请中
- */
- const ORDER_APPLY_DELETE = 1;
- /**
- * 订单来源 公众号或网站
- */
- const ORDER_SOURCE_WEB = 1;
- /**
- * 订单来源 app
- */
- const ORDER_SOURCE_APP = 2;
- /**
- * 订单来源 小程序
- */
- const ORDER_SOURCE_MINI = 3;
- /**
- * 用户取消类型
- */
- const CANCEL_USER_TYPE = 0;
- /**
- * 后台取消类型
- */
- const CANCEL_BACK_TYPE = 1;
- /**
- * 是否取消(手动):已取消
- */
- const IS_DELETE_TRUE = 1;
- /**
- * 是否取消(手动):未取消
- */
- const IS_DELETE_FALSE = 0;
- /**
- * 是否支付:已支付
- */
- const IS_PAY_TRUE = 1;
- /**
- * 是否支付:未支付
- */
- const IS_PAY_FALSE = 0;
- /**
- * 支付方式:未支付
- */
- const PAY_TYPE_UNPAID = 0;
- /**
- * 支付方式:微信支付
- */
- const PAY_TYPE_WECHAT = 1;
- /**
- * 支付方式:货到付款
- */
- const PAY_TYPE_COD = 2;
- /**
- * 支付方式:余额支付
- */
- const PAY_TYPE_BALANCE_PAID = 3;
- /**
- * 订单类型:商城订单
- */
- const ORDER_TYPE_STORE = 0;
- /**
- * 订单类型:当面付订单
- */
- const ORDER_TYPE_POND = 1;
- /**
- * 订单类型:认养订单
- */
- const ORDER_TYPE_Adopt = 5;
- /**
- * 订单是否显示:显示
- */
- const IS_SHOW_TRUE = 1;
- /**
- * 订单是否显示:不显示
- */
- const IS_SHOW_FALSE = 0;
- /**
- * 是否过售后时间:是
- */
- const IS_SALE_TRUE = 1;
- /**
- * 是否过售后时间:否
- */
- const IS_SALE_FALSE = 0;
- /**
- * 自提订单
- */
- const IS_OFFLINE_TRUE = 1;
- const IS_OFFLINE_FALSE = 0;
- /**
- * 类型
- */
- // const SEND_TYPE_DADA = 1;
- // const SEND_TYPE_UU = 2;
- // const SEND_TYPE_PEISONG = 3;
- /**
- * 同城配送
- */
- const IS_SAME_CITY_NO = 0; //否
- const IS_SAME_CITY_YES = 1; //是
- /**
- * 是否是组合支付:是
- */
- const IS_COMBINE_PAY = 1;
- /**
- * 是否是组合支付:否
- */
- const NOT_COMBINE_PAY = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%order_pospal}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'user_id', 'order_no', 'first_price', 'second_price', 'third_price'], 'required'],
- [['store_id', 'user_id', 'is_pay', 'pay_type', 'pay_time', 'send_time',
- 'confirm_time', 'is_comment', 'apply_delete', 'created_at', 'updated_at', 'is_delete', 'is_price', 'parent_id',
- 'is_offline', 'clerk_id', 'shop_id', 'user_coupon_id', 'give_integral', 'parent_id_1',
- 'parent_id_2', 'old_parent_id', 'old_parent_id_1', 'old_parent_id_2', 'is_sale', 'mch_id', 'order_union_id', 'is_transfer', 'type', 'is_show',
- 'is_open_offline', 'order_origin', 'trade_status', 'is_platform', 'is_combine_pay', 'order_type',
- 'is_delivery', 'md_id', 'is_trans', 'province_id', 'city_id', 'district_id', 'food_flag_id', 'pay_user_id', 'verify_card_id', 'holder_is_price', 'share_send_type','limit_id', 'is_send_limit','integral_price'], 'integer'],
- [['total_price', 'pay_price', 'express_price', 'first_price', 'second_price', 'third_price',
- 'coupon_sub_price', 'before_update_price', 'discount', 'express_price_1', 'rebate',
- 'before_update_express', 'share_price', 'combine_money', 'profit', 'ag_rebate', 'holder_first_price', 'holder_second_price', 'holder_third_price', 'old_holder_first_price', 'old_holder_second_price', 'old_holder_third_price', 'share_order_profit', 'limit_price','integral_difference_price'], 'number'],
- [['address_data', 'content', 'offline_qrcode', 'integral', 'words', 'seller_comments', 'book_info', 'food_book_ext', 'food_code'], 'string'],
- [['order_no', 'name', 'mobile', 'express', 'express_no', 'version', 'alipay_trade_no'], 'string', 'max' => 255],
- [['address', 'remark'], 'string', 'max' => 1000],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'user_id' => '用户id',
- 'order_no' => '订单号',
- 'total_price' => '订单总费用(包含运费)',
- 'pay_price' => '实际支付总费用(含运费)',
- 'express_price' => '运费',
- 'integral_price' => '积分数量',
- 'integral_difference_price' => '补积分差价',
- 'name' => '收货人姓名',
- 'mobile' => '收货人手机',
- 'address' => '收货地址',
- 'remark' => '订单备注',
- 'is_pay' => '支付状态:0=未支付,1=已支付',
- 'pay_type' => '支付方式:1=微信支付',
- 'pay_time' => '支付时间',
- 'send_time' => '发货时间',
- 'express' => '物流公司',
- 'express_no' => 'Express No',
- 'confirm_time' => '确认收货时间',
- 'is_comment' => '是否已评价:0=未评价,1=已评价',
- 'apply_delete' => '是否申请取消订单:0=否,1=申请取消订单',
- 'created_at' => 'Addtime',
- 'is_delete' => 'Is Delete',
- 'is_price' => '是否发放佣金',
- 'parent_id' => '用户上级ID',
- 'first_price' => '一级佣金',
- 'second_price' => '二级佣金',
- 'third_price' => '三级佣金',
- 'coupon_sub_price' => '优惠券抵消金额',
- 'content' => 'Content',
- 'is_offline' => '是否到店自提 0--否 1--是',
- 'clerk_id' => '核销员user_id',
- 'address_data' => '收货地址信息,json格式',
- 'offline_qrcode' => '核销码',
- 'before_update_price' => '修改前的价格',
- 'shop_id' => '自提自提点ID',
- 'discount' => '会员折扣',
- 'user_coupon_id' => '使用的优惠券ID',
- 'integral' => '积分使用',
- 'give_integral' => '是否发放积分【1=> 已发放 , 0=> 未发放】',
- 'parent_id_1' => '用户上二级ID',
- 'parent_id_2' => '用户上三级ID',
- 'is_sale' => '是否超过售后时间',
- 'words' => '商家留言',
- 'version' => '版本',
- 'express_price_1' => '减免的运费',
- 'mch_id' => '入驻商户id',
- 'seller_comments' => '商家备注',
- 'order_union_id' => '合并订单的id',
- 'rebate' => '自购返利',
- 'before_update_express' => '价格修改前的运费',
- 'is_transfer' => '是否已转入商户账户:0=否,1=是',
- 'type' => '0普通订单1卡券兑换订单',
- 'share_price' => '发放佣金的金额',
- 'is_show' => '是否显示 0--不显示 1--显示(软删除用)',
- 'order_origin' => '订单来源 1:公众号或者网站 2:app 3:小程序',
- 'is_open_offline' => '是否是线下购物车下的订单',
- 'trade_status' => '订单状态,-1:默认,0:待发货,1:已取消,2:已发货,3:已确认',
- "limit_id"=>"临时关系ID",
- 'limit_price' => "临时绑定关系订单佣金",
- 'is_send_limit' => "是否发放临时关系佣金"
- ];
- }
- public function getOrderPospalDetail()
- {
- return $this->hasMany(OrderPospalDetail::className(), ['order_id' => 'id'])->alias('od')
- ->leftJoin(['g' => Goods::tableName()], 'g.id=od.goods_id')->select(['od.*', 'g.name', 'g.attr goods_attr', 'g.cost_price']);
- }
- public function getDetail()
- {
- return $this->hasMany(OrderPospalDetail::className(), ['order_id' => 'id']);
- }
- public function getGoods()
- {
- return $this->hasMany(Goods::className(), ['id' => 'goods_id'])->alias('g')
- ->viaTable(OrderPospalDetail::tableName() . ' od', ['order_id' => 'id']);
- }
- public function getShop()
- {
- return $this->hasOne(Shop::className(), ['id' => 'shop_id']);
- }
- public function getClerk()
- {
- return $this->hasOne(User::className(), ['id' => 'clerk_id']);
- }
- public function getOrderForm()
- {
- return $this->hasMany(OrderForm::className(), ['order_id' => 'id'])->where(['is_delete' => 0]);
- }
- public function getUser()
- {
- return $this->hasOne(User::className(), ['id' => 'user_id']);
- }
- public function getRefund()
- {
- return $this->hasMany(OrderRefund::className(), ['order_id' => 'id']);
- }
- public function beforeSave($insert)
- {
- $this->content = \yii\helpers\Html::encode($this->content);
- return parent::beforeSave($insert);
- }
- public function getPondDetail()
- {
- return $this->hasOne(OrderPospalDetail::className(), ['order_id' => 'id']);
- }
- public function getPondGoods()
- {
- return $this->hasOne(Goods::className(), ['id' => 'goods_id'])->alias('g')
- ->viaTable(OrderPospalDetail::tableName() . ' od', ['order_id' => 'id']);
- }
- public function getReceiver(){
- return $this->hasOne(SharingReceiver::className(),['order_no'=>'order_no']);
- }
- public function getStore(){
- return $this->hasOne(Store::className(),['id'=>'store_id']);
- }
- }
|