|
@@ -32,7 +32,8 @@ class Greet extends Api
|
|
|
$where['user_id'] = $this->auth->id;
|
|
|
$greet = Db::name('user_greet_content')->where($where)->orderRaw('rand()')->find();
|
|
|
if(empty($greet)){
|
|
|
- $this->error('先设置打招呼内容吧');
|
|
|
+ $this->add_girl_greet($this->auth->id);
|
|
|
+ $greet = Db::name('user_greet_content')->where($where)->orderRaw('rand()')->find();
|
|
|
}
|
|
|
if(!empty($greet) && $greet['type'] != 0){
|
|
|
$greet['content'] = one_domain_image($greet['content']);
|
|
@@ -74,6 +75,37 @@ class Greet extends Api
|
|
|
$this->success('操作成功', $rs);
|
|
|
}
|
|
|
|
|
|
+ private function add_girl_greet($user_id){
|
|
|
+ $girl_greet = [
|
|
|
+ [
|
|
|
+ 'user_id' => $user_id,
|
|
|
+ 'title' => '默认',
|
|
|
+ 'content' => '你好,想认识你,可以聊聊吗?',
|
|
|
+ 'is_default' => 1,
|
|
|
+ 'createtime' => time(),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'user_id' => $user_id,
|
|
|
+ 'title' => '默认',
|
|
|
+ 'content' => '听说主动打招呼的人运气都不会太差,所以我来试试!',
|
|
|
+ 'createtime' => time(),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'user_id' => $user_id,
|
|
|
+ 'title' => '默认',
|
|
|
+ 'content' => '嗨!看到你的资料觉得挺有意思的,认识一下?',
|
|
|
+ 'createtime' => time(),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'user_id' => $user_id,
|
|
|
+ 'title' => '默认',
|
|
|
+ 'content' => '我猜你收到很多消息,但我的这条一定最特别!',
|
|
|
+ 'createtime' => time(),
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ Db::name('user_greet_content')->insertAll($girl_greet);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function freegreetnum() {
|
|
|
$user = $this->auth->getUser();
|