CloudStockEarlyWarningLog.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace addons\CloudStock\common\models;
  3. use common\models\base\BaseActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_cloud_stock_early_warning_log".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城ID
  10. * @property int $user_id 会员id
  11. * @property int $goods_id 导入的商品的id
  12. * @property int $status
  13. * @property int $updated_at
  14. * @property int $created_at 添加时间
  15. */
  16. class CloudStockEarlyWarningLog extends BaseActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return '{{%addons_cloud_stock_early_warning_log}}';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['mall_id', 'user_id', 'goods_id', 'status', 'updated_at', 'created_at'], 'integer'],
  32. ];
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function attributeLabels()
  38. {
  39. return [
  40. 'id' => 'ID',
  41. 'mall_id' => 'Mall ID',
  42. 'user_id' => 'User ID',
  43. 'goods_id' => 'Goods ID',
  44. 'status' => 'Status',
  45. 'updated_at' => 'Updated At',
  46. 'created_at' => 'Created At',
  47. ];
  48. }
  49. public static function setData(array $params)
  50. {
  51. try {
  52. $model = new self();
  53. $model->loadDefaultValues();
  54. if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage());
  55. return true;
  56. } catch (\Exception $e) {
  57. self::$static_error = $e->getMessage();
  58. return false;
  59. }
  60. }
  61. }