32], [['idcard_front', 'idcard_back', 'address', 'check_remark'], 'string', 'max' => 255], [['longitude', 'latitude'], 'string', 'max' => 64], [['name'], 'string', 'max' => 100], [['mobile'], 'string', 'max' => 16], [['desc'], 'string', 'max' => 500], [['avatar','province','city','district'], 'string', 'max' => 255], [['commission', 'service_rating', 'store_lng', 'store_lat','store_service_rating'],'number'], [['qualification_certificate'], 'string'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'user_id' => '用户ID', 'level' => '等级', 'idcard' => '身份证', 'idcard_front' => '身份证正面', 'idcard_back' => '身份证反面', 'address' => '地址', 'longitude' => '经度', 'latitude' => '纬度', 'name' => '姓名', 'mobile' => '手机号', 'qualification_certificate' => '资格证书', 'status' => '状态;1正常,0禁用,-1删除', 'check_status' => '审核状态:0:待审核;1:已通过;2:未通过', 'check_remark' => '审核备注', 'commission' => '佣金', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public function getLevel() { return $this->hasOne(ReservationServiceLevel::class, ['level' => 'level'])->where(['status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); } public function getStore() { return $this->hasOne(Store::class, ['id' => 'store_id']); } public static function getDataOne($params = [], $select = '*', $orderBy = 'id desc') { return self::find()->where($params)->select($select)->orderBy($orderBy)->asArray()->one(); } public static function getDataAll($params = [], $select = '*', $orderBy = 'id desc') { return self::find()->where($params)->select($select)->orderBy($orderBy)->indexBy('id')->asArray()->all(); } /** * @Description: 保存数据 * @Author: zsan * @DateTime 2023-10-09 10:39:20 * @param array $params * @return self|bool */ public static function setData(array $params) { try { if (!empty($params['id'])) { $model = self::findOne(['and', ['id' => $params['id'], 'mall_id' => $params['mall_id']], ['<>', 'status', StatusEnum::DELETE]]); if (empty($model)) throw new \Exception('技师不存在或已删除'); } else { $model = self::findOne(['user_id' => $params['user_id'], 'mall_id' => $params['mall_id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if (empty($model)) { $model = new self(); $model->loadDefaultValues(); $model->mall_id = $params['mall_id']; } } if (!$model->load($params, '') || !$model->save()) { throw new \Exception($model->getErrorMessage()); } return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }