first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,390 @@
<?php
namespace app\api\controller;
use app\common\service\ActivityService;
use think\Db;
use think\Exception;
class ActivityController extends CommonController
{
protected $noAuth = [];
/**
* @apiDefine Activity 活动管理
*/
/**
* @apiVersion 1.0.0
* @api {post} /activity/index 1.活动详情(朱晓伟)
* @apiName index
* @apiGroup Activity
* @apiHeader {String} authentication 验证
* @apiParam {Int} id 活动id
* @apiParam {Int} [limit] 每页多少条(默认20)
* @apiParam {Int} [page] 当前页(默认1)
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"id": 7,
"activity_name": "11123",
"activity_belong": 3,
"activity_type": 2,
"goods_list": {
"total": 4,
"per_page": 10,
"current_page": 1,
"last_page": 1,
"data": [
{
"goods_id": 1761,
"name": "新的使用药品",
"spec_desc": "16粒*4板",
"unit": "盒",
"drug_form": "颗粒剂",
"sort_order": 0,
"supplier_name": "安徽金壶医药",
"manufacturer_name": " 山东齐都药业有限公司 ",
"batch_number": "2019090501",
"retail_flag": 0,
"batch_type": 0,
"cost_price": "20.6000",
"stock_num": 5000,
"gba_id": 12117,
"is_onshelf": 0,
"area_id": 0,
"price": "25.3000",
"platform_royalty": "0.2000",
"discount_price": null,
"discount_num": null,
"sort": 0
},
{
"goods_id": 1759,
"name": "111111yetete",
"spec_desc": "0.5*16",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 0,
"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
},
{
"goods_id": 1140,
"name": "双氯芬酸钠缓释胶囊",
"spec_desc": "50mg*20s",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 8,
"supplier_name": "安徽金壶医药",
"manufacturer_name": "中国药科大学制药有限公司",
"batch_number": "1808301",
"retail_flag": 1,
"batch_type": 1,
"cost_price": "19.3700",
"stock_num": 1800,
"gba_id": 10867,
"is_onshelf": 0,
"area_id": 0,
"price": "20.4000",
"platform_royalty": "0.0000",
"discount_price": null,
"discount_num": null,
"sort": 0
},
{
"goods_id": 1140,
"name": "双氯芬酸钠缓释胶囊",
"spec_desc": "50mg*20s",
"unit": "盒",
"drug_form": "胶囊剂",
"sort_order": 8,
"supplier_name": "安徽金壶医药",
"manufacturer_name": "中国药科大学制药有限公司",
"batch_number": "1808301",
"retail_flag": 0,
"batch_type": 1,
"cost_price": "19.3700",
"stock_num": 200,
"gba_id": 10866,
"is_onshelf": 0,
"area_id": 0,
"price": "20.0000",
"platform_royalty": "0.0000",
"discount_price": null,
"discount_num": null,
"sort": 0
}
]
}
}
}
*/
public function index() {
try{
$parames = input('');
$parames['activity_id'] = $parames['id'];
$user_info = $this->getUserInfo();
// $data = model(ActivityService::class)->getActivityInfo($parames);
$res = model('Goods','service')->getGoodsSearch($user_info,$parames);
unset($res['code']);
unset($res['msg']);
unset($res['to_select']);
$data['goods_list'] = $res['data'];
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} /activity/group 2.活动组合(朱晓伟)
* @apiName group
* @apiGroup Activity
* @apiHeader {String} authentication 验证
* @apiParam {String} id 活动id 例如 1,2,3,4
* @apiParam {Int} [limit] 每页多少条(默认20)
* @apiParam {Int} [page] 当前页(默认1)
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": [
{
"id": 8,
"activity_name": "爆款首推",
"activity_belong": 2,
"activity_type": 3,
"is_self": 0,
"is_new": 0,
"cover_img": "",
"is_goods_only": 1,
"nid": "",
"activity_desc": "",
"activity_level": 0,
"fid": 0,
"sort_num": 1,
"start_time": null,
"end_time": null,
"create_time": "2020-05-15 04:25:09",
"update_time": "2020-05-15 16:25:50",
"verify_status": 0,
"online_status": 1,
"create_user": 1,
"admin_user_id": 1,
"remark": "",
"more_info": null,
"list": {
"code": 200,
"msg": "success",
"data": {
"total": 0,
"per_page": 30,
"current_page": 1,
"last_page": 0,
"data": []
}
}
},
{
"id": 9,
"activity_name": "热卖推荐",
"activity_belong": 2,
"activity_type": 3,
"is_self": 0,
"is_new": 0,
"cover_img": "",
"is_goods_only": 0,
"nid": "",
"activity_desc": "",
"activity_level": 0,
"fid": 0,
"sort_num": 0,
"start_time": null,
"end_time": null,
"create_time": "2020-05-15 04:25:39",
"update_time": "2020-05-15 16:25:53",
"verify_status": 0,
"online_status": 1,
"create_user": 1,
"admin_user_id": 1,
"remark": "",
"more_info": null,
"list": {
"code": 200,
"msg": "success",
"data": {
"total": 4,
"per_page": 30,
"current_page": 1,
"last_page": 1,
"data": [
{
"price": "价格登录可见",
"original_price": "价格登录可见",
"goods_id": 1917,
"goods_name": "百令胶囊",
"show_price": "79.80",
"is_online_sale": 0,
"country_code": "Z10910036",
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1542437212405.jpg",
"drug_form": "胶囊剂",
"keyword": "百令胶囊",
"sketch": "肺肾两虚引起的咳嗽、气喘、咯血、腰背酸痛;慢性支气管炎的辅助治疗",
"manufacturer_name": "杭州中美华东制药有限公司",
"spec_desc": "0.5g*42s",
"batch_type": 1,
"supplier_id": 1,
"supplier_sn": "",
"batch_id": 4112,
"retail_flag": 1,
"retail_num": 10,
"entirety_num": 200,
"batch_number": "1912323",
"stock_num": 800,
"term_validity": "2022-11-30",
"sale_num": 200,
"sku_id": 13444,
"area_id": 0,
"price_type": 0,
"is_buy": 0
},
{
"price": "价格登录可见",
"original_price": "价格登录可见",
"goods_id": 2649,
"goods_name": "厄贝沙坦片(苏适",
"show_price": "21.40",
"is_online_sale": 0,
"country_code": "H20000511",
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1588042489382.png",
"drug_form": "片剂",
"keyword": "厄贝沙坦片",
"sketch": "治疗原发性高血压。\n合并高血压的2型糖尿病肾病的治疗。",
"manufacturer_name": "深圳市海滨制药有限公司",
"spec_desc": "0.15g*7s",
"batch_type": 1,
"supplier_id": 1,
"supplier_sn": "",
"batch_id": 4075,
"retail_flag": 1,
"retail_num": 10,
"entirety_num": 400,
"batch_number": "4190611051",
"stock_num": 1600,
"term_validity": "2021-05-10",
"sale_num": 0,
"sku_id": 13407,
"area_id": 0,
"price_type": 0,
"is_buy": 0
},
{
"price": "价格登录可见",
"original_price": "价格登录可见",
"goods_id": 2376,
"goods_name": "参松养心胶囊",
"show_price": "31.50",
"is_online_sale": 0,
"country_code": "Z20103032",
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1575344012699.jpg",
"drug_form": "胶囊剂",
"keyword": "参松养心胶囊",
"sketch": "益气养阴,活血通络,清心安神。用于治疗气阴两虚,心络瘀阻引起的冠心病室性早搏,症见心悸不安,气短乏力",
"manufacturer_name": "北京以岭药业股份有限公司",
"spec_desc": "0.4g*36s",
"batch_type": 1,
"supplier_id": 1,
"supplier_sn": "",
"batch_id": 3383,
"retail_flag": 0,
"retail_num": 10,
"entirety_num": 400,
"batch_number": "1905023",
"stock_num": 380,
"term_validity": "2022-04-30",
"sale_num": 50,
"sku_id": 12715,
"area_id": 0,
"price_type": 0,
"is_buy": 0
},
{
"price": "价格登录可见",
"original_price": "价格登录可见",
"goods_id": 2358,
"goods_name": "酒石酸美托洛尔片",
"show_price": "9.50",
"is_online_sale": 0,
"country_code": "H20065355",
"app_thumb": "",
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1574747304847.png",
"drug_form": "片剂",
"keyword": "酒石酸美托洛尔片",
"sketch": "用于治疗高血压、心绞痛、心肌梗死、肥厚型心肌病、主动脉夹层、心律失常、甲状腺机能亢进、心脏神经官能症",
"manufacturer_name": "石家庄以岭药业股份有限公司",
"spec_desc": "25mg*10s*2板",
"batch_type": 1,
"supplier_id": 1,
"supplier_sn": "",
"batch_id": 3328,
"retail_flag": 0,
"retail_num": 10,
"entirety_num": 400,
"batch_number": "A1908002",
"stock_num": 400,
"term_validity": "2021-07-31",
"sale_num": 0,
"sku_id": 12660,
"area_id": 0,
"price_type": 0,
"is_buy": 0
}
]
}
}
}
]
}
*/
public function group() {
try{
$parames = input('');
if(!isset($parames['id'])){
return self::returnMsg(self::ERR_EMPTY_PARAM, self::getMessage('ERR_EMPTY_PARAM'));
}
$user_info = $this->getUserInfo();
$ids = explode(',',$parames['id']);
$activity_list = Db::name('activity')->where('id','in',$ids)->where('activity_type',3)->select();
$list = [];
foreach ($activity_list as $activity){
$data['activity_id'] = $activity['id'];
$item = $activity;
$item['list'] = $res = model('Goods','service')->getGoodsSearch($user_info,$data);
$list[] = $item;
}
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$list);
}catch (Exception $exception){
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
}