where("template_name",$name)->value("template_id"); $temp = MinAppTemplateMessage::select('template_id','is_open','title')->where('template_id',$corres_id)->where("small_type",1)->where('is_default',1)->first(); $this->temp_id = empty($temp['template_id']) ? 0 : $temp['template_id']; $this->temp_open = empty($temp['is_open']) ? 0 : $temp['is_open']; $this->temp_title = empty($temp['title']) ? "" : $temp['title'].'-'; } public function checkDataLength($str,$length) { if (mb_strlen($str,'utf8') > $length) { return mb_substr($str,0,$length,'utf8'); } return $str; } }