| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace addons\Happiness\common\models;
- use addons\StarChain\common\models\GoodsAttr;
- use common\models\goods\Goods;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_happiness_move_item".
- *
- * @property int $id
- * @property int $goods_id 商品ID
- * @property int $store_id 小店ID
- * @property int $order_status 状态:0待调货,1 已调货 2已拒绝
- * @property int $total_num 总数量
- * @property int $total_price 总金额
- * @property int $status
- * @property int $created_at
- * @property int $updated_at
- * @property int $agent_user 审核代理用户ID
- * @property int $give_store_id 赠送的店ID
- * @property int $mall_id
- * @property int $label_id 标签ID
- * @property string $remark
- */
- class HappinessMoveItem extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_happiness_move_item';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['goods_id', 'store_id', 'order_status', 'status', 'total_num', 'created_at', 'updated_at', 'agent_user',
- 'mall_id', 'label_id', 'give_store_id'], 'integer'],
- [['total_price'], 'number'],
- [['remark'], 'string'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'goods_id' => 'Goods ID',
- 'store_id' => 'Store ID',
- 'order_status' => 'Order Status',
- 'status' => 'Status',
- 'total_num' => 'Total Num',
- 'total_price' => 'Total Price',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'agent_user' => 'Agent User',
- 'give_store_id' => 'Give Store ID',
- 'mall_id' => 'Mall ID',
- 'label_id' => 'Label ID',
- 'remark' => 'Remark',
- ];
- }
- public function getGoods()
- {
- return $this->hasMany(HappinessMoveGoods::class, ['move_id' => 'id']);
- }
- public function getMallGood()
- {
- return $this->hasOne(Goods::class, ['id' => 'goods_id']);
- }
- public function getStore()
- {
- return $this->hasOne(HappinessStore::class, ['id' => 'store_id']);
- }
- public function getGiveStore()
- {
- return $this->hasOne(HappinessStore::class, ['id' => 'give_store_id']);
- }
- public static function setData($params)
- {
- try {
- if (isset($params['id']) && !empty($params['id']))
- $model = self::findOne($params['id']);
- else {
- $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;
- }
- }
- }
|