QiShangTongGoodsAttr.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace addons\QiShangTong\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "qimall_addons_qi_shang_tong_goods_attr".
  6. *
  7. * @property int $id ID
  8. * @property int $mall_id 商城ID
  9. * @property int $created_at 创建时间
  10. * @property int $updated_at 更新时间
  11. * @property int $status 状态
  12. * @property int $goods_id 本地商品ID
  13. * @property int $third_goods_id 第三方商品ID
  14. * @property float $cost_price 供货价
  15. * @property float $price 零售价
  16. * @property float $original_price 划线价
  17. * @property float $third_price 划线价
  18. * @property float $gonghuojia 划线价
  19. * @property float $retail_price 划线价
  20. * @property int $third_spec_id 第三方规格ID
  21. * @property int $goods_attr_id 本地商品规格ID
  22. * @property string $sign_id 本地唯一值
  23. */
  24. class QiShangTongGoodsAttr extends \common\models\base\BaseActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return 'qimall_addons_qi_shang_tong_goods_attr';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['mall_id', 'created_at', 'updated_at', 'status', 'goods_id', 'third_goods_id', 'third_spec_id', 'goods_attr_id'], 'integer'],
  40. [['cost_price', 'price', 'original_price', 'retail_price', 'gonghuojia', 'third_price'], 'number'],
  41. [['sign_id'], 'string', 'max' => 50],
  42. ];
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'id' => 'ID',
  51. 'mall_id' => 'Mall ID',
  52. 'created_at' => 'Created At',
  53. 'updated_at' => 'Updated At',
  54. 'status' => 'Status',
  55. 'goods_id' => 'Goods ID',
  56. 'third_goods_id' => 'Third Goods ID',
  57. 'cost_price' => 'Cost Price',
  58. 'price' => 'Price',
  59. 'original_price' => 'Original Price',
  60. 'third_spec_id' => 'Third Spec ID',
  61. 'goods_attr_id' => 'Goods Attr ID',
  62. 'sign_id' => 'Sign ID',
  63. ];
  64. }
  65. public static function setData(array $params)
  66. {
  67. $model = new self();
  68. $model->loadDefaultValues();
  69. $model->load($params, '');
  70. if (!$model->save()) throw new \Exception($model->getErrorMessage());
  71. }
  72. }