Files
2024-09-27 01:32:49 +08:00

355 lines
14 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use app\common\service\ActivityService;
use think\Exception;
use think\Db;
class IndexController extends CommonController
{
// protected $noAuth = ['index','article','submitSuggestion'];
/**
* @apiDefine Index 首页
*/
/**
* @apiVersion 1.0.0
* @api {post} /index/index 1.大首页(朱晓伟)
* @apiName index
* @apiGroup Index
* @apiHeader {String} authentication 验证
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"banner": [
{
"id": 1,
"app_pic_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/app_pic_url_1547692989524.svg"
},
{
"id": 2,
"app_pic_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/app_pic_url_1547693022342.svg"
},
{
"id": 3,
"app_pic_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/app_pic_url_1547689859579.svg"
}
],
"article": [
{
"id": 13,
"description": ""
}
],
"activity_icons": [
{
"id": 13,
"activity_name": "高毛专区",
"activity_belong": 2,
"activity_type": 1,
"is_self": 0,
"cover_img": "",
"goods_list": []
},
{
"id": 14,
"activity_name": "新品上架",
"activity_belong": 2,
"activity_type": 1,
"is_self": 0,
"cover_img": "",
"goods_list": []
},
{
"id": 15,
"activity_name": "热销专区",
"activity_belong": 2,
"activity_type": 1,
"is_self": 0,
"cover_img": "",
"goods_list": []
},
{
"id": 16,
"activity_name": "近期特价",
"activity_belong": 2,
"activity_type": 1,
"is_self": 0,
"cover_img": "",
"goods_list": []
}
],
"activity_self_true": [
{
"id": 10,
"activity_name": "新人优惠",
"activity_belong": 2,
"activity_type": 2,
"is_self": 1,
"cover_img": "",
"goods_list": {
"total": 3,
"per_page": 6,
"current_page": 1,
"last_page": 1,
"data": [
{
"goods_id": 1767,
"name": "复古糖片新药特制",
"spec_desc": "16粒*4板",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 0,
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1568019676054.png",
"supplier_name": "安徽金壶医药",
"manufacturer_name": "安国市天下康制药有限公司",
"batch_number": "2019090705",
"retail_flag": 0,
"batch_type": 1,
"cost_price": "27.1123",
"stock_num": 625,
"gba_id": 12129,
"is_onshelf": 0,
"area_id": 0,
"price": "45.0000",
"platform_royalty": "0.1001",
"discount_price": null,
"discount_num": null,
"sort": 0
},
{
"goods_id": 1762,
"name": "测试新增加的新药品",
"spec_desc": "16粒*4板",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 0,
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1567763448346.png",
"supplier_name": "安徽金壶医药",
"manufacturer_name": "安徽新产地医药公司",
"batch_number": "2019090601",
"retail_flag": 1,
"batch_type": 0,
"cost_price": "30.8000",
"stock_num": 2500,
"gba_id": 12120,
"is_onshelf": 0,
"area_id": 0,
"price": "37.5000",
"platform_royalty": "0.1000",
"discount_price": null,
"discount_num": null,
"sort": 0
},
{
"goods_id": 1759,
"name": "111111yetete",
"spec_desc": "0.5*16",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 0,
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1567754815655.png",
"supplier_name": "安徽金壶医药",
"manufacturer_name": "安国市天下康制药有限公司",
"batch_number": "2019090501",
"retail_flag": 1,
"batch_type": 0,
"cost_price": "20.6000",
"stock_num": 5000,
"gba_id": 12115,
"is_onshelf": 0,
"area_id": 0,
"price": "24.9000",
"platform_royalty": "0.2000",
"discount_price": null,
"discount_num": null,
"sort": 0
}
]
}
}
],
"activity_self_false": [
{
"id": 11,
"activity_name": "热门推荐",
"activity_belong": 2,
"activity_type": 2,
"is_self": 0,
"cover_img": "",
"goods_list": []
},
{
"id": 12,
"activity_name": "秒杀活动",
"activity_belong": 2,
"activity_type": 2,
"is_self": 0,
"cover_img": "",
"goods_list": []
}
]
}
}
*/
public function index() {
try{
$user_info = $this->getUserInfo();
//广告
$_field = "id,app_pic_url,app_controller_name";
$data['banner'] = Db::name('active_info')->field($_field)->where('app_show_status',1)->order('app_show_order','desc')->limit(3)->select();
//文章
$id = Db::name('articles_type')->where('nid','app')->value('id');
$data['article'] = [];
if ($id) {
$_field = "a.id,a.description";
$_order = "a.show_order desc";
$_where_string = 'FIND_IN_SET('.$id.', a.type_id)';
$data['article'] = Db::name('articles')->alias('a')->field($_field)->where($_where_string)->order($_order)->select();
}
//栏目
$parames['activity_belong'] = 2;
$parames['activity_type'] = 1;
$data['activity_icons'] = model(ActivityService::class)->getActivityList($user_info,$parames);
//楼层
$parames['activity_type'] = 2;
$parames['is_self'] = 1;
$data['activity_self_true'] = model(ActivityService::class)->getActivityList($user_info,$parames);
//楼层
$parames['activity_type'] = 2;
$parames['is_self'] = 0;
$data['activity_self_false'] = model(ActivityService::class)->getActivityList($user_info,$parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
/**
* @apiVersion 1.0.0
* @api {post} /index/article 2.文章详情(朱晓伟)
* @apiName article
* @apiGroup Index
* @apiHeader {String} authentication 验证
* @apiParam {Int} id 文章id
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"article": {
"id": 13,
"name": "公司介绍",
"type_id": "2,9,17",
"status": 1,
"show_order": 12,
"add_time": "2018-11-08 17:14:18",
"username": "admin",
"description": "",
"contents": "&lt;p&gt;\n\t&lt;span style=&quot;font-size:16px;&quot;&gt;&lt;/span&gt; \n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height:27.75pt;&quot;&gt;\n\t&lt;br /&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height:27.75pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;&quot;&gt;&lt;strong&gt;医点医滴简介&lt;/strong&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;医点医滴成立于&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;2014&lt;/span&gt;&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;年&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;7月隶属于安徽金壶医药有限公司是海量用户正在使用的医药平台具有国家食品药品监督管理局颁发《互联网药品信息服务许可证》的合法网上第三方交易平台为广大上下游客户提供一站式购药的便捷体验。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;医点医滴始终致力于用互联网的思维方式,切入信息和药品领域,解决上游供应商和下游采购商信息不对等的问题,为社会创造更大的价值。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;依托安徽金壶医药智能供应链、大数据和自有的医药供销体系的优势,医点医滴在平台运营、产品采购、供应链管理、医药服务、顾客体验、仓储配送等各方面构筑起了核心竞争力。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;凭借源头采药和网上电商的独特资源、平台优势,医点医滴竭诚让利顾客,同样的药品质量保证,更低廉的销售价格,吸引了越来越多的采购商网上购药。通过与医药厂商直供合作,医点医滴在供应链管理上减少中间环节,实现了高效、透明的管理模式,同时为广大顾客带来正品保证,安全保障。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;目前,医点医滴已与拜耳、辉瑞、礼来、阿斯利康、同仁堂、东阿阿胶、强生安视优、白云山、汇仁药业、碧生源、斯利安药业等国内外数百家医药厂商建立了长期合作关系,为顾客提供涵盖中西药品、中药保健、医疗器械等多个品类的数十万种医药健康产品。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;依托优质的第三方&lt;/span&gt;&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;仓储布局&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;, 医点医滴为广大顾客提供更为快捷的配送方式和体验,建立了覆盖全国范围的配送服务。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height:27.75pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;&quot;&gt;&lt;strong&gt;金壶医药简介&lt;/strong&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;金壶医药由王玉龙先生&lt;/span&gt;&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;创建,致力于用互联网模式和思维方式,改变中国药商&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;&quot;销售难、采购贵&quot;的现状。金壶医药运用创新的互联网和IT技术提供在线咨询和购药等服务缩减中间环节优化供应链为中国药商的供货采购提供完整的解决方案以及实惠和方便。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:36pt;&quot;&gt;\n\t&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;金壶医药旗下拥有:&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;B2B&lt;/span&gt;&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;医药平台&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;&quot;医点医滴&quot;、太和办事处、阜阳办事处&lt;/span&gt;&lt;span style=&quot;font-family:微软雅黑;font-size:16px;line-height:2;&quot;&gt;,通过创新的&lt;/span&gt;&lt;span style=&quot;font-size:16px;line-height:2;&quot;&gt;B2B的模式全面实现B端线上和线下、自营和平台、商和药的融合发展打造中国以科技驱动的线上线下有机融合的医药健康平台为医生、药店、医院、药企、药品流通商赋能。&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;\n&lt;/p&gt;\n&lt;p&gt;\n\t&lt;br /&gt;\n&lt;/p&gt;\n&lt;p style=&quot;text-align:center;&quot;&gt;\n\t&lt;br /&gt;\n&lt;/p&gt;"
}
}
}
*/
public function article() {
try{
$parames = input('');
if(!isset($parames['id']) || !$parames['id']){
return self::returnMsg(self::ERR_EMPTY_PARAM, self::getMessage('ERR_EMPTY_PARAM'));
}
$_admin_join = "admin_user b";
$_admin_join_on = "a.publish_user_id = b.admin_user_id";
$_field = "a.id,a.name,a.type_id,a.status,a.show_order,a.add_time,b.username,a.description,a.contents";
$data['article'] = Db::name('articles')->alias('a')->field($_field)->where('id',$parames['id'])->join($_admin_join,$_admin_join_on,"LEFT")->find();
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
/**
* @apiVersion 1.0.0
* @api {post} /index/submitSuggestion 3.意见反馈(李程)
* @apiName submitSuggestion
* @apiGroup Index
* @apiHeader {String} authentication 验证
* @apiParam {Int} status 状态1返回选择框的内容2提交所以数据
* @apiParam {Int} phone 手机号
* @apiParam {String} type 建议类型
* @apiParam {String} suggestion_content 建议内容
* @apiParam {String} pic_url 图片路径 json
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"errcode": 0,
"errmsg": "提交成功"
}
}
*/
public function submitSuggestion()
{
try {
$parames = input('');
if ($parames['status'] == 1) {
$data = initSysConstant();
$tmp = $data["SUGGESTION_TYPE"];
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $tmp);
} elseif ($parames['status'] == 2) {
$parames['uid'] = $this->uid;
$parames['phone'] = $this->clientInfo['phone'];
$data = model('Index', 'service')->submitSuggestion($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}
} catch (Exception $exception) {
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
/**
* @apiVersion 1.0.0
* @api {post} /index/custOmer 4.查看客服(李程)
* @apiName custOmer
* @apiGroup Index
* @apiHeader {String} authentication 验证
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"nickname": "李峰",
"mobile": "18756027162"
}
}
*/
public function custOmer(){
try {
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model('Index', 'service')->custOmer($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
}