UpgradeType.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%UPGRADE_TYPE}}".
  6. *
  7. * @property string $ID
  8. * @property string $USER_ID 会员ID
  9. * @property int $TYPE 报单类型
  10. * @property string $INSERT_USER_ID 首购会员ID
  11. * @property string $DEC_AMOUNT 报单金额
  12. * @property string $DEC_PV 报单PV
  13. * @property int $PERIOD_NUM 报单期数
  14. * @property int $STATUS 状态
  15. * @property int $CREATED_AT 创建时间
  16. */
  17. class UpgradeType extends \common\components\ActiveRecord
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%UPGRADE_TYPE}}';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['OBSERVE_NAME', 'SORTS', 'IS_STATUS', 'NATION_ID','OBSERVE_TYPE','CREATE_AT'], 'required'],
  33. [['OBSERVE_TYPE', 'NATION_ID', 'IS_STATUS', 'CREATED_AT'], 'integer'],
  34. [['ID'], 'unique'],
  35. ];
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'ID' => 'ID',
  44. 'OBSERVE_NAME' => '升级方式名称',
  45. 'SORTS' => '排序',
  46. 'IS_STATUS' => '状态0为默认启用 1为禁用 ',
  47. 'NATION_ID' => '国家id',
  48. 'OBSERVE_TYPE' => '升级类型 1为补差额升级类型 2为全额升级类型',
  49. 'CREATE_AT' => '创建时间'
  50. ];
  51. }
  52. // 根据类型获取升级方式
  53. public static function getOneByType($type) {
  54. $result = UpgradeType::findOneAsArray('OBSERVE_TYPE=:OBSERVE_TYPE AND IS_STATUS=0', [':OBSERVE_TYPE'=>$type]);
  55. return $result;
  56. }
  57. }