| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace addons\HandBouns\common\models;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "qimall_addons_hand_bouns".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property string $bouns_file 导入文件路径
- * @property string $operator_name 操作人昵称
- * @property int $operator_id 操作人ID
- * @property int $export_count 总导入数量
- * @property int $export_success_count 导入成功数量
- * @property int $export_fail_count 导入失败数量
- * @property int $status 0是禁用,1是导入成功,2是导入失败
- * @property int $created_at 创建时间
- * @property int $updated_at 修改时间
- * @property int $export_status 导出状态
- */
- class AddonsHandBouns extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_hand_bouns}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'operator_id', 'export_count', 'export_success_count', 'export_fail_count', 'export_status','status', 'created_at', 'updated_at'], 'integer'],
- [['bouns_file'], 'string', 'max' => 500],
- [['operator_name'], 'string', 'max' => 100],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'bouns_file' => '导入文件路径',
- 'operator_name' => '操作人昵称',
- 'operator_id' => '操作人ID',
- 'export_count' => '总导入数量',
- 'export_success_count' => '导入成功数量',
- 'export_fail_count' => '导入失败数量',
- 'status' => '0是禁用,1是导入成功,2是导入失败',
- 'export_status' => '导入状态,0是正在处理中,1是导入成功,2是导入失败',
- 'created_at' => '创建时间',
- 'updated_at' => '修改时间',
- ];
- }
- /**
- * @Author: ltm
- * @DateTime: 2022/3/7 0007 11:31
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $data
- * @return string
- */
- public static function setData(array $params){
- try{
- if (!empty($params['id'])) {
- $model = self::findOne(['id'=>$params['id'],'mall_id'=>$params['mall_id']]);
- if (empty($model)) throw new Exception('记录不存在或已删除');
- }else{
- $model = new self();
- $model->loadDefaultValues();
- }
- $model->mall_id = $params['mall_id'];
- if(!$model->load($params,'') || !$model->save()){
- throw new Exception($model->getErrorMessage());
- }
- return $model;
- }catch(\Exception $e){
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|