|
@@ -29,10 +29,20 @@ class Greet extends Api
|
|
$this->success(1,$list);
|
|
$this->success(1,$list);
|
|
}
|
|
}
|
|
|
|
|
|
- //我的打招呼列表
|
|
|
|
|
|
+ //我的打招呼列表,自己看所有的
|
|
public function get_greet(){
|
|
public function get_greet(){
|
|
$type = input('type',1);
|
|
$type = input('type',1);
|
|
|
|
|
|
|
|
+ $list = Db::name('user_greet')->where('user_id',$this->auth->id)->where('type',$type)->select();
|
|
|
|
+ $list = list_domain_image($list,['image']);
|
|
|
|
+
|
|
|
|
+ $this->success(1,$list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //我的打招呼列表,对外的已过审的
|
|
|
|
+ public function get_greet_checked(){
|
|
|
|
+ $type = input('type',1);
|
|
|
|
+
|
|
$list = Db::name('user_greet')->where('user_id',$this->auth->id)->where('type',$type)->where('status',1)->select();
|
|
$list = Db::name('user_greet')->where('user_id',$this->auth->id)->where('type',$type)->where('status',1)->select();
|
|
$list = list_domain_image($list,['image']);
|
|
$list = list_domain_image($list,['image']);
|
|
|
|
|
|
@@ -41,6 +51,14 @@ class Greet extends Api
|
|
|
|
|
|
//添加打招呼
|
|
//添加打招呼
|
|
public function add_greet(){
|
|
public function add_greet(){
|
|
|
|
+
|
|
|
|
+ if($this->auth->gender == 1 && $this->auth->idcard_status != 1){
|
|
|
|
+ $this->error('请先完成实名认证');
|
|
|
|
+ }
|
|
|
|
+ if($this->auth->gender == 0 && $this->auth->real_status != 1){
|
|
|
|
+ $this->error('请先完成真人认证');
|
|
|
|
+ }
|
|
|
|
+
|
|
$type = input('type',1);
|
|
$type = input('type',1);
|
|
$title = input('title','');
|
|
$title = input('title','');
|
|
$image = input('image','');
|
|
$image = input('image','');
|
|
@@ -73,30 +91,44 @@ class Greet extends Api
|
|
$this->success();
|
|
$this->success();
|
|
}
|
|
}
|
|
|
|
|
|
- //女性打个招呼
|
|
|
|
|
|
+ //一键搭讪
|
|
public function once_greet(){
|
|
public function once_greet(){
|
|
|
|
|
|
- $type1 = Db::name('user_greet')->where('user_id',$this->auth->id)->where('status',1)->where('type',1)->orderRaw('rand()')->find();
|
|
|
|
|
|
+ if($this->auth->gender == 1){
|
|
|
|
+
|
|
|
|
+ $today = strtotime(date('Y-m-d'));
|
|
|
|
+ $end = $today + 86399;
|
|
|
|
+ $apiLimitTime = $end - time();
|
|
|
|
|
|
|
|
+ $times = config('site.man_dashan_times') ?: 50;
|
|
|
|
+ $rs = $this->apiLimit($times,$apiLimitTime*1000);
|
|
|
|
+ if(!$rs){
|
|
|
|
+ $this->error('今日搭讪次数已用完');
|
|
|
|
+ }
|
|
|
|
|
|
- $type2 = Db::name('user_greet')->where('user_id',$this->auth->id)->where('status',1)->where('type',2)->orderRaw('rand()')->find();
|
|
|
|
- $type2 = info_domain_image($type2,['image']);
|
|
|
|
|
|
|
|
- $result = [
|
|
|
|
- 'chat' => !empty($type1) ? $type1['title'] : '',
|
|
|
|
- 'image' => !empty($type2) ? $type2['image'] : '',
|
|
|
|
- ];
|
|
|
|
|
|
+ $where['gender'] = ['IN',[1,2]];
|
|
|
|
+ $chat = Db::name('greet_sys')->field('id,title')->where($where)->orderRaw('rand()')->find();
|
|
|
|
+ $result = [
|
|
|
|
+ 'chat' => !empty($chat) ? $chat['title'] : '',
|
|
|
|
+ 'image' => '',
|
|
|
|
+ ];
|
|
|
|
|
|
- if($this->auth->gender == 1){
|
|
|
|
- $result['image'] = '';
|
|
|
|
- }
|
|
|
|
|
|
+ }else{
|
|
|
|
+ $type1 = Db::name('user_greet')->where('user_id',$this->auth->id)->where('status',1)->where('type',1)->orderRaw('rand()')->find();
|
|
|
|
|
|
- $this->success(1,$result);
|
|
|
|
- }
|
|
|
|
|
|
+ $type2 = Db::name('user_greet')->where('user_id',$this->auth->id)->where('status',1)->where('type',2)->orderRaw('rand()')->find();
|
|
|
|
+ $type2 = info_domain_image($type2,['image']);
|
|
|
|
+
|
|
|
|
+ $result = [
|
|
|
|
+ 'chat' => !empty($type1) ? $type1['title'] : '',
|
|
|
|
+ 'image' => !empty($type2) ? $type2['image'] : '',
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- //首页一键搭讪
|
|
|
|
- public function onekey_greet(){
|
|
|
|
|
|
|
|
|
|
+ $this->success(1,$result);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|