AgentTeamAchievementOrderLog.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace addons\Agent\common\models;
  3. use common\enums\StatusEnum;
  4. use common\models\base\BaseActiveRecord;
  5. use Yii;
  6. /**
  7. * This is the model class for table "qimall_addons_agent_team_achievement_order_log".
  8. *
  9. * @property int $id
  10. * @property int $mall_id 商城ID
  11. * @property string $order_no 订单编号
  12. * @property int $buy_user_id 购买者id
  13. * @property int $user_id 此订单计入给谁的个人业绩
  14. * @property int $settlement_type 结算类型:0:订单完成结算;1:按月结算
  15. * @property int $status 状态[-1:删除;0:禁用;1启用]
  16. * @property int $created_at 创建时间
  17. * @property int $updated_at 修改时间
  18. */
  19. class AgentTeamAchievementOrderLog extends BaseActiveRecord
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return '{{%addons_agent_team_achievement_order_log}}';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['mall_id', 'settlement_type', 'status', 'created_at', 'updated_at','buy_user_id','user_id'], 'integer'],
  35. [['order_no'], 'string', 'max' => 100],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'mall_id' => 'Mall ID',
  46. 'order_no' => 'Order No',
  47. 'settlement_type' => 'Settlement Type',
  48. 'status' => 'Status',
  49. 'created_at' => 'Created At',
  50. 'updated_at' => 'Updated At',
  51. ];
  52. }
  53. public static function setData($params)
  54. {
  55. try {
  56. $model = new self();
  57. $model->loadDefaultValues();
  58. if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage());
  59. return true;
  60. } catch (\Exception $e) {
  61. self::$static_error = $e->getMessage();
  62. return false;
  63. }
  64. }
  65. }