| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- namespace common\models\platform;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "qimall_platform_order".
- *
- *
- * @property int $id 订单id
- * @property int $order_id 订单id
- * @property string $order_no 订单编号
- * @property string|null $out_trade_no 系统支付流水号
- * @property string $title 订单标题
- * @property string $cover 订单封面
- * @property int $consumer_id 消费者ID
- * @property string|null $consumer_name 消费者名称
- * @property string $consumer_type 消费者类型[mall=商城,agent=代理商]
- * @property float|null $pay_money 订单实付金额,单位:元
- * @property float|null $order_price 订单价格,单位:元
- * @property int|null $order_status 订单状态
- * @property int|null $payment_type 支付方式[1=微信,2=支付宝]
- * @property int|null $pay_time 订单付款时间
- * @property int|null $expire_time 订单过期时间
- * @property int|null $pay_status 订单付款状态[0=未支付,1=已支付]
- * @property string $source_table 来源表
- * @property int|null $settlement_status 结算状态[0=待结算,1=已结算]
- * @property string|null $extra_info 额外信息
- * @property int|null $status 状态[-1:删除;0:禁用;1启用]
- * @property int|null $created_at 创建时间
- * @property int|null $updated_at 更新时间
- * @property int|null $from_type 来源类型
- */
- class PlatformOrder extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_platform_order';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['order_id', 'consumer_id', 'order_status', 'payment_type', 'pay_status', 'pay_time', 'expire_time', 'settlement_status', 'status', 'created_at', 'updated_at'], 'integer'],
- [['pay_money', 'order_price'], 'number'],
- [['extra_info'], 'string'],
- [['order_no', 'out_trade_no', 'title'], 'string', 'max' => 100],
- [['cover', 'consumer_name','from_type'], 'string', 'max' => 255],
- [['consumer_type'], 'string', 'max' => 20],
- [['source_table'], 'string', 'max' => 200],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => '订单id',
- 'order_id' => '订单id',
- 'order_no' => '订单编号',
- 'out_trade_no' => '系统支付流水号',
- 'title' => '订单标题',
- 'cover' => '订单封面',
- 'consumer_id' => '消费者ID',
- 'consumer_name' => '消费者名称',
- 'consumer_type' => '消费者类型[mall=商城,agent=代理商]',
- 'pay_money' => '订单实付金额,单位:元',
- 'order_price' => '订单价格,单位:元',
- 'order_status' => '订单状态',
- 'payment_type' => '支付方式[1=微信,2=支付宝]',
- 'pay_status' => '订单付款状态[0=未支付,1=已支付]',
- 'pay_time' => '订单付款时间',
- 'expire_time' => '订单过期时间',
- 'source_table' => '来源表',
- 'settlement_status' => '结算状态[0=待结算,1=已结算]',
- 'extra_info' => '额外信息',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- 'from_type' => '来源类型',
- ];
- }
- /**
- * 保存数据
- * @Author: lun
- * @DateTime: 2022/3/3 0003 17:24
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $params
- * @return bool|PlatformOrder
- */
- public static function setData($params)
- {
- try {
- if (!empty($params['id'])) {
- $model = self::findOne(['id' => $params['id']]);
- } else {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (empty($model)) throw new Exception('查无此订单');
- if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
- return $model;
- } catch (\Exception $e) {
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|