OrderAchievementGoods.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace common\models\order;
  3. use Exception;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_order_achievement_goods".
  7. *
  8. * @property int $id
  9. * @property int $order_id 订单id
  10. * @property string|null $goods_ids 订单满足业绩的商品
  11. * @property int $created_at
  12. * @property int $updated_at
  13. */
  14. class OrderAchievementGoods extends \common\models\base\BaseActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return 'qimall_order_achievement_goods';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['user_id', 'mall_id', 'order_id', 'created_at', 'updated_at'], 'integer'],
  30. [['goods_ids', 'order_details_ids'], 'safe'],
  31. ];
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => 'ID',
  40. 'order_id' => 'Order ID',
  41. 'goods_ids' => 'Goods Ids',
  42. 'created_at' => 'Created At',
  43. 'updated_at' => 'Updated At',
  44. ];
  45. }
  46. public static function setData(array $params)
  47. {
  48. try {
  49. $model = new self();
  50. $model->loadDefaultValues();
  51. if (!$model->load($params, '') || !$model->save()) {
  52. throw new Exception($model->getErrorMessage());
  53. }
  54. return $model;
  55. } catch (\Exception $e) {
  56. self::setStaticError($e->getMessage());
  57. return false;
  58. }
  59. }
  60. }