更新Index

This commit is contained in:
wangxiaowei 2024-07-26 10:45:36 +08:00
parent 81a913f2a3
commit 0b1ede276f
2 changed files with 85 additions and 16 deletions

@ -10,6 +10,7 @@ use app\common\model\user\User;
use app\common\model\user\UserAuth; use app\common\model\user\UserAuth;
use app\common\server\JsonServer; use app\common\server\JsonServer;
use weixin\Getopenid; use weixin\Getopenid;
use think\facade\Db;
class Index extends Api class Index extends Api
{ {
public $like_not_need_login = ['index', 'indexCategory', 'config','copyright','city','geocoder']; public $like_not_need_login = ['index', 'indexCategory', 'config','copyright','city','geocoder'];
@ -17,34 +18,56 @@ class Index extends Api
// 首页 // 首页
public function index() public function index()
{ {
$terminal = $this->request->get('terminal', 'nmp'); $terminal = $this->request->get('terminal', 'nmp');
$city = $this->request->get('city_id', ''); $city = $this->request->get('city_id', '');
$p_id = $this->request->get('p_id',0); $p_id = $this->request->get('p_id',0);
$set_id = $this->request->get('set',0); $set_id = $this->request->get('set',0);
$firend_invite_code = $this->request->get('firend_invite_code',0); // $firend_invite_code = $this->request->get('firend_invite_code',0);
$invite_code = $this->request->get('invite_code',0); $code = $this->request->get('code');
if(isset($invite_code)){ $invite_code = $this->request->get('invite_code');
if($invite_code != 0){
$firend_invite_code = $invite_code; // file_put_contents('log.txt', '1invite_code= ' . $invite_code . '; code='. $code);
} // die;
} // echo $code;
$code = $this->request->get('code',0); // echo $invite_code;
// Log::record('测试日志信息');
// trace('invite_code', $invite_code.'-'.$code);
// $data = $this->request->param();
// echo $data;die;
// if(isset($invite_code)){
// if($invite_code != 0){
// $firend_invite_code = $invite_code;
// }
// }
$open=new Getopenid(); $open=new Getopenid();
$info=$open->getAcc($code); $info=$open->getAcc($code);
if(isset($info['openid'])) { if(isset($info['openid'])) {
$openid = $info['openid']; $openid = $info['openid'];
$user_msg = UserAuth::where("openid",$openid)->find(); $user_msg = UserAuth::where("openid",$openid)->find();
$firend_msg = User::where("distribution_code",$firend_invite_code)->find(); $firend_msg = User::where("distribution_code",$invite_code)->find();
if($user_msg==null){ if($user_msg==null){
$divide_role_user_id = 0;
$firend_id = 0;
$is_d = Db::name("distribution")->where('user_id', $firend_msg['id'] )->where('is_distribution', 1 )->find();
if($is_d != null){
$firend_id = $firend_msg['id'];
if($firend_msg['first_leader'] !=0){
$divide_role_user_id = $firend_msg['first_leader'];
}else{
$divide_role_user_id = $firend_id;
}
}
$data = [ $data = [
'sn' => create_user_sn(), 'sn' => create_user_sn(),
'create_time' => time(), 'create_time' => time(),
"first_leader" => $firend_msg['id'], "first_leader" => $firend_id,
'distribution_code' => generate_invite_code(),//分销邀请码 'distribution_code' => generate_invite_code(),//分销邀请码
'is_distribution' => DistributionLogic::isDistributionMember(), 'is_distribution' => DistributionLogic::isDistributionMember(),
'client' => 1, 'client' => 1,
'is_new_user' => 1, 'is_new_user' => 1,
'user_ad_cret' => 1 'user_ad_cret' => 1,
'divide_role_user_id' => $divide_role_user_id
]; ];
$user = User::create($data); $user = User::create($data);
$user_id = $user->id; $user_id = $user->id;
@ -54,6 +77,13 @@ class Index extends Api
"create_time"=>time(), "create_time"=>time(),
"client"=>1 "client"=>1
]); ]);
if($is_d != null){
$firend_id = $firend_msg['id'];
$dat['f_user_id'] = $firend_id;
$dat['user_id'] = $user_id;
$dat['ditme'] = date("Y-m-d H:i:s");
Db::name("user_firster")->save($dat);
}
//生成会员分销扩展表 //生成会员分销扩展表
DistributionLogic::createUserDistribution($user_id); DistributionLogic::createUserDistribution($user_id);
@ -149,4 +179,31 @@ class Index extends Api
} }
return JsonServer::success('',$result); return JsonServer::success('',$result);
} }
// 控制显示本地生活
public function setHome(){
$arr = array(
array(
"image"=>'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/store_manager.png',
"name"=>'商家信息',
"is_tab"=> 0,
"link"=>'/bundle_b/pages/local_shop/local_shop',
"link_type"=>1,
"is_set"=>0
),
array(
"image"=>'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bundle_b/local_shop/store_settled.png',
"name"=>'商家入驻',
"is_tab"=> 0,
"link"=>'/bundle_b/pages/local_settled/index',
"link_type"=>1,
"is_set"=>0
)
);
return JsonServer::success('查询成功', $arr);
// return JsonServer::success('查询成功', []);
}
} }

@ -216,6 +216,20 @@ class IndexLogic extends Logic
// 附近店铺 // 附近店铺
$nearbyShops = empty($city) ? [] : self::getNearbyShops($city); $nearbyShops = empty($city) ? [] : self::getNearbyShops($city);
// 商城快讯
$mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select();
foreach ($mall_news as &$v) {
if (isset($v['files'])) {
foreach ($v['files'] as &$v1) {
if ($v['type'] == 0) {
$v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']);
} else {
$v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src'];
}
}
}
}
return [ return [
'headlines' => $headlines, 'headlines' => $headlines,
'hots' => $hots, 'hots' => $hots,
@ -226,7 +240,9 @@ class IndexLogic extends Logic
'seckill_goods' => $seckillGoods, 'seckill_goods' => $seckillGoods,
'community_article' => $communityArticle, 'community_article' => $communityArticle,
'nearby_shops' => $nearbyShops, 'nearby_shops' => $nearbyShops,
'set_price_type'=>$set_price_type 'set_price_type'=>$set_price_type,
// 'mall_news' => [],
'mall_news' => $mall_news,
]; ];
} }
@ -782,9 +798,6 @@ class IndexLogic extends Logic
$center_top_bg = UrlServer::getFileUrl($center_top_bg); $center_top_bg = UrlServer::getFileUrl($center_top_bg);
} }
// 商城快讯
$mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select();
$config = [ $config = [
'shop_hide_goods' => ConfigServer::get('decoration', 'shop_hide_goods', 0), //商品详细是否显示店铺 'shop_hide_goods' => ConfigServer::get('decoration', 'shop_hide_goods', 0), //商品详细是否显示店铺
'shop_street_hide' => ConfigServer::get('decoration', 'shop_street_hide', 0), //是否显示店铺街 'shop_street_hide' => ConfigServer::get('decoration', 'shop_street_hide', 0), //是否显示店铺街
@ -810,7 +823,6 @@ class IndexLogic extends Logic
'android_download' => ConfigServer::get('app', 'line_android', ''),//安卓下载链接 'android_download' => ConfigServer::get('app', 'line_android', ''),//安卓下载链接
'download_doc' => ConfigServer::get('app', 'download_doc', ''),//app下载文案 'download_doc' => ConfigServer::get('app', 'download_doc', ''),//app下载文案
'cate_style' => ConfigServer::get('decoration', 'layout_no', 1),//分类页面风格 'cate_style' => ConfigServer::get('decoration', 'layout_no', 1),//分类页面风格
'mall_news' => $mall_news,
'show_mall_news' => true, 'show_mall_news' => true,
'index_setting' => [ // 首页设置 'index_setting' => [ // 首页设置
// 热销榜单 // 热销榜单