123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- namespace common\models;
- use common\models\User;
- use Yii;
- /**
- * This is the model class for table "{{%appointment}}".
- *
- * @property string $id
- * @property integer $uid
- * @property integer $type
- * @property integer $pid
- * @property integer $created_at
- * @property integer $booking_time
- * @property integer $updated_at
- * @property string $applicant_tel
- * @property string $applicant_name
- * @property integer $status
- * @property integer $state
- * @property string $remark
- * @property integer $handle
- */
- class Appointment extends \yii\db\ActiveRecord
- {
- const STATUS_DELETE = 0;//删除或取消
- const STATUS_DEAL = 10;//发布
- const STATE_YTAY = 0;//待处理
- const STATE_YES = 10;//已处理
- const TYPE_SITE = 1;//工地类型
- const TYPE_HOUSE = 2;//样板房类型
- const HANDLE_YES = 10;//后台已处理
- const HANDLE_NO = 0;//后台未处理
- const WARNING_TEXT ="您还不是豪省心的会员,无法查看业主联系方式,请联系平台客服<a href='tel:15985837914'>15985837914</a>开通会员";
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%appointment}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['uid', 'type', 'pid', 'created_at', 'booking_time', 'updated_at', 'status'], 'required'],
- [['uid', 'type', 'pid', 'created_at', 'booking_time', 'updated_at', 'status', 'state','handle'], 'integer'],
- [['applicant_tel', 'applicant_name'], 'string', 'max' => 32],
- [['remark'], 'string', 'max' => 255],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'uid' => '预约人',
- 'type' => '类型',
- 'pid' => '工地编号',
- 'created_at' => '创建时间',
- 'booking_time' => '预定时间',
- 'updated_at' => '最后修改时间',
- 'applicant_tel' => '联系电话',
- 'applicant_name' => '联系名称',
- 'status' => '状态',
- 'state' => '流程进度',
- 'remark' => '备注信息',
- 'handle' => '后台回访',
- ];
- }
- //样板房或工地
- public function getBuilding(){
- return $this->hasOne(Building::className(),['id'=>'pid']);
- }
- //预约的人
- public function getUser(){
- return $this->hasOne(User::className(),['id'=>'uid']);
- }
- //预约的人
- public function getUserinfo(){
- return $this->hasOne(UserInfo::className(),['uid'=>'uid']);
- }
- /**
- * 回访记录
- */
- public function getVisit()
- {
- return $this->hasMany(AppointmentVisit::className(),['aid'=>'id']);
- }
- static function telPreg($tel)
- {
- if(empty($tel))
- return $tel;
- return preg_replace("/(1\d{1,3})\d\d\d\d\d(\d{3,4})/", "\$1*****\$2", $tel);
- }
- }
|