SendOrder.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%send_order}}".
  6. *
  7. * @property integer $id
  8. * @property string $name
  9. * @property string $tel
  10. * @property string $house_name
  11. * @property string $province
  12. * @property string $city
  13. * @property integer $budget
  14. * @property integer $source
  15. * @property string $remark
  16. * @property integer $status
  17. * @property integer $c_time
  18. */
  19. class SendOrder extends \yii\db\ActiveRecord
  20. {
  21. /**
  22. * @inheritdoc
  23. */
  24. const STATUS_YES = 10;//已派单
  25. const STATUS_NO = 1;//待派单
  26. const SOURCE_NET = 1 ;//网络订单
  27. const SOURCE_400 = 10 ;//400订单
  28. const SOURCE_LINE = 20 ;//线下订单
  29. const SOURCE_CHANNEL = 30 ;//渠道订单
  30. /**
  31. * @return array
  32. * 预算数组
  33. */
  34. public static function budget_list()
  35. {
  36. return [5=>"3万以下",10=>'3-8万',15=>"8-12万",20=>"12-30万",25=>"30-50万",30=>"50万以上",35=>"具体面议"];
  37. }
  38. /**
  39. * @return array
  40. * 订单来源数组
  41. */
  42. public static function source_list()
  43. {
  44. return [self::SOURCE_NET=>"网络订单",self::SOURCE_400=>'400订单',self::SOURCE_LINE=>"线下订单",self::SOURCE_CHANNEL=>"渠道订单"];
  45. }
  46. /**
  47. * @return array
  48. * 状态数组
  49. */
  50. public static function status_list()
  51. {
  52. return [self::STATUS_NO=>"待派单",self::STATUS_YES=>'已派单'];
  53. }
  54. public static function tableName()
  55. {
  56. return '{{%send_order}}';
  57. }
  58. /**
  59. * @inheritdoc
  60. */
  61. public function rules()
  62. {
  63. return [
  64. [['c_time'], 'default','value'=>time()],
  65. [['status'], 'default','value'=>self::STATUS_NO],
  66. [['name','tel','house_name','province','city','budget','source','status','c_time'], 'required'],
  67. [['name','tel','house_name'], 'string','max' => 32],
  68. [['remark'], 'string'],
  69. [['c_time', 'budget','status','source'], 'integer'],
  70. ];
  71. }
  72. /**
  73. * @inheritdoc
  74. */
  75. public function attributeLabels()
  76. {
  77. return [
  78. 'id' => 'ID',
  79. 'name' => '业主姓名',
  80. 'tel' => '电话号码',
  81. 'house_name' => '小区名称',
  82. 'province' => '省编号',
  83. 'city' => '市编号',
  84. 'budget' => '预算',
  85. 'source' => '来源',
  86. 'remark' => '备注',
  87. 'status' => '状态',
  88. 'c_time' => '创建时间',
  89. ];
  90. }
  91. }