Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

105 строки
2.4 KiB

  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "base_category".
  6. *
  7. * @property integer $category_id
  8. * @property string $category_name
  9. * @property integer $parent_id
  10. * @property integer $delete_flag
  11. * @property string $create_time
  12. * @property string $update_time
  13. * @property string $update_user
  14. */
  15. class BaseCategory extends \yii\db\ActiveRecord
  16. {
  17. /**
  18. * @inheritdoc
  19. */
  20. public static function tableName()
  21. {
  22. return 'base_category';
  23. }
  24. /**
  25. * @inheritdoc
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['category_name'], 'required'],
  31. [['parent_id', 'delete_flag'], 'integer'],
  32. [['create_time', 'update_time'], 'safe'],
  33. [['category_name'], 'string', 'max' => 255],
  34. [['update_user'], 'string', 'max' => 50],
  35. ];
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'category_id' => 'Category ID',
  44. 'category_name' => 'Category Name',
  45. 'parent_id' => 'Parent ID',
  46. 'delete_flag' => 'Delete Flag',
  47. 'create_time' => 'Create Time',
  48. 'update_time' => 'Update Time',
  49. 'update_user' => 'Update User',
  50. ];
  51. }
  52. /**
  53. * Function Description:获取基础数组信息
  54. * Function Name: getTypeArr
  55. *
  56. * @return array|\yii\db\ActiveRecord[]
  57. *
  58. * @author 娄梦宁
  59. */
  60. public function getTypeArr(){
  61. $result=$this::find()->select(['category_id','category_name'])
  62. ->from(self::tableName())
  63. ->where(['=','delete_flag',0])
  64. ->asArray()
  65. ->all();
  66. return $result;
  67. }
  68. /**
  69. * Des:获取
  70. * Name: getAllList
  71. * @return array|\yii\db\ActiveRecord[]
  72. * @author 倪宗锋
  73. */
  74. public function getAllList()
  75. {
  76. $result = self::find()
  77. ->from(self::tableName())
  78. ->asArray()
  79. ->all();
  80. return $result;
  81. }
  82. /**
  83. * Des:获取页面展示的订单类型
  84. * Name: getShowList
  85. * @return array
  86. * @author 倪宗锋
  87. */
  88. public function getShowList()
  89. {
  90. $result = self::find()->select(['category_id as order_type_id','category_name as order_type_des'])
  91. ->from(self::tableName())
  92. ->asArray()
  93. ->all();
  94. return $result;
  95. }
  96. }