| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace addons\CardSecret\common\models;
- use Yii;
- /**
- * This is the model class for table "{{%addons_CardSecret_import_log}}".
- *
- * @property int $id
- * @property int|null $cate_id 卡密分类ID
- * @property int $mall_id 商城ID
- * @property string $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是正常,-1是删除
- * @property int $created_at 创建时间
- * @property int $updated_at 修改时间
- * @property int $export_status 0是正在处理中,1是导入完成
- */
- class CardSecretImportLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_card_secret_import_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['cate_id', 'mall_id', 'operator_id', 'export_count', 'export_success_count', 'export_fail_count', 'status', 'created_at', 'updated_at', 'export_status'], 'integer'],
- [['file'], 'string', 'max' => 200],
- [['operator_name'], 'string', 'max' => 100],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'cate_id' => '卡密分类ID',
- 'mall_id' => '商城ID',
- 'file' => '导入文件路径',
- 'operator_name' => '操作人昵称',
- 'operator_id' => '操作人ID',
- 'export_count' => '总导入数量',
- 'export_success_count' => '导入成功数量',
- 'export_fail_count' => '导入失败数量',
- 'status' => '0是禁用,1是正常,-1是删除',
- 'created_at' => '创建时间',
- 'updated_at' => '修改时间',
- 'export_status' => '0是正在处理中,1是导入完成',
- ];
- }
- /**
- * @Author: ltm
- * @DateTime: 2022/5/6 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;
- }
- }
- }
|