| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace addons\Happiness\common\models;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_happiness_voucher_goods".
- *
- * @property int $id
- * @property int $order_id 提货订单ID
- * @property int $goods_id 商品ID
- * @property int $attr_id 规格ID
- * @property int $num 提货数量
- * @property int $leave_num 剩余提货数量
- * @property int $mall_id 商城ID
- * @property float|null voucher 提货券
- * @property int|null label_id 提货类别
- * @property int $status
- * @property int $created_at
- * @property int $updated_at
- */
- class HappinessVoucherGoods extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_happiness_voucher_goods';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['order_id', 'goods_id', 'attr_id', 'num', 'leave_num', 'mall_id','label_id', 'status', 'created_at', 'updated_at'], 'integer'],
- [['voucher'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'order_id' => 'Order ID',
- 'goods_id' => 'Goods ID',
- 'attr_id' => 'Attr ID',
- 'num' => 'Num',
- 'leave_num' => 'Leave Num',
- 'mall_id' => 'Mall ID',
- 'status' => 'Status',
- 'voucher' => 'Voucher',
- 'label_id' => 'Label ID',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- 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;
- }
- }
- }
|