540 lines
28 KiB
PHP
540 lines
28 KiB
PHP
<?php
|
||
namespace app\api\controller;
|
||
|
||
use app\common\service\OrderService;
|
||
use app\common\validate\goods\GoodsValidate;
|
||
use app\facade\AppConstant;
|
||
use think\Exception;
|
||
use think\facade\Cache;
|
||
use think\facade\Request;
|
||
use think\Controller;
|
||
|
||
/**
|
||
* Class GoodsController
|
||
* @package app\api\controller
|
||
*
|
||
* 暂不考虑商品信息、批次信息、价格信息分离
|
||
* @todo discount_num?活动库存?
|
||
* @todo 用户与商品关系,收藏、已购、申请采购权(预约、退换货…)等信息记录,列表or详情数据获取后统一处理
|
||
* @todo 控销商品处理
|
||
* @todo 流通商品信息更新?cli定时执行、特定业务操作执行更新
|
||
* @todo API应用or各业务模块涉及初始化操作梳理实现;初始化操作采用按需调用实现,不必全局默认初始化
|
||
*
|
||
* 搜索
|
||
* 名称/分类/
|
||
*
|
||
* @todo 优势+流通详情?
|
||
*
|
||
*/
|
||
class GoodsController extends CommonController{
|
||
// protected $noAuth = ['detail','search','goodsList','addCollect_App','Collectlsit','goodsRanking'];
|
||
protected $noAuth = [];
|
||
|
||
|
||
|
||
|
||
|
||
/**
|
||
* @apiDefine Goods 商品模块
|
||
*/
|
||
|
||
|
||
|
||
/**
|
||
* @apiVersion 1.0.0
|
||
* @api {post} /Goods/goodsList 1.商品列表(丁超)
|
||
* @apiName goodsList
|
||
* @apiGroup Goods
|
||
* @apiHeader {String} authentication 验证
|
||
* @apiParam {Int} [limit=20] 每页多少条(默认20)
|
||
* @apiParam {Int} [page=1] 当前页(默认1)
|
||
* @apiSuccessExample Success-Response:
|
||
*{
|
||
* "code": 200,
|
||
* "message": "成功",
|
||
* "data": {
|
||
* }
|
||
*
|
||
* @apiErrorExample Error-Respons:
|
||
* {
|
||
* "code": 500,
|
||
* "message": "fail",
|
||
* "data":{
|
||
* "info": "Err Msg",
|
||
* }
|
||
* }
|
||
*
|
||
*
|
||
*/
|
||
public function goodsList(){
|
||
//初始化相关验证放到基类执行
|
||
$param = input('param.');
|
||
$param['per_page'] = $param['limit']??20;
|
||
$param['current_page'] = $param['page']??1;
|
||
|
||
$data = model('Goods','service')->getGoodsList($param);
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||
}
|
||
|
||
|
||
/**
|
||
*
|
||
* @apiVersion 1.0.0
|
||
* @api {post} /Goods/search 2.商品搜索 (丁超)
|
||
* @apiName search
|
||
* @apiGroup Goods
|
||
* @apiParam {String} [search_words] 搜索关键词(默认按照药品名称搜索)
|
||
* @apiParam {Int} is_update_hy=0 是否更新hy商品(0-不更新,1-更新)
|
||
* @apiParam {Int} [cate_id] 分类id
|
||
* @apiParam {Int} [activity_id] 活动id
|
||
* @apiParam {Int=0,1} [retail_flag] 零整标志:0-零售,1-整件售
|
||
* @apiParam {String="default","sale","price","term_validity"} [sort_field="default"] 排序字段
|
||
* @apiParam {Int=0,1} [sort_order=0] 排序规则:0-升序,1-降序
|
||
* @apiParam {Int=0,1,2,3} [term_validity=2] 效期:0 半年以上,1 一年以上,2 所有,3 近效期(90天内)
|
||
*
|
||
* @apiParam {String="胶囊剂","颗粒剂","片剂","丸剂","注射剂","口服溶液剂","糖浆剂","软膏剂","乳膏剂","搽剂","洗剂","锭剂","口服液","合剂","干混悬剂","滴眼剂","外用滴剂","泡腾片","粉针剂,"溶媒结晶",粉针剂","酊剂","贴剂","消毒剂","贴膏剂","气雾剂"} [drug_form] 剂型
|
||
*
|
||
* @apiParam {String} [manufacturer] 生产厂家
|
||
* @apiParam {Number{0.0001-99999999.9999}} [price_start] 价格区间起点
|
||
* @apiParam {Number{0.0001-99999999.9999}} [price_end] 价格区间终点
|
||
*
|
||
* @apiSuccessExample Success-Response:
|
||
* {
|
||
"code": 200,
|
||
"msg": "success",
|
||
"data": {
|
||
"total": 68,
|
||
"per_page": 20,
|
||
"current_page": 1,
|
||
"last_page": 4,
|
||
"data": [
|
||
{
|
||
"price": "价格登录可见",
|
||
"goods_id": 1141,
|
||
"goods_name": "阿莫西林胶囊",
|
||
"show_price": "15.00",
|
||
"is_online_sale": 0,
|
||
"country_code": "H43022211",
|
||
"app_thumb": "",
|
||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1543656371912.jpg",
|
||
"drug_form": "胶囊剂",
|
||
"keyword": "阿莫西林胶囊",
|
||
"sketch": "阿莫西林适用于敏感菌(不产β内酰胺酶菌株)所致的感染",
|
||
"manufacturer_name": "湖南科伦制药有限公司",
|
||
"spec_desc": "0.25g*10s*5板",
|
||
"batch_type": 1,
|
||
"batch_id": 10018,
|
||
"retail_flag": 0,
|
||
"retail_num": 10,
|
||
"entirety_num": 400,
|
||
"batch_number": "G170695",
|
||
"stock_num": 180,
|
||
"term_validity": "2020-05-31",
|
||
"supplier_sn": "",
|
||
"sku_id": 10005,
|
||
"area_id": 0,
|
||
"price_type": 2
|
||
"is_buy": 1
|
||
},
|
||
…
|
||
]
|
||
},
|
||
"to_select": {
|
||
"manufacturer": [
|
||
"湖南科伦制药有限公司",
|
||
"中山市力恩普制药有限公司",
|
||
"石药集团中诺药业(石家庄)有限公司",
|
||
"葵花药业集团(衡水)得菲尔有限公司",
|
||
"黑龙江乌苏里江制药有限公司迎春分公司",
|
||
"山东益康药业股份有限公司",
|
||
"广州白云山医药集团股份有限公司白云山制药总厂",
|
||
"淮南泰复制药有限公司",
|
||
"南京臣功制药股份有限公司",
|
||
"吉林显锋科技制药有限公司",
|
||
"湖北唯森制药有限公司",
|
||
"重庆迪康长江制药有限公司",
|
||
"四川依科制药有限公司(原四川蜀中制药)",
|
||
"山东鲁抗医药股份有限公司",
|
||
"四川峨嵋山药业有限公司",
|
||
"华北制药股份有限公司",
|
||
"悦康药业集团有限公司",
|
||
"浙江亚太药业股份有限公司",
|
||
"昆明源瑞制药有限公司"
|
||
],
|
||
"drug_form": [
|
||
"胶囊剂",
|
||
"颗粒剂",
|
||
"散剂",
|
||
"干混悬剂",
|
||
"片剂"
|
||
],
|
||
"retail_flag": [
|
||
0,
|
||
1
|
||
],
|
||
"term_validity": [
|
||
2,
|
||
3,
|
||
1,
|
||
0
|
||
]
|
||
}
|
||
}
|
||
*
|
||
* @apiSuccess {Int=0,1} is_limit=0 是否限购(0-不限购,1-限购)
|
||
* @apiSuccess {String} limit_info 限购说明
|
||
* @apiSuccess {Int=0,1} is_buy=0 是否可以加购(0-不可以加购,1-可加入购购物车)
|
||
*
|
||
*/
|
||
public function search(GoodsValidate $validate){
|
||
|
||
try{
|
||
//系统自动执行权限验证
|
||
|
||
//参数验证
|
||
$validate->checkParam('goods_search');
|
||
|
||
//参数 search_words:名称/规格/厂家 组合;排序字段唯一;
|
||
$param = Request::only(['is_update_hy','search_words','sort_order','sort_field','cate_id','activity_id','manufacturer','retail_flag','drug_form','term_validity','price_start','price_end','current_page']);
|
||
|
||
$user_info = $this->getUserInfo();
|
||
$res = model('Goods','service')->getGoodsSearch($user_info,$param);
|
||
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$res);
|
||
}catch (Exception $e){
|
||
return self::returnMsg(self::ERR_NONE, $e->getMessage());
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
*
|
||
* @apiVersion 1.0.0
|
||
* @api {post} /Goods/detail 3.商品详情 (丁超)
|
||
* @apiName detail
|
||
* @apiGroup Goods
|
||
* @apiParam {Int} sku_id 价格id(price_id/gba_id/sku_id)
|
||
*
|
||
* @apiSuccessExample Success-Response:
|
||
* {
|
||
"code": 0,
|
||
"msg": "success",
|
||
"data": {
|
||
"goods_id": 758,
|
||
"goods_name": "芪参益气滴丸",
|
||
"pc_content": "<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t性状\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t本品为浅棕色至深棕色的滴丸;气微香,味微苦。\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="3"></a><a name="sub467272_3"></a><a name="功能主治"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t功能主治\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t益气通脉、活血止痛。用于气虚血瘀型胸痹,症见胸闷、胸痛,气短乏力、心悸、自汗、面色少华,舌体胖有齿痕、舌。质暗或紫暗或有瘀斑,脉沉或沉弦。冠心病、心绞痛见上述证候者。\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="4"></a><a name="sub467272_4"></a><a name="规格"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t规格\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t每袋装0.5g\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="5"></a><a name="sub467272_5"></a><a name="用法用量"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t用法用量\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t餐后半小时服用,一次1袋,一日3次,4周为一个疗程或遵医嘱。\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="6"></a><a name="sub467272_6"></a><a name="不良反应"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t不良反应\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t尚无明确不良反应。\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="7"></a><a name="sub467272_7"></a><a name="禁忌"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t禁忌\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t尚无明确禁忌。\n</div>\n<div class="anchor-list" style="position:relative;color:#333333;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t<a name="8"></a><a name="sub467272_8"></a><a name="孕妇及哺乳期妇女用药"></a> \n</div>\n<div class="para-title level-2" label-module="para-title" style="clear:both;zoom:1;overflow:hidden;border-left:12px solid #4F9CEE;line-height:24px;font-size:22px;font-family:&quot;margin:35px 0px 15px -30px;background:url(&quot;https://bkssl.bdimg.com/static/wiki-lemma/normal/resource/img/paraTitle-line_c5e6d61.png&quot;position:relative;color:#333333;white-space:normal;">\n\t<h2 class="title-text" style="margin:0px;padding:0px 8px 0px 18px;font-size:22px;color:#000000;float:left;line-height:24px;font-weight:400;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;">\n\t\t孕妇及哺乳期妇女用药\n\t</h2>\n</div>\n<div class="para" label-module="para" style="font-size:14px;color:#333333;margin-bottom:15px;text-indent:2em;line-height:24px;zoom:1;font-family:arial, 宋体, sans-serif;white-space:normal;background-color:#FFFFFF;">\n\t孕妇慎用。\n</div>",
|
||
"app_content": null,
|
||
"show_price": "28.80",
|
||
"is_online_sale": 0,
|
||
"country_code": "Z20030139",
|
||
"app_thumb": "",
|
||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1545031895782.jpg",
|
||
"drug_form": "滴丸剂",
|
||
"keyword": "芪参益气滴丸",
|
||
"sketch": "益气通脉、活血止痛",
|
||
"manufacturer_name": "天士力医药集团股份有限公司",
|
||
"spec_desc": "0.5g*15袋",
|
||
"batch_id": 16,
|
||
"batch_type": 1,
|
||
"retail_flag": 0,
|
||
"retail_num": 5,
|
||
"entirety_num": 300,
|
||
"batch_number": "180502",
|
||
"stock_num": 600,
|
||
"term_validity": "2021-03-01",
|
||
"supplier_sn": "",
|
||
"price_id": 10013,
|
||
"area_id": 0,
|
||
"price": "登录后查价",
|
||
"price_type": 0,
|
||
"discount_price": null,
|
||
"discount_num": 0,
|
||
"discount_start_time": null,
|
||
"discount_end_time": null,
|
||
"is_collect": 0
|
||
}
|
||
}
|
||
*
|
||
* @apiSuccess {Int=0,1} is_online_sale=0 网售类型:0-网售,1-非网售
|
||
* @apiSuccess {String} country_code 国药准字
|
||
* @apiSuccess {String} manufacturer_name 生产厂商
|
||
* @apiSuccess {String} spec_desc 规格描述
|
||
* @apiSuccess {String} pc_content PC端商品详情描述
|
||
* @apiSuccess {String} app_content APP端商品详情描述
|
||
* @apiSuccess {String} drug_form 剂型
|
||
* @apiSuccess {String} unit 单位
|
||
* @apiSuccess {String} max_purchase_period 限购周期
|
||
* @apiSuccess {String} max_purchase 限购数量
|
||
* @apiSuccess {Int=0,1} is_limit=0 是否限购(0-不限购,1-限购)
|
||
* @apiSuccess {String} [limit_info] 限购说明(示例:7天内限购500盒)
|
||
* @apiSuccess {String} prescribe_flag 是否为处方药,1:甲类非处方药(甲OTC),2:乙类非处方药(乙OTC),3:处方药,4:未分类
|
||
* @apiSuccess {String} batch_number 批号
|
||
* @apiSuccess {String} supplier_sn 供应商商品ID(流通商品)
|
||
* @apiSuccess {String} batch_id 批次id
|
||
* @apiSuccess {Int} retail_flag 零/整标志(0-零售,1-整件售)
|
||
* @apiSuccess {Int} retail_num 中包(零售类型的包装数量)
|
||
* @apiSuccess {Int} entirety_num 大包(整件售类型的包装数量)
|
||
* @apiSuccess {Int} stock_num 库存
|
||
* @apiSuccess {String} price 销售价
|
||
* @apiSuccess {Number} show_price 国规价,建议零售价
|
||
* @apiSuccess {String} sketch 商品简介
|
||
* @apiSuccess {Int} price_id 价格id(price_id/gba_id/sku_id)
|
||
* @apiSuccess {Int} price_type 价格类型。0:正常价格,1:近效特价,2:促销特价,3:新人特价
|
||
* @apiSuccess {String} term_validity 有效期
|
||
* @apiSuccess {String} discount_price 活动价
|
||
* @apiSuccess {String} discount_num 活动商品数量
|
||
* @apiSuccess {String} discount_start_time 活动开始时间
|
||
* @apiSuccess {String} discount_end_time 活动结束时间
|
||
* @apiSuccess {Int=0,1} is_collect=0 收藏状态:0-未收藏,1-已收藏
|
||
* @apiSuccess {Int=0,1} is_in_cart=0 购物车中是否已有该商品:0-没有,1-有
|
||
* @apiSuccess {Int=0,1} num_in_cart=0 购物车中该商品数量
|
||
* @apiSuccess {Int=-1,0,1,2} [purchase_right=1] 采购权(控销商品-1:未申请,1-申请中,2-通过,3-未通过,非控销默认有采购权)
|
||
* @apiSuccess {String} [purchase_right_remark] 采购权申请状态说明
|
||
* @apiSuccess {String} [purchase_right_verify_msg] 采购权审核记录
|
||
* @apiSuccess {Int=0,1} is_buy=0 是否可以加购(0-不可以加购,1-可加入购购物车)
|
||
*
|
||
*/
|
||
public function detail(GoodsValidate $validate){
|
||
try{
|
||
//场景名称,建议命名规范 控制器名称_方法名
|
||
$validate->checkParam('goods_detail');
|
||
$user_info = $this->getUserInfo();
|
||
$sku_id = input('param.sku_id');
|
||
$res = model('Goods','service')->getGoodsDetail($user_info,$sku_id);
|
||
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$res);
|
||
}catch (Exception $e){
|
||
return self::returnMsg(self::ERR_NONE,$e->getMessage());
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* 商品收藏
|
||
* @apiVersion 1.0.0
|
||
* @api {post} /Goods/addCollect_app 4.商品收藏(李程)
|
||
* @apiName addCollect_app
|
||
* @apiGroup Goods
|
||
* @apiHeader {String} authentication 验证
|
||
* @apiParam {Int} goods_id
|
||
* @apiParam {Int} status 1收藏 2.删除收藏
|
||
* @apiSuccessExample Success-Response:
|
||
*{"code":200,"message":"成功","data":{"errmsg":"添加收藏成功"}}
|
||
*/
|
||
public function addCollect_App(){
|
||
|
||
try {
|
||
$parames = $this->request->param('');
|
||
$uid = $this->uid;
|
||
$data = model('Goods','service')->addCollect_App($uid,$parames['goods_id'],$parames['status']);
|
||
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} /Goods/Collectlsit 2.商品收藏列表(李程)
|
||
* @apiName Collectlsit
|
||
* @apiGroup Goods
|
||
* @apiHeader {String} authentication 验证
|
||
* @apiSuccessExample Success-Response:
|
||
*{
|
||
"code": 200,
|
||
"message": "成功",
|
||
"data": {
|
||
"errmsg": "获取收藏商品列表成功",
|
||
"data": {
|
||
"list": [
|
||
{
|
||
"user_id": 404,
|
||
"goods_id": 5353,
|
||
"collect_time": "2020-04-16 15:43:49",
|
||
"name": "马应龙麝香痔疮膏",
|
||
"pinyin": "mayinglongshexiangzhichuanggao",
|
||
"sketch": "",
|
||
"spec_desc": "20g",
|
||
"status": 1,
|
||
"show_price": "17.70",
|
||
"pc_thumb": "www.hyey.cn/uploadpic/600/a0209/c522036/c522036_0.jpg",
|
||
"pc_gallery": "[]",
|
||
"pc_content": null,
|
||
"app_thumb": "",
|
||
"app_gallery": "[]",
|
||
"app_content": null,
|
||
"country_code": "Z42021920",
|
||
"drug_form": "软膏剂",
|
||
"factory_name": "马应龙药业集团股份有限公司"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
public function Collectlsit (){
|
||
try{
|
||
$parames = $this->request->param('');
|
||
$parames['user_id'] = $this->uid;
|
||
$data = model('Goods','service')->Collectlsit($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} /Goods/goodsRanking 5.热搜(李程)
|
||
* @apiName goodsRanking
|
||
* @apiGroup Goods
|
||
* @apiHeader {String} authentication 验证
|
||
* @apiSuccessExample Success-Response:
|
||
*{
|
||
"code": 200,
|
||
"message": "成功",
|
||
"data": [
|
||
{
|
||
"name": "碳酸钙D3片(II)(朗迪)",
|
||
"goods_id": "aaa0595b508016201803241"
|
||
},
|
||
{
|
||
"name": "防水创可贴",
|
||
"goods_id": "aaa1721g617022201810101"
|
||
},
|
||
{
|
||
"name": "大黄碳酸氢钠片",
|
||
"goods_id": "aaa0111d713009180115021"
|
||
},
|
||
{
|
||
"name": "布洛芬混悬液(迪尔诺)",
|
||
"goods_id": "aaa15604166011501180581"
|
||
},
|
||
{
|
||
"name": "左炔诺孕酮肠溶片",
|
||
"goods_id": "aaa0141g0680041708011"
|
||
},
|
||
{
|
||
"name": "通宣理肺颗粒",
|
||
"goods_id": "aaa1038d646033201811021"
|
||
},
|
||
{
|
||
"name": "杏苏止咳糖浆(套盒)",
|
||
"goods_id": "aaa0510c1700951804011"
|
||
},
|
||
{
|
||
"name": "绑扎胶布",
|
||
"goods_id": "aaa1721h977004201807021"
|
||
},
|
||
{
|
||
"name": "小儿咳喘灵颗粒",
|
||
"goods_id": "aaa0078f92404841800101"
|
||
},
|
||
{
|
||
"name": "胃灵颗粒",
|
||
"goods_id": "aaa13428015051201809031"
|
||
}
|
||
]
|
||
}
|
||
*/
|
||
|
||
public function goodsRanking(){
|
||
|
||
if(Cache::has('goodsRanking')){
|
||
$data = Cache::get('goodsRanking');
|
||
}else{
|
||
try{
|
||
$data = model('Goods','service')->goodsRanking();
|
||
Cache::set('goodsRanking',$data,14400);
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||
}catch (Exception $exception){
|
||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||
}
|
||
}
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||
}
|
||
|
||
|
||
/**
|
||
* 商品搜索列表
|
||
* @apiVersion 1.0.0
|
||
* @api {post} /Goods/searchList 6.搜索列表(李程)
|
||
* @apiName searchList
|
||
* @apiGroup Goods
|
||
* @apiHeader {String} authentication 验证
|
||
* @apiParam {String} name
|
||
* @apiSuccessExample Success-Response:
|
||
*{
|
||
"code": 200,
|
||
"message": "成功",
|
||
"data": [
|
||
{
|
||
"name": "盐酸美他环素胶囊(沙力欣)",
|
||
"manufacturer_name": "山西国润制药有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸二甲双胍缓释片(亿恒)",
|
||
"manufacturer_name": "南京亿华药业有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸伐昔洛韦片",
|
||
"manufacturer_name": "永信药品工业(昆山)股份有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸氨基葡萄糖胶囊",
|
||
"manufacturer_name": "浙江诚意药业股份有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左旋咪唑宝塔糖",
|
||
"manufacturer_name": "四川德元药业集团有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左氧氟沙星胶囊",
|
||
"manufacturer_name": "沈阳红旗制药有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左氧氟沙星胶囊",
|
||
"manufacturer_name": "安徽万森制药有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左氧氟沙星胶囊",
|
||
"manufacturer_name": "蚌埠丰原涂山制药有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左氧氟沙星胶囊",
|
||
"manufacturer_name": "石药集团欧意药业有限公司"
|
||
},
|
||
{
|
||
"name": "盐酸左氧氟沙星胶囊",
|
||
"manufacturer_name": "山东博山制药有限公司"
|
||
}
|
||
]
|
||
}
|
||
*/
|
||
public function searchList(){
|
||
try{
|
||
$parames = $this->request->param('');
|
||
$data = model('Goods','service')->searchList($parames);
|
||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||
}catch (Exception $exception){
|
||
return self::returnMsg(self::SUCCESS, $exception->getMessage());
|
||
}
|
||
|
||
}
|
||
|
||
// public function test()
|
||
// {
|
||
// $a = 1;
|
||
// echo assert($a, 'hello');
|
||
//// dump(intdiv(11,3));
|
||
//
|
||
// }
|
||
|
||
} |