| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace addons\Store\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- use Exception;
- /**
- * This is the model class for table "qimall_addons_store_reserve_technician_scheduling_time".
- *
- * @property int $id id
- * @property int $mall_id 商城id
- * @property int|null $user_id user_id
- * @property int|null $store_id 门店id
- * @property int|null $sid 排期id
- * @property int|null $start_time 开始时间
- * @property int|null $end_time 结束时间
- * @property int $status 状态(-1:删除,0:禁用,1:启用)
- * @property int|null $created_at 创建时间
- * @property int|null $updated_at 修改时间
- */
- class StoreReserveTechnicianSchedulingTime extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_store_reserve_technician_scheduling_time}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id'], 'required'],
- [['mall_id', 'store_id','user_id', 'sid', 'start_time', 'end_time', 'status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'user_id' => 'User ID',
- 'store_id' => 'store_id',
- 'sid' => 'Sid',
- 'start_time' => 'Start Time',
- 'end_time' => 'End Time',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public static function setData($params)
- {
- try {
- if (!empty($params['id'])) {
- $model = self::find()->where(['id' => $params['id']])->one();
- if (empty($model)) throw new Exception('数据不存在');
- } 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;
- }
- }
- public static function getDataOne($params, $select = "*", $orderBy = 'id desc')
- {
- return self::find()->where($params)->select($select)->orderBy($orderBy)->asArray()->one();
- }
- public static function getDataAll($params, $select = "*", $orderBy = 'id desc')
- {
- return self::find()->where($params)->select($select)->orderBy($orderBy)->asArray()->all();
- }
- }
|