| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace addons\Happiness\common\models;
- use common\enums\StatusEnum;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_happiness_voucher_order".
- *
- * @property int $id
- * @property string|null $order_no 提货批次
- * @property int|null $total_num 总提货数量
- * @property int|null $leave_num 剩余提货数量
- * @property string|null $user_name 提货人
- * @property string|null $mobile 提货人手机号
- * @property string|null $address 提货地址
- * @property int|null $order_status 提货状态 0未审核,1已审核 2 部分发货 3已全部发货 4 已拒绝
- * @property int|null $status
- * @property string|null $remark 备注
- * @property int|null $mall_id
- * @property int|null $created_at
- * @property int|null $updated_at
- */
- class HappinessVoucherOrder extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_happiness_voucher_order';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['total_num', 'leave_num', 'status', 'mall_id','store_id', 'created_at', 'updated_at', 'order_status'], 'integer'],
- [['user_name', 'mobile', 'address','order_no','remark'], 'string', 'max' => 255]
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'order_no' => 'Order No',
- 'total_num' => 'Total Num',
- 'leave_num' => 'Leave Num',
- 'user_name' => 'User Name',
- 'mobile' => 'Mobile',
- 'address' => 'Address',
- 'order_status' => 'Order Status',
- 'status' => 'Status',
- 'mall_id' => 'Mall ID',
- 'remark' => 'Remark',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public function getStore()
- {
- return $this->hasOne(HappinessStore::className(), ['id' => 'store_id']);
- }
- public function getGoods()
- {
- return $this->hasMany(HappinessVoucherGoods::className(), ['order_id' => 'id']);
- }
- public static function setData(array $params)
- {
- try {
- if(isset($params['id']) && !empty($params['id']))
- $model = self::findOne($params['id']);
- else {
- $model = new self();
- $model->loadDefaultValues();
- }
- if(!$model)
- {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (!$model->load($params, '') || !$model->save()) {
- throw new \Exception($model->getErrorMessage());
- }
- return $model;
- } catch (\Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|