|
@@ -4,6 +4,8 @@
|
|
namespace app\api\controller;
|
|
namespace app\api\controller;
|
|
|
|
|
|
use AlibabaCloud\DBFS\V20200418\DbfsRecord;
|
|
use AlibabaCloud\DBFS\V20200418\DbfsRecord;
|
|
|
|
+use app\admin\controller\Auth;
|
|
|
|
+use app\admin\controller\Auth as Au;
|
|
use app\common\model\Article;
|
|
use app\common\model\Article;
|
|
use app\common\model\ArticleCate;
|
|
use app\common\model\ArticleCate;
|
|
use app\common\model\GoodsCate;
|
|
use app\common\model\GoodsCate;
|
|
@@ -14,17 +16,25 @@ use app\common\model\Banner;
|
|
use app\common\model\User;
|
|
use app\common\model\User;
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
use app\common\model\UserForm;
|
|
use app\common\model\UserForm;
|
|
|
|
+use app\data\model\DataXw;
|
|
use app\store\controller\Video;
|
|
use app\store\controller\Video;
|
|
|
|
+use Carbon\Carbon;
|
|
|
|
+use think\console\command\Make;
|
|
use think\Exception;
|
|
use think\Exception;
|
|
use think\facade\Validate;
|
|
use think\facade\Validate;
|
|
use think\Db;
|
|
use think\Db;
|
|
-
|
|
|
|
|
|
+use think\admin\Controller;
|
|
|
|
+use think\Request;
|
|
/**
|
|
/**
|
|
* @title 首页
|
|
* @title 首页
|
|
* @controller Index
|
|
* @controller Index
|
|
*/
|
|
*/
|
|
class Index extends Api
|
|
class Index extends Api
|
|
{
|
|
{
|
|
|
|
+ const C = [
|
|
|
|
+ 'uid.request' => '父级评论id不能为空',
|
|
|
|
+// 'zid'
|
|
|
|
+ ];
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -268,6 +278,7 @@ class Index extends Api
|
|
* 智能匹配
|
|
* 智能匹配
|
|
*/
|
|
*/
|
|
public function Intelligent(){
|
|
public function Intelligent(){
|
|
|
|
+
|
|
$user_id = $this->check_login();;
|
|
$user_id = $this->check_login();;
|
|
$data = input();
|
|
$data = input();
|
|
$sex = Db::name('store_member')->where('id',$user_id)->value('sex');
|
|
$sex = Db::name('store_member')->where('id',$user_id)->value('sex');
|
|
@@ -277,6 +288,25 @@ class Index extends Api
|
|
else{
|
|
else{
|
|
$p_sex = 1;
|
|
$p_sex = 1;
|
|
}
|
|
}
|
|
|
|
+ switch ($data['income']){
|
|
|
|
+ case 1:
|
|
|
|
+ $data['income_min'] = 3000;
|
|
|
|
+ $data['income_max'] = 6000;
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ $data['income_min'] = 6000;
|
|
|
|
+ $data['income_max'] = 10000;
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ $data['income_min'] = 10000;
|
|
|
|
+ $data['income_max'] = "不限";
|
|
|
|
+ break;
|
|
|
|
+ case 4:
|
|
|
|
+ $data['income_min'] = '不限';
|
|
|
|
+ $data['income_max'] = "不限";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
$add_data=[
|
|
$add_data=[
|
|
'age'=>$data['age_min'].'-'.$data['age_max'],
|
|
'age'=>$data['age_min'].'-'.$data['age_max'],
|
|
'education'=>$data['education'],
|
|
'education'=>$data['education'],
|
|
@@ -289,11 +319,21 @@ class Index extends Api
|
|
$where = [];
|
|
$where = [];
|
|
if($data['age_min']&&$data['age_max']&&$data['nature']&&$data['education']&&$data['height_min']&&$data['height_max']&&$data['income_min']&&$data['income_max']&&$data['area_id']){
|
|
if($data['age_min']&&$data['age_max']&&$data['nature']&&$data['education']&&$data['height_min']&&$data['height_max']&&$data['income_min']&&$data['income_max']&&$data['area_id']){
|
|
$where[] = ['age','between',[$data['age_min'],$data['age_max']]];
|
|
$where[] = ['age','between',[$data['age_min'],$data['age_max']]];
|
|
- $where[] = ['nature','=',$data['nature']];
|
|
|
|
- $where[] = ['education','=',$data['education']];
|
|
|
|
- $where[] = ['height','between',[$data['height_min'],$data['height_max']]];
|
|
|
|
- $where[] = ['income','between',[$data['income_min'],$data['income_max']]];
|
|
|
|
- $where[] = ['area_id','=',$data['area_id']];
|
|
|
|
|
|
+ if($data['nature'] != '不限')$where[] = ['nature','=',$data['nature']];
|
|
|
|
+ if($data['nature'] != '不限')$where[] = ['education','=',$data['education']];
|
|
|
|
+ if($data['height_min'] != '不限' && $data['height_max'] != '不限'){
|
|
|
|
+ $where[] = ['height','between',[$data['height_min'],$data['height_max']]];
|
|
|
|
+ }elseif ($data['height_min'] == '不限' && $data['height_max'] != '不限'){
|
|
|
|
+ $where[] = ['height','<',$data['height_max']];
|
|
|
|
+ }elseif ($data['height_max'] == '不限' && $data['height_min'] != '不限'){
|
|
|
|
+ $where[] = ['height','>',$data['height_min']];
|
|
|
|
+ }
|
|
|
|
+ if($data['income_min'] != '不限' && $data['income_max'] != '不限'){
|
|
|
|
+ $where[] = ['income','between',[$data['income_min'],$data['income_max']]];
|
|
|
|
+ }else if($data['income_max'] == '不限'){
|
|
|
|
+ $where[] = ['income','>',$data['income_min']];
|
|
|
|
+ }
|
|
|
|
+ if($data['area_id'] != '不限')$where[] = ['area_id','=',$data['area_id']];
|
|
$member = Db::name('store_member')
|
|
$member = Db::name('store_member')
|
|
->where('sex',$p_sex)
|
|
->where('sex',$p_sex)
|
|
->where('is_deleted',1)
|
|
->where('is_deleted',1)
|
|
@@ -682,20 +722,32 @@ class Index extends Api
|
|
}
|
|
}
|
|
$this->success('推荐会员',$list);
|
|
$this->success('推荐会员',$list);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @Title('推荐会员')
|
|
|
|
+ * @param $user_id
|
|
|
|
+ * @param $p_sex
|
|
|
|
+ * @return void
|
|
|
|
+ * @throws Exception
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
+ */
|
|
public function save_recommend($user_id,$p_sex)
|
|
public function save_recommend($user_id,$p_sex)
|
|
{
|
|
{
|
|
$data = Db::name('store_member_appeals')->where('mid', $user_id)->find();
|
|
$data = Db::name('store_member_appeals')->where('mid', $user_id)->find();
|
|
if ($data) {
|
|
if ($data) {
|
|
$education = json_decode(education($data['education']));
|
|
$education = json_decode(education($data['education']));
|
|
$education = implode(',',$education);
|
|
$education = implode(',',$education);
|
|
- $height_a = $data['height']-2;
|
|
|
|
- $height_b = $data['height']+2;
|
|
|
|
|
|
+ $height_a = $data['height']-5;
|
|
|
|
+ $height_b = $data['height']+5;
|
|
$where[] = ['age', 'between', [$data['age_min'], $data['age_max']]];
|
|
$where[] = ['age', 'between', [$data['age_min'], $data['age_max']]];
|
|
- $where[] = ['education', 'in', $education];
|
|
|
|
- $where[] = ['weight', '<', $data['weight']];
|
|
|
|
|
|
+ if($education != '不限')$where[] = ['education', 'in', $education];
|
|
|
|
+ $where[] = ['weight', '<=', $data['weight']+10];
|
|
$where[] = ['height', 'between', [$height_a, $height_b]];
|
|
$where[] = ['height', 'between', [$height_a, $height_b]];
|
|
- $where[] = ['income', '>=', $data['income']];
|
|
|
|
- $where[] = ['area_id', '=', $data['area_id']];
|
|
|
|
|
|
+ $where[] = ['income', '>=', $data['income']-500];
|
|
|
|
+ $where[] = ['city_id', '=', $data['city_id']];
|
|
$member = Db::name('store_member')
|
|
$member = Db::name('store_member')
|
|
->where('sex', $p_sex)
|
|
->where('sex', $p_sex)
|
|
->where('is_deleted', 1)
|
|
->where('is_deleted', 1)
|
|
@@ -721,21 +773,21 @@ class Index extends Api
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public function notice1(){
|
|
public function notice1(){
|
|
- $user_id = 43;
|
|
|
|
- $p_sex = 1;
|
|
|
|
|
|
+ $user_id = 11366;
|
|
|
|
+ $p_sex = 2;
|
|
|
|
|
|
$data = Db::name('store_member_appeals')->where('mid', $user_id)->find();
|
|
$data = Db::name('store_member_appeals')->where('mid', $user_id)->find();
|
|
if ($data) {
|
|
if ($data) {
|
|
$education = json_decode(education($data['education']));
|
|
$education = json_decode(education($data['education']));
|
|
$education = implode(',',$education);
|
|
$education = implode(',',$education);
|
|
- $height_a = $data['height']-2;
|
|
|
|
- $height_b = $data['height']+2;
|
|
|
|
|
|
+ $height_a = $data['height']-5;
|
|
|
|
+ $height_b = $data['height']+5;
|
|
$where[] = ['age', 'between', [$data['age_min'], $data['age_max']]];
|
|
$where[] = ['age', 'between', [$data['age_min'], $data['age_max']]];
|
|
$where[] = ['education', 'in', $education];
|
|
$where[] = ['education', 'in', $education];
|
|
- $where[] = ['weight', '<', $data['weight']];
|
|
|
|
|
|
+ $where[] = ['weight', '<=', $data['weight']+10];
|
|
$where[] = ['height', 'between', [$height_a, $height_b]];
|
|
$where[] = ['height', 'between', [$height_a, $height_b]];
|
|
- $where[] = ['income', '>=', $data['income']];
|
|
|
|
- $where[] = ['area_id', '=', $data['area_id']];
|
|
|
|
|
|
+ $where[] = ['income', '>=', $data['income']-500];
|
|
|
|
+ $where[] = ['city_id', '=', $data['city_id']];
|
|
$member = Db::name('store_member')
|
|
$member = Db::name('store_member')
|
|
->where('sex', $p_sex)
|
|
->where('sex', $p_sex)
|
|
->where('is_deleted', 1)
|
|
->where('is_deleted', 1)
|
|
@@ -760,4 +812,70 @@ class Index extends Api
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @爱情加油站评论功能
|
|
|
|
+ */
|
|
|
|
+ public function comment(Request $request){
|
|
|
|
+ $id = $this->check_login();
|
|
|
|
+ if(!$request->ispost())$this->error('请求错误');
|
|
|
|
+ if(input('type') == 1){
|
|
|
|
+ //父级评论
|
|
|
|
+ if(!input('articleid') || !input('content')){
|
|
|
|
+ $this->error('参数缺失');
|
|
|
|
+ }else{
|
|
|
|
+ Db::name('store_article_class')->where('id',input('articleid'))->findOrFail();
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ try{
|
|
|
|
+ $comment = Db::name('store_article_comment')->insertGetId(['uid' => $id, 'articleid' => input('articleid'), 'content' => input('content'),'create_time'=>date('Y-m-d H:i:s')]);
|
|
|
|
+ Db::commit();
|
|
|
|
+ $this->success('评论成功',$comment);
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ $this->error($e);
|
|
|
|
+ Db::rollback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else if(input('type') == 2){
|
|
|
|
+ //子级评论
|
|
|
|
+ if(!input('uid') || !input('uid') || !input('articleid') || !input('content')){
|
|
|
|
+ $this->error('参数缺失');
|
|
|
|
+ }else{
|
|
|
|
+ Db::name('store_article_class')->where('id',input('articleid'))->findOrFail();
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ try{
|
|
|
|
+ $comment = Db::name('store_article_comment')->insertGetId(['uid' => input('uid'),'zid' => $id, 'articleid' => input('articleid'), 'content' => input('content'),'create_time'=>date('Y-m-d H:i:s')]);
|
|
|
|
+ Db::commit();
|
|
|
|
+ $this->success('评论成功',$comment);
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ $this->error($e);
|
|
|
|
+ Db::rollback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @爱情加油站评论列表
|
|
|
|
+ */
|
|
|
|
+ public function comment_list(Request $request){
|
|
|
|
+ if(!$request->ispost())$this->error('请求错误');
|
|
|
|
+ $page_num = input('page_num',5);
|
|
|
|
+ $page = input('page',1);
|
|
|
|
+ $articleid = input('id');
|
|
|
|
+ if(!$articleid)$this->error('参数缺失');
|
|
|
|
+ $where = [
|
|
|
|
+ 'articleid' => $articleid,
|
|
|
|
+ 'status' => 1,
|
|
|
|
+ 'audit' => 1
|
|
|
|
+ ];
|
|
|
|
+ if(input('type') == 1){
|
|
|
|
+ $data = Db::name('store_article_comment')->where($where)->where('zid',0)->paginate($page_num,'',['page'=>$page]);;
|
|
|
|
+ $this->success('请求成功',$data);
|
|
|
|
+ }else if(input('type') == 2){
|
|
|
|
+ $uid = input('uid');
|
|
|
|
+ if(!$uid)$this->error('参数缺失');
|
|
|
|
+ $data = Db::name('store_article_comment')->where($where)->where('zid','<>','0')->where('uid',$uid)->paginate($page_num,'',['page'=>$page]);;
|
|
|
|
+ $this->success('请求成功',$data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|