first commit
This commit is contained in:
1
金壶/ydyd_service/application/api/.pydio
Normal file
1
金壶/ydyd_service/application/api/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
89759524-27f7-4c05-a68d-382183619c43
|
||||
1
金壶/ydyd_service/application/api/controller/.pydio
Normal file
1
金壶/ydyd_service/application/api/controller/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
80741cf9-76c1-430a-8a02-275c8553a4d6
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
155
金壶/ydyd_service/application/api/controller/ApiController.php
Normal file
155
金壶/ydyd_service/application/api/controller/ApiController.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\facade\Cache;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* api 入口文件基类,需要控制权限的控制器都应该继承该类
|
||||
*/
|
||||
class ApiController extends Controller
|
||||
{
|
||||
protected $middleware = [
|
||||
'CrossDomain'
|
||||
];
|
||||
|
||||
use SendController;
|
||||
|
||||
/** 成功码 */
|
||||
const SUCCESS = 200;
|
||||
|
||||
/** 错误码:传递参数提示1xxxxxx; 数据验证提示2xxxxx; 业务提示3xxxxx; */
|
||||
const ERR_EMPTY_PARAM = 10000;
|
||||
const ERR_PASSWORD_EMPTY_PARAM = 10001;
|
||||
const ERR_ACCOUNT_EMPTY_PARAM = 10002;
|
||||
const ERR_EMPTY_INPUT = 10003;
|
||||
const ERR_NOT_AGREE_PROTOCOL = 10004;
|
||||
const ERR_USER_PASSWORD = 20000;
|
||||
const ERR_USER_TOKEN_INVALID = 40000;
|
||||
const ERR_NONE = 40001;
|
||||
const ERR_DENY = 40002;
|
||||
const ERR_UPLOAD_FILE = 40003;
|
||||
const ERR_ILLEGAL = 40004;
|
||||
const ERR_EMPLOYEE_BALANCE = 40005;
|
||||
const ERR_SMS_SEND = 40006;
|
||||
const ERR_ERROR_PARAM = 40007;
|
||||
const ERR_VERSION_MUST_UPGRADE = 40008;
|
||||
const ERR_USER_TOKEN_EXPIRE = 400013;
|
||||
const ERR_USER_REFRESH_TOKEN_EXPIRE = 40014;
|
||||
const ERR_USER_TOKEN = 40015;
|
||||
const ERR_ACCESS_TOKEN = 40016;
|
||||
const ERR_APPID = 40017;
|
||||
const ERR_ORDER_STATUS_ERROR = 80001;
|
||||
|
||||
/** 信息提示 */
|
||||
const message = [
|
||||
'SUCCESS' => "成功",
|
||||
|
||||
'ERR_EMPTY_PARAM' => "参数丢失",
|
||||
'ERR_EMPTY_INPUT' => "请输入",
|
||||
'ERR_PASSWORD_EMPTY_PARAM' => "请输入密码",
|
||||
'ERR_ACCOUNT_EMPTY_PARAM' => "请输入手机号",
|
||||
'ERR_ACCOUNT_PASSWORD' => "请输入正确的手机号和密码",
|
||||
'ERR_USER_HAVE_LOCKED' => "账号已被冻结",
|
||||
'ERR_USER_TOKEN_INVALID' => "请先登录",
|
||||
'ERR_USER_TOKEN_EXPIRE' => "TOKEN已过期",
|
||||
'ERR_USER_TOKEN' => "REFRESH_TOKEN错误",
|
||||
'ERR_USER_REFRESH_TOKEN_EXPIRE' => "REFRESH_TOKEN已过期",
|
||||
'ERR_ACCESS_TOKEN' => "access_token不存在或为空",
|
||||
'ERR_APPID' => "appid错误",
|
||||
'ERR_NONE' => "系统错误",
|
||||
'ERR_DENY' => "拒绝请求",
|
||||
'ERR_UPLOAD_FILE' => "文件上传失败,请重试",
|
||||
'ERR_SMS_SEND' => "短信发送失败,请重试",
|
||||
'ERR_ILLEGAL' => "非法请求",
|
||||
'ERR_EMPLOYEE_BALANCE' => "用户账户异常",
|
||||
'ERR_ERROR_PARAM' => "参数异常",
|
||||
'ERR_ORDER_STATUS_ERROR' => "订单状态异常",
|
||||
];
|
||||
|
||||
|
||||
public static function getMessage($error)
|
||||
{
|
||||
return self::message[$error];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @var \think\Request Request实例
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
protected $clientInfo;
|
||||
|
||||
protected $uid;
|
||||
|
||||
/**
|
||||
* 不需要鉴权方法
|
||||
*/
|
||||
protected $noAuth = [];
|
||||
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @param Request $request Request对象
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
parent::__construct();
|
||||
//初始化系统常量
|
||||
$system_constant = Cache::get("SYSTEM_CONSTANT");
|
||||
if (!$system_constant) {
|
||||
$list = Db::name('constants')->column("param_value","param_name");
|
||||
$system_constant = array();
|
||||
foreach ($list as $k => $v) {
|
||||
$system_constant[$k] = json_decode($v,true);
|
||||
}
|
||||
Cache::set('SYSTEM_CONSTANT', $system_constant,120);
|
||||
}
|
||||
//注意区别于缓存,config方式只对当前请求有效
|
||||
config('SYSTEM_CONSTANT',$system_constant);
|
||||
$this->request = $request;
|
||||
$this->init();
|
||||
if(isset($this->clientInfo['client'])){
|
||||
$this->uid = $this->clientInfo['client']['id'];
|
||||
$this->clientInfo = $this->clientInfo['client'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* 检查请求类型,数据格式等
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
//所有ajax请求的options预请求都会直接返回200,如果需要单独针对某个类中的方法,可以在路由规则中进行配置
|
||||
if ($this->request->isOptions()) {
|
||||
return self::returnMsg(200, 'success');
|
||||
}
|
||||
$oauth = app('app\api\controller\OauthController'); //tp5.1容器,直接绑定类到容器进行实例化
|
||||
$user_info = $oauth->authenticate();
|
||||
if (!$oauth->match($this->noAuth)) {
|
||||
if($user_info){
|
||||
if(isset($user_info['refresh_expires_time']) && $user_info['refresh_expires_time'] < time()){
|
||||
return self::returnMsg(self::ERR_USER_REFRESH_TOKEN_EXPIRE,self::getMessage('ERR_USER_REFRESH_TOKEN_EXPIRE'),[]);
|
||||
}
|
||||
if(!isset($user_info['expires_time']) || $user_info['expires_time'] < time()){
|
||||
return self::returnMsg(self::ERR_USER_TOKEN_EXPIRE,self::getMessage('ERR_USER_TOKEN_EXPIRE'),[]);
|
||||
}
|
||||
$getCacheAccessToken = $oauth->certification($oauth::getClient());
|
||||
if(!$getCacheAccessToken){
|
||||
return self::returnMsg(self::ERR_ACCESS_TOKEN,self::getMessage('ERR_ACCESS_TOKEN'),[]);
|
||||
}
|
||||
$this->clientInfo = $user_info;
|
||||
return $this->clientInfo;
|
||||
}
|
||||
return self::returnMsg(self::ERR_USER_TOKEN_INVALID,self::getMessage('ERR_USER_TOKEN_INVALID'));
|
||||
}
|
||||
$this->clientInfo = $user_info;
|
||||
return $this->clientInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm && wx_lql
|
||||
* Welfares.php in Project yifu => 文件描述
|
||||
* 2019/8/7 11:05
|
||||
*
|
||||
* ┏┓ ┏┓+ +
|
||||
* ┏┛┻━━━┛┻┓ + +
|
||||
* ┃ ┃
|
||||
* ┃ ━ ┃ ++ + + +
|
||||
*
|
||||
* ████━████ ┃+
|
||||
* ┃ ┃ +
|
||||
* ┃ ┻ ┃
|
||||
* ┃ ┃ + +
|
||||
* ┗━┓ ┏━┛
|
||||
* ┃ ┃
|
||||
* ┃ ┃ + + + +
|
||||
* ┃ ┃
|
||||
* ┃ ┃ + 神兽保佑
|
||||
* ┃ ┃ 代码无bug
|
||||
* ┃ ┃ +
|
||||
* ┃ ┗━━━┓ + +
|
||||
* ┃ ┣┓
|
||||
* ┃ ┏┛
|
||||
* ┗┓┓┏━┳┓┏┛ + + + +
|
||||
* ┃┫┫ ┃┫┫
|
||||
* ┗┻┛ ┗┻┛+ + + +
|
||||
*/
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\AreaModel;
|
||||
use think\Exception;
|
||||
|
||||
class AreaController extends ApiController
|
||||
{
|
||||
/**
|
||||
* 不需要鉴权方法
|
||||
* index、save不需要鉴权
|
||||
* ['index','save']
|
||||
* 所有方法都不需要鉴权
|
||||
* [*]
|
||||
*/
|
||||
protected $noAuth = ['index'];
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {get} /area/index 地址列表(朱晓伟)
|
||||
* @apiName index
|
||||
* @apiGroup Version
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
* "code": 200,
|
||||
* "message": "成功",
|
||||
* "data": {
|
||||
* "version": 1.0.1,
|
||||
* "url": "http://www.baidu.com",
|
||||
* "describe": "有重大更新啦!!",
|
||||
* "update_method": 0,// 更新方式(0:普通更新;1、强制更新)
|
||||
* }
|
||||
* }
|
||||
* @apiErrorExample Error-Response:
|
||||
* {
|
||||
* "code": 200,
|
||||
* "message": "无更新",
|
||||
* "data": {}
|
||||
* }
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$field = 'id, area_name, parent_area_id';
|
||||
$areaTree = AreaModel::with(['childs','childs.childs'])
|
||||
->field($field)->where('parent_area_id',0)->all()->toArray();
|
||||
return self::returnMsg(self::SUCCESS, '无更新',$areaTree);
|
||||
}
|
||||
}
|
||||
213
金壶/ydyd_service/application/api/controller/CartController.php
Normal file
213
金壶/ydyd_service/application/api/controller/CartController.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\UserCartService;
|
||||
use app\ydyd_service\service\ShopCartService;
|
||||
use think\Exception;
|
||||
|
||||
class CartController extends CommonController
|
||||
{
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiDefine Cart 购物车
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /cart/add 1.添加购物车(丁超)
|
||||
* @apiName add
|
||||
* @apiGroup Cart
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} gba_id 商品价格id
|
||||
* @apiParam {Int} batch_id 商品批次id
|
||||
* @apiParam {Int} goods_number 商品数量
|
||||
* @apiParam {String} add_type 是否立即购买(是:buy,否:传空)
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data":{
|
||||
uc_id:1,
|
||||
errcode:0,
|
||||
errmsg:"操作成功",
|
||||
}
|
||||
*/
|
||||
public function add() {
|
||||
try{
|
||||
$param = input('param.');//暂不使用验证器校验
|
||||
$user_data = $this->getUserInfo();
|
||||
$data = model(UserCartService::class)->addGoods($user_data,$param);
|
||||
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} /cart/update 2.购物车商品数量(朱晓伟)
|
||||
* @apiName update
|
||||
* @apiGroup Cart
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} id 购物车id
|
||||
* @apiParam {Int} goods_number 商品数量
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data":{
|
||||
errcode:0,
|
||||
errmsg:"操作成功",
|
||||
}
|
||||
*/
|
||||
public function update() {
|
||||
try{
|
||||
$parames['user_id'] = $this->uid;
|
||||
$parames['is_app'] = 1;//兼容pc处理机制(pc return错误;app 抛出异常)
|
||||
$parames['user_info'] = $this->getUserInfo();
|
||||
$data = model(ShopCartService::class)->ChangeCart($parames);
|
||||
// unset($data['errcode']);
|
||||
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} /cart/del 3.删除购物车(朱晓伟)
|
||||
* @apiName del
|
||||
* @apiGroup Cart
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} id 购物车id
|
||||
* @apiParam {Int} batch_id 商品批次id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data":{
|
||||
errcode:0,
|
||||
errmsg:"操作成功",
|
||||
}
|
||||
*/
|
||||
public function del() {
|
||||
try{
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(ShopCartService::class)->delCartProduct($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} /cart/multiDel 4.批量删除购物车(朱晓伟)
|
||||
* @apiName multiDel
|
||||
* @apiGroup Cart
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} id_group 购物车id 例如:1,2,3,4,5
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data":{
|
||||
errcode:0,
|
||||
errmsg:"操作成功",
|
||||
}
|
||||
*/
|
||||
public function multiDel() {
|
||||
try{
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(ShopCartService::class)->multiDeleteCartProduct($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} /cart/getList 5.购物车列表(丁超)
|
||||
* @apiName getList
|
||||
* @apiGroup Cart
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errcode": 0,
|
||||
"data": {
|
||||
"available_goods": [{
|
||||
"id": 102,
|
||||
"price_id": 12104,
|
||||
"price": "50.0000",
|
||||
"price_type": 0,
|
||||
"batch_id": 869,
|
||||
"goods_id": 470,
|
||||
"name": "匹多莫德口服溶液",
|
||||
"spec_desc": "10ml:0.4g*6支",
|
||||
"unit": "盒",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1545011228838.jpg",
|
||||
"status": 1,
|
||||
"manufacturer_name": "江苏吴中医药集团有限公司苏州制药厂",
|
||||
"supplier_user_id": 3,
|
||||
"batch_number": "2017071008",
|
||||
"batch_status": 1,
|
||||
"stock_num": 640,
|
||||
"retail_flag": 1,
|
||||
"retail_num": 10,
|
||||
"entirety_num": 80,
|
||||
"batch_type": 1,
|
||||
"term_validity": "2019-07-09",
|
||||
"is_collect": 0,
|
||||
"num": 80,
|
||||
"can_select": 1,
|
||||
"total_price": "4000.00"
|
||||
}, {
|
||||
"id": 101,
|
||||
"price_id": 12110,
|
||||
"price": "10.4000",
|
||||
"price_type": 0,
|
||||
"batch_id": 2142,
|
||||
"goods_id": 1741,
|
||||
"name": "心脏病药",
|
||||
"spec_desc": "2*12ml",
|
||||
"unit": "支",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1562315863518.png",
|
||||
"status": 1,
|
||||
"manufacturer_name": "安徽仁和药业有限公司",
|
||||
"supplier_user_id": 3,
|
||||
"batch_number": "987654",
|
||||
"batch_status": 1,
|
||||
"stock_num": 20,
|
||||
"retail_flag": 0,
|
||||
"retail_num": 20,
|
||||
"entirety_num": 200,
|
||||
"batch_type": 1,
|
||||
"term_validity": "2019-08-10",
|
||||
"is_collect": 0,
|
||||
"num": 20,
|
||||
"can_select": 0,
|
||||
"warn_info": "库存不足",
|
||||
"total_price": "208.00"
|
||||
}],
|
||||
"inavailable_goods": []
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getList() {
|
||||
try{
|
||||
$user_data = $this->getUserInfo();
|
||||
$data = model(UserCartService::class)->getAll($user_data);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,901 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
//use app\facade\AppConstant;
|
||||
use app\facade\AppConstant;
|
||||
use think\Controller;
|
||||
use think\facade\Cache;
|
||||
use think\Request;
|
||||
use think\facade\Config;
|
||||
|
||||
class ClassificationController extends ApiController
|
||||
{
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiDefine Classification 商品分类
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /Classification/index 1.商品分类(李程)
|
||||
* @apiName index
|
||||
* @apiGroup Classification
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} name 分类名称
|
||||
* @apiParam {Int} pid 父标签id
|
||||
* @apiParam {Int} nid 分类标示符
|
||||
* @apiParam {String} description 简述
|
||||
* @apiParam {Int} index_show_flag 首页列表显示标志。0:不显示,1:显示
|
||||
* @apiParam {Int} index_show_order 首页列表显示顺序
|
||||
* @apiParam {String} icon_url 分类图标链接
|
||||
* @apiParam {Int} deep 第几层
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
* "code": 200,
|
||||
* "message": "成功",
|
||||
* "data": {
|
||||
* "772": {
|
||||
* "cate_id": 772,
|
||||
* "nid": "ZSCY",
|
||||
* "name": "中西成药",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 5,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 5,
|
||||
* "description": "ZSCY",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1562747159811.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "778": {
|
||||
* "cate_id": 778,
|
||||
* "nid": "GMFS",
|
||||
* "name": "感冒发烧",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "GMFS",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "779": {
|
||||
* "cate_id": 779,
|
||||
* "nid": "CWYY",
|
||||
* "name": "胃肠用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "CWYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "780": {
|
||||
* "cate_id": 780,
|
||||
* "nid": "HXXT",
|
||||
* "name": "呼吸系统",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "HXXT",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "781": {
|
||||
* "cate_id": 781,
|
||||
* "nid": "GDYY",
|
||||
* "name": "肝胆用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 4,
|
||||
* "description": "GDYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "782": {
|
||||
* "cate_id": 782,
|
||||
* "nid": "MNXT",
|
||||
* "name": "泌尿系统",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 5,
|
||||
* "description": "MNXT",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "783": {
|
||||
* "cate_id": 783,
|
||||
* "nid": "XNXG",
|
||||
* "name": "心脑血管",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 6,
|
||||
* "description": "XNXG",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "784": {
|
||||
* "cate_id": 784,
|
||||
* "nid": "NFMY",
|
||||
* "name": "内分泌药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 7,
|
||||
* "description": "NFMY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "785": {
|
||||
* "cate_id": 785,
|
||||
* "nid": "FKYY",
|
||||
* "name": "妇科用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 8,
|
||||
* "description": "FKYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "786": {
|
||||
* "cate_id": 786,
|
||||
* "nid": "NKYY",
|
||||
* "name": "男科用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 9,
|
||||
* "description": "NKYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "787": {
|
||||
* "cate_id": 787,
|
||||
* "nid": "EKYY",
|
||||
* "name": "儿科用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 10,
|
||||
* "description": "EKYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "788": {
|
||||
* "cate_id": 788,
|
||||
* "nid": "SJXT",
|
||||
* "name": "神经系统",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 11,
|
||||
* "description": "SJXT",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "789": {
|
||||
* "cate_id": 789,
|
||||
* "nid": "FSDD",
|
||||
* "name": "风湿跌打",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 12,
|
||||
* "description": "FSDD",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "790": {
|
||||
* "cate_id": 790,
|
||||
* "nid": "YYZB",
|
||||
* "name": "营养滋补",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 13,
|
||||
* "description": "YYZB",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "791": {
|
||||
* "cate_id": 791,
|
||||
* "nid": "PFWY",
|
||||
* "name": "皮肤科药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 14,
|
||||
* "description": "PFKY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "792": {
|
||||
* "cate_id": 792,
|
||||
* "nid": "KSSL",
|
||||
* "name": "抗生素类",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 15,
|
||||
* "description": "KSSL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "793": {
|
||||
* "cate_id": 793,
|
||||
* "nid": "WGKY",
|
||||
* "name": "五官科药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 16,
|
||||
* "description": "WGKY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "794": {
|
||||
* "cate_id": 794,
|
||||
* "nid": "ZLYY",
|
||||
* "name": "肿瘤用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 17,
|
||||
* "description": "ZLYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "795": {
|
||||
* "cate_id": 795,
|
||||
* "nid": "GMYY",
|
||||
* "name": "过敏用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 18,
|
||||
* "description": "GMYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "796": {
|
||||
* "cate_id": 796,
|
||||
* "nid": "QRJD",
|
||||
* "name": "清热解毒",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 19,
|
||||
* "description": "QRJD",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "797": {
|
||||
* "cate_id": 797,
|
||||
* "nid": "GSKYY",
|
||||
* "name": "骨伤科用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 20,
|
||||
* "description": "GSKYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "798": {
|
||||
* "cate_id": 798,
|
||||
* "nid": "ZSJL",
|
||||
* "name": "注射剂类",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 21,
|
||||
* "description": "ZSJL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "799": {
|
||||
* "cate_id": 799,
|
||||
* "nid": "WSSKWZ",
|
||||
* "name": "维生素矿物质",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 22,
|
||||
* "description": "WSSKWZ",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "800": {
|
||||
* "cate_id": 800,
|
||||
* "nid": "MZY",
|
||||
* "name": "麻醉药\/麻醉辅助用药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 23,
|
||||
* "description": "MZY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "801": {
|
||||
* "cate_id": 801,
|
||||
* "nid": "QTZXY",
|
||||
* "name": "其他中西药",
|
||||
* "pid": 772,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 24,
|
||||
* "description": "QTZXY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "773": {
|
||||
* "cate_id": 773,
|
||||
* "nid": "YLQX",
|
||||
* "name": "医疗器械",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 4,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 4,
|
||||
* "description": "YLQX",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1562747234968.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "802": {
|
||||
* "cate_id": 802,
|
||||
* "nid": "JTCB",
|
||||
* "name": "家庭常备",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "JTCB",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "803": {
|
||||
* "cate_id": 803,
|
||||
* "nid": "JCYQ",
|
||||
* "name": "检测仪器",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "JCYQ",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "804": {
|
||||
* "cate_id": 804,
|
||||
* "nid": "KFLL",
|
||||
* "name": "康复理疗",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "KFLL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "805": {
|
||||
* "cate_id": 805,
|
||||
* "nid": "ZYLL",
|
||||
* "name": "中医理疗",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 4,
|
||||
* "description": "ZYLL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "806": {
|
||||
* "cate_id": 806,
|
||||
* "nid": "YYCL",
|
||||
* "name": "医用材料",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 5,
|
||||
* "description": "YYCL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "807": {
|
||||
* "cate_id": 807,
|
||||
* "nid": "YLYP",
|
||||
* "name": "医疗用品",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 6,
|
||||
* "description": "YLYP",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "808": {
|
||||
* "cate_id": 808,
|
||||
* "nid": "BJQC",
|
||||
* "name": "保健器械",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 7,
|
||||
* "description": "BJQC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "809": {
|
||||
* "cate_id": 809,
|
||||
* "nid": "GYQC",
|
||||
* "name": "供氧器材",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 8,
|
||||
* "description": "GYQC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "810": {
|
||||
* "cate_id": 810,
|
||||
* "nid": "SSQC",
|
||||
* "name": "手术器械",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 9,
|
||||
* "description": "SSQC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "811": {
|
||||
* "cate_id": 811,
|
||||
* "nid": "GTJL",
|
||||
* "name": "贴膏剂类",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 10,
|
||||
* "description": "GTJL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "812": {
|
||||
* "cate_id": 812,
|
||||
* "nid": "QTQX",
|
||||
* "name": "其它器械",
|
||||
* "pid": 773,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 11,
|
||||
* "description": "QTQX",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "774": {
|
||||
* "cate_id": 774,
|
||||
* "nid": "ZYYP",
|
||||
* "name": "中药饮片",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 3,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "ZYYP",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1562747245474.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "813": {
|
||||
* "cate_id": 813,
|
||||
* "nid": "ZYP",
|
||||
* "name": "中药饮片",
|
||||
* "pid": 774,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "ZYP",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "814": {
|
||||
* "cate_id": 814,
|
||||
* "nid": "ZYC",
|
||||
* "name": "中药材",
|
||||
* "pid": 774,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "ZYC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "815": {
|
||||
* "cate_id": 815,
|
||||
* "nid": "C",
|
||||
* "name": "茶",
|
||||
* "pid": 774,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "C",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "776": {
|
||||
* "cate_id": 776,
|
||||
* "nid": "YSBJ",
|
||||
* "name": "养生保健",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 2,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "YSBJ",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1562747256744.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "816": {
|
||||
* "cate_id": 816,
|
||||
* "nid": "GSCJ",
|
||||
* "name": "改善促进",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "GSCJ",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "817": {
|
||||
* "cate_id": 817,
|
||||
* "nid": "PDYY",
|
||||
* "name": "排毒养颜",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "PDYY",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "818": {
|
||||
* "cate_id": 818,
|
||||
* "nid": "MYTJ",
|
||||
* "name": "免疫调节",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "MYTJ",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "819": {
|
||||
* "cate_id": 819,
|
||||
* "nid": "JFSS",
|
||||
* "name": "减肥瘦身",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 4,
|
||||
* "description": "JFSS",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "820": {
|
||||
* "cate_id": 820,
|
||||
* "nid": "YYBC",
|
||||
* "name": "营养补充",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 5,
|
||||
* "description": "YYBC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "821": {
|
||||
* "cate_id": 821,
|
||||
* "nid": "HJPL",
|
||||
* "name": "缓解疲劳",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 6,
|
||||
* "description": "HJPL",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "825": {
|
||||
* "cate_id": 825,
|
||||
* "nid": "YYDPC",
|
||||
* "name": "药用代泡茶",
|
||||
* "pid": 776,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 0,
|
||||
* "description": "YYDPC",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "777": {
|
||||
* "cate_id": 777,
|
||||
* "nid": "JSYP",
|
||||
* "name": "计生用品",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 1,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "JSYP",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1562747451535.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "822": {
|
||||
* "cate_id": 822,
|
||||
* "nid": "BYYP",
|
||||
* "name": "避孕用品",
|
||||
* "pid": 777,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 1,
|
||||
* "description": "BYYP",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "823": {
|
||||
* "cate_id": 823,
|
||||
* "nid": "JCYP",
|
||||
* "name": "检测用品",
|
||||
* "pid": 777,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 2,
|
||||
* "description": "JCYP",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* },
|
||||
* "824": {
|
||||
* "cate_id": 824,
|
||||
* "nid": "QQYP",
|
||||
* "name": "情趣用品",
|
||||
* "pid": 777,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 3,
|
||||
* "description": "QQYP",
|
||||
* "icon_url": "",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "826": {
|
||||
* "cate_id": 826,
|
||||
* "nid": "HDSP",
|
||||
* "name": "活动商品",
|
||||
* "pid": 0,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 0,
|
||||
* "description": "活动商品所属分类",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1585029532706.png",
|
||||
* "deep": 0,
|
||||
* "sub_cate": {
|
||||
* "827": {
|
||||
* "cate_id": 827,
|
||||
* "nid": "新人特价",
|
||||
* "name": "活动一",
|
||||
* "pid": 826,
|
||||
* "index_show_flag": 1,
|
||||
* "index_show_order": 0,
|
||||
* "list_show_flag": 1,
|
||||
* "list_show_order": 0,
|
||||
* "description": "新人特价",
|
||||
* "icon_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/cate_icon_url_1585029618612.png",
|
||||
* "deep": 1,
|
||||
* "sub_cate": []
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//产品分类相关
|
||||
if (time()<strtotime('2020-05-22 11:36')){
|
||||
Cache::rm('cate_tree_app');
|
||||
}
|
||||
if(Cache::has('cate_tree_app')){
|
||||
$cate_tree = Cache::get('cate_tree_app');
|
||||
}else{
|
||||
$cate_tree = AppConstant::getAppIndexGoodsCateData();
|
||||
Cache::set('cate_tree_app',$cate_tree,600);
|
||||
}
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$cate_tree);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示指定的资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示编辑资源表单页.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
243
金壶/ydyd_service/application/api/controller/CommonController.php
Normal file
243
金壶/ydyd_service/application/api/controller/CommonController.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\ActivityService;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use think\facade\Config;
|
||||
use think\facade\Cache;
|
||||
use think\Db;
|
||||
|
||||
class CommonController extends ApiController
|
||||
{
|
||||
protected $noAuth = ['userTypeList','userTypeInfo'];
|
||||
|
||||
/**
|
||||
* @apiDefine Common 公共接口
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /common/userTypeList 1.企业类型列表(朱晓伟)
|
||||
* @apiName userTypeList
|
||||
* @apiGroup Common
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": [
|
||||
{
|
||||
"key": "clinic",
|
||||
"name": "诊所"
|
||||
},
|
||||
{
|
||||
"key": "hospital",
|
||||
"name": "医院"
|
||||
},
|
||||
{
|
||||
"key": "drugstore",
|
||||
"name": "单体药房"
|
||||
},
|
||||
{
|
||||
"key": "liansuo_drugstore",
|
||||
"name": "连锁药房"
|
||||
},
|
||||
{
|
||||
"key": "purchasing_enterprise",
|
||||
"name": "医药采购企业"
|
||||
},
|
||||
{
|
||||
"key": "manufacturer",
|
||||
"name": "医药生产企业"
|
||||
},
|
||||
{
|
||||
"key": "supply_enterprise",
|
||||
"name": "医药供应企业"
|
||||
},
|
||||
{
|
||||
"key": "agency_business",
|
||||
"name": "医药代理企业"
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
public function userTypeList() {
|
||||
$list = Config::get('const.ROLE_CERT_INFO')['buyer']['sub_type'];
|
||||
$data = [];
|
||||
foreach ($list as $k => $v)
|
||||
{
|
||||
$item['key'] = $k;
|
||||
$item['name'] = $v['name'];
|
||||
$data[] = $item;
|
||||
}
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /common/userTypeInfo 2.企业类型详情(朱晓伟)
|
||||
* @apiName userTypeInfo
|
||||
* @apiGroup Common
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} key 企业类型key
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"business_license": true,
|
||||
"medical_license": true,
|
||||
"purchase_identity": true,
|
||||
"authority_purchase": true,
|
||||
"tax_regcate": true,
|
||||
"gsp_license": false,
|
||||
"trade_license": false,
|
||||
"peer_list": false,
|
||||
"year_report": false,
|
||||
"make_license": false,
|
||||
"gmp_license": false,
|
||||
"principal_identity": false,
|
||||
"sales_commission": false,
|
||||
"quality_agreement": false,
|
||||
"acting_prove": false
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function userTypeInfo() {
|
||||
$key = input('key');
|
||||
$list = Config::get('const.ROLE_CERT_INFO')['buyer']['sub_type'];
|
||||
$data = [];
|
||||
foreach ($list as $k => $v)
|
||||
{
|
||||
if($key == $k){
|
||||
$data = $v['certificate_list'];
|
||||
if(!isset($data['business_license'])){
|
||||
$data['business_license'] = false;
|
||||
}
|
||||
if(!isset($data['gsp_license'])){
|
||||
$data['gsp_license'] = false;
|
||||
}
|
||||
if(!isset($data['trade_license'])){
|
||||
$data['trade_license'] = false;
|
||||
}
|
||||
if(!isset($data['purchase_identity'])){
|
||||
$data['purchase_identity'] = false;
|
||||
}
|
||||
if(!isset($data['authority_purchase'])){
|
||||
$data['authority_purchase'] = false;
|
||||
}
|
||||
if(!isset($data['tax_regcate'])){
|
||||
$data['tax_regcate'] = false;
|
||||
}
|
||||
if(!isset($data['peer_list'])){
|
||||
$data['peer_list'] = false;
|
||||
}
|
||||
if(!isset($data['year_report'])){
|
||||
$data['year_report'] = false;
|
||||
}
|
||||
if(!isset($data['make_license'])){
|
||||
$data['make_license'] = false;
|
||||
}
|
||||
if(!isset($data['gmp_license'])){
|
||||
$data['gmp_license'] = false;
|
||||
}
|
||||
if(!isset($data['principal_identity'])){
|
||||
$data['principal_identity'] = false;
|
||||
}
|
||||
if(!isset($data['sales_commission'])){
|
||||
$data['sales_commission'] = false;
|
||||
}
|
||||
if(!isset($data['quality_agreement'])){
|
||||
$data['quality_agreement'] = false;
|
||||
}
|
||||
if(!isset($data['acting_prove'])){
|
||||
$data['acting_prove'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$list = [];
|
||||
foreach ($data as $k=>$v)
|
||||
{
|
||||
if($v){
|
||||
$item = [];
|
||||
$item['name'] = $k;
|
||||
$item['value'] = $k;
|
||||
$item['path'][] = 'https://ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/app/business_license_15880512107935.png';
|
||||
$list[] = $item;
|
||||
}
|
||||
}
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 系统常量初始化 (丁超 20200417)
|
||||
* 沿用旧版common\SystemDeal(当前API工程系统初始化未调用)
|
||||
* 建立缓存+返回系统常量
|
||||
* 内含敏感数据,不可直接全部返回前端
|
||||
* @access protected
|
||||
* @version 1.0.0
|
||||
* @return array
|
||||
* 返回示例
|
||||
*{
|
||||
"WEB_NAME": "医点医滴电子商务-药品汇聚商城",
|
||||
"PLAT_PUBLIC_ACCOUNT": {
|
||||
"bank": "徽商银行合肥市肥东支行",
|
||||
"name": "安徽金壶医药有限公司",
|
||||
"account": "1027801021000008392"
|
||||
},
|
||||
"DRUG_FORM": [
|
||||
"胶囊剂",
|
||||
"颗粒剂",
|
||||
"片剂",
|
||||
],
|
||||
"DRUG_UNITS_FORM": [
|
||||
"盒",
|
||||
"支",
|
||||
"瓶",
|
||||
"袋",
|
||||
],
|
||||
}
|
||||
*/
|
||||
protected function initSysConstant(){
|
||||
//初始化系统常量
|
||||
$system_constant = Cache::get("SYSTEM_CONSTANT");
|
||||
if (!$system_constant) {
|
||||
$list = Db::name('constants')->column("param_value","param_name");
|
||||
$system_constant = array();
|
||||
foreach ($list as $k => $v) {
|
||||
$system_constant[$k] = json_decode($v,true);
|
||||
}
|
||||
Cache::set('SYSTEM_CONSTANT', $system_constant,120);
|
||||
}
|
||||
//注意区别于缓存,config方式只对当前请求有效
|
||||
config('SYSTEM_CONSTANT',$system_constant);
|
||||
|
||||
return $system_constant;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息 (丁超 20200417)
|
||||
*/
|
||||
protected function getUserInfo(){
|
||||
if (!$this->uid){
|
||||
$user_info = [];
|
||||
}else{
|
||||
$user_info = Cache::get('USER_INFO_API'.$this->uid);
|
||||
if (!$user_info){
|
||||
$field = 'u.user_id,u.is_new_user,u.user_name,u.avatar_url,u.phone,u.buyer_status,u.area_id,u.register_ip,u.last_login_time,u.last_login_ip,u.block_status,u.custom_service_id';
|
||||
$field .= ',b.extend_level';
|
||||
$user_info = Db::name('users')->alias('u')->field($field)->where('u.user_id',$this->uid)->leftJoin('buyer b','b.buyer_user_id=u.user_id')->find();
|
||||
|
||||
$system_constant = Cache::get('SYSTEM_CONSTANT')??[];
|
||||
if (!$system_constant){
|
||||
$system_constant = $this->initSysConstant();
|
||||
}
|
||||
$extend_price_rate = $system_constant['EXTEND_DISCOUNT_RATE'][$user_info['extend_level']??'level-5']??1.05;
|
||||
$user_info['extend_price_rate'] = $extend_price_rate;
|
||||
Cache::set('USER_INFO_API'.$this->uid,$user_info,360);
|
||||
}
|
||||
}
|
||||
return $user_info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\api\controller;
|
||||
use app\common\service\ExpressService;
|
||||
use app\common\service\OrderService;
|
||||
use think\Exception;
|
||||
use think\facade\Cache;
|
||||
|
||||
|
||||
|
||||
class ExpressController extends ApiController{
|
||||
|
||||
protected $noAuth = [];
|
||||
/**
|
||||
* @apiDefine Express 物流
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /Express/get_express 1.物流查询(李程)
|
||||
* @apiName get_express
|
||||
* @apiGroup Express
|
||||
* @apiParam {Int} exp_num 物流单号
|
||||
* @apiParam {String} exp_type 物流类型
|
||||
* @apiParam {String} type 类型 get_type物流厂商 get_detail物流详情[get_detail]
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {}
|
||||
}
|
||||
*/
|
||||
|
||||
public function get_express(){
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data['order_info'] = model(OrderService::class)->orderDetail($parames);
|
||||
$data['express_info'] = model(ExpressService::class)->get_express($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_ILLEGAL, $exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
540
金壶/ydyd_service/application/api/controller/GoodsController.php
Normal file
540
金壶/ydyd_service/application/api/controller/GoodsController.php
Normal file
File diff suppressed because one or more lines are too long
354
金壶/ydyd_service/application/api/controller/IndexController.php
Normal file
354
金壶/ydyd_service/application/api/controller/IndexController.php
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\MessageService;
|
||||
use think\Exception;
|
||||
|
||||
class MessageController extends ApiController
|
||||
{
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiDefine Message 消息管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /message/send 1.发送消息(朱晓伟)
|
||||
* @apiName send
|
||||
* @apiGroup Message
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} user_id 用户id
|
||||
* @apiParam {Int} biz_type 业务类型 1:订单,2:企业认证,3售后服务
|
||||
* @apiParam {Int} biz_id 业务id
|
||||
* @apiParam {String} biz_title 业务描述
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"message_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function send() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$data = model(MessageService::class)->send($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} /message/getList 2.消息列表(朱晓伟)
|
||||
* @apiName getList
|
||||
* @apiGroup Message
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} [limit] 每页多少条(默认20)
|
||||
* @apiParam {Int} [page] 当前页(默认1)
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"total": 1,
|
||||
"per_page": 20,
|
||||
"current_page": 1,
|
||||
"last_page": 1,
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"biz_type": 1,
|
||||
"biz_id": 1,
|
||||
"biz_title": "这只是一个测试",
|
||||
"is_read": 0,
|
||||
"create_time": "2020-04-16",
|
||||
"biz_type_text": "订单信息"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getList() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(MessageService::class)->getList($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
} catch (Exception $exception) {
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
125
金壶/ydyd_service/application/api/controller/OauthController.php
Normal file
125
金壶/ydyd_service/application/api/controller/OauthController.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Exception;
|
||||
use think\facade\Request;
|
||||
use think\facade\Cache;
|
||||
|
||||
/**
|
||||
* API鉴权验证
|
||||
*/
|
||||
class OauthController
|
||||
{
|
||||
use SendController;
|
||||
|
||||
/**
|
||||
* accessToken存储前缀
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $accessTokenPrefix = 'accessToken_';
|
||||
|
||||
/**
|
||||
* 过期时间秒数
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $expires = 7200;
|
||||
|
||||
/**
|
||||
* 认证授权 通过用户信息和路由
|
||||
*/
|
||||
final function authenticate()
|
||||
{
|
||||
return self::certification(self::getClient());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param Request $request
|
||||
* @return $this
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getClient()
|
||||
{
|
||||
//获取头部信息
|
||||
try {
|
||||
$request = Request::instance();
|
||||
$authorization = $request->header('authentication'); //获取请求中的authentication字段,值形式为USERID asdsajh..这种形式
|
||||
$authorization = explode(" ", $authorization); //explode分割,获取后面一窜base64加密数据
|
||||
$authorizationInfo = explode("-", base64_decode($authorization[1])); //对base_64解密,获取到用:拼接的自字符串,然后分割,可获取appid、accesstoken、uid这三个参数
|
||||
$clientInfo['appid'] = $authorizationInfo[0];
|
||||
$clientInfo['uid'] = $authorizationInfo[1];
|
||||
$clientInfo['access_token'] = $authorizationInfo[2];
|
||||
$clientInfo['refresh_token'] = $authorizationInfo[3];
|
||||
return $clientInfo;
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息后 验证权限
|
||||
* @return mixed
|
||||
*/
|
||||
public static function certification($data = []){
|
||||
$getCacheAccessToken = Cache::get(TokenController::$accessTokenPrefix . $data['access_token']); //获取缓存access_token
|
||||
return $getCacheAccessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息后 验证权限
|
||||
* @return mixed
|
||||
*/
|
||||
public static function certificationToken($data = []){
|
||||
$token = Cache::get(TokenController::$refreshAccessTokenPrefix.$data['refresh_token']);
|
||||
return $token ? $token : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测当前控制器和方法是否匹配传递的数组
|
||||
*
|
||||
* @param array $arr 需要验证权限的数组
|
||||
* @return boolean
|
||||
*/
|
||||
public static function match($arr = [])
|
||||
{
|
||||
$request = Request::instance();
|
||||
$arr = is_array($arr) ? $arr : explode(',', $arr);
|
||||
if (!$arr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$arr = array_map('strtolower', $arr);
|
||||
// 是否存在
|
||||
if (in_array(strtolower($request->action()), $arr) || in_array('*', $arr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 没找到匹配
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
* _字符开头的变量不参与签名
|
||||
*/
|
||||
public static function makeSign ($data = [],$app_secret = '')
|
||||
{
|
||||
$clientInfo['appid'] = $data['appid'];
|
||||
$clientInfo['phone'] = $data['phone'];
|
||||
$clientInfo['password'] = $data['password'];
|
||||
$clientInfo['timestamp'] = $data['timestamp'];
|
||||
return self::_getOrderMd5($clientInfo,$app_secret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算ORDER的MD5签名
|
||||
*/
|
||||
private static function _getOrderMd5($params = [] , $app_secret = '') {
|
||||
$str = $app_secret . $params['appid'] . $params['phone'] . md5($params['password']). $params['timestamp'];
|
||||
return strtolower(md5($str));
|
||||
}
|
||||
|
||||
}
|
||||
540
金壶/ydyd_service/application/api/controller/OrderController.php
Normal file
540
金壶/ydyd_service/application/api/controller/OrderController.php
Normal file
@@ -0,0 +1,540 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\OrderService;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
class OrderController extends CommonController {
|
||||
|
||||
protected $noAuth = ['count'];
|
||||
/**
|
||||
* @apiDefine Order 订单管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /order/index 1.订单列表(朱晓伟)
|
||||
* @apiName index
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} [limit] 每页多少条(默认20)
|
||||
* @apiParam {Int} [page] 当前页(默认1)
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": [
|
||||
{
|
||||
"order_id": 403,
|
||||
"order_sn": "20040111571980298718",
|
||||
"status": 6,
|
||||
"pay_type": 2,
|
||||
"pay_status": 1,
|
||||
"express_status": 0,
|
||||
"express_name": "",
|
||||
"express_sn": "",
|
||||
"shipping_fee": "1.00",
|
||||
"pay_voucher": "",
|
||||
"goods_amount": "180500.00",
|
||||
"total_amount": "180501.00",
|
||||
"create_time": "2020-04-01 11:57:34",
|
||||
"deadline_time": "2020-05-01 11:57:34",
|
||||
"order_contract_url": "",
|
||||
"need_cs_confirm": 0,
|
||||
"cancel_flag": 0,
|
||||
"need_pay": 0,
|
||||
"agent": 0,
|
||||
"order_status_str": "待收货",
|
||||
"order_status": 2,
|
||||
"goods_list": [
|
||||
{
|
||||
"order_id": 403,
|
||||
"batch_id": "2149",
|
||||
"type": "",
|
||||
"extend_data": null,
|
||||
"goods_number": 100,
|
||||
"name": "不正常人类研究用药",
|
||||
"unit": "支",
|
||||
"spec_desc": "100*100ml",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1566891904416.jpg"
|
||||
},
|
||||
{
|
||||
"order_id": 403,
|
||||
"batch_id": "2177",
|
||||
"type": "",
|
||||
"extend_data": null,
|
||||
"goods_number": 400,
|
||||
"name": "手疼药",
|
||||
"unit": "板",
|
||||
"spec_desc": "0.1g*100板",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1568255630161.jpg"
|
||||
},
|
||||
{
|
||||
"order_id": 403,
|
||||
"batch_id": "2167",
|
||||
"type": "",
|
||||
"extend_data": null,
|
||||
"goods_number": 500,
|
||||
"name": "复古糖片新药",
|
||||
"unit": "盒",
|
||||
"spec_desc": "16粒*2板",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1568019676054.png"
|
||||
},
|
||||
{
|
||||
"order_id": 403,
|
||||
"batch_id": "871",
|
||||
"type": "",
|
||||
"extend_data": null,
|
||||
"goods_number": 80,
|
||||
"name": "匹多莫德口服溶液",
|
||||
"unit": "盒",
|
||||
"spec_desc": "10ml:0.4g*6支",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1545011228838.jpg"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"order_id": 339,
|
||||
"order_sn": "19072216006840298102",
|
||||
"status": 0,
|
||||
"pay_type": 2,
|
||||
"pay_status": 0,
|
||||
"express_status": 0,
|
||||
"express_name": "",
|
||||
"express_sn": "",
|
||||
"shipping_fee": "0.00",
|
||||
"pay_voucher": "",
|
||||
"goods_amount": "10024.00",
|
||||
"total_amount": "10024.00",
|
||||
"create_time": "2019-07-22 16:00:21",
|
||||
"deadline_time": "2019-08-21 16:00:21",
|
||||
"order_contract_url": "",
|
||||
"need_cs_confirm": 0,
|
||||
"cancel_flag": 0,
|
||||
"need_pay": 0,
|
||||
"agent": 0,
|
||||
"order_status_str": "已取消",
|
||||
"order_status": 3,
|
||||
"goods_list": [
|
||||
{
|
||||
"order_id": 339,
|
||||
"batch_id": "892",
|
||||
"type": "",
|
||||
"extend_data": null,
|
||||
"goods_number": 200,
|
||||
"name": "双氯芬酸钠缓释胶囊",
|
||||
"unit": "盒",
|
||||
"spec_desc": "50mg*20s",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1543914540595.jpg"
|
||||
},
|
||||
{
|
||||
"order_id": 339,
|
||||
"batch_id": "f4a0597e522059201811031",
|
||||
"type": "extend",
|
||||
"extend_data": "{\"name\": \"黄柏胶囊\", \"unit\": \"盒\", \"price\": \"5.50\", \"sketch\": \"黄柏胶囊\", \"gallery\": [\"http://hyey.cn/uploadpic/400/a0597/e522059/e522059_0.jpg\"], \"can_show\": 1, \"drug_form\": \"胶囊剂\", \"spec_desc\": \"12s*3板\", \"stock_num\": \"900\", \"pc_content\": \"\", \"retail_num\": 10, \"show_price\": \"12.50\", \"retail_flag\": 1, \"batch_number\": \"20181103\", \"country_code\": \"Z61021657\", \"entirety_num\": 300, \"term_validity\": \"2020-11-08\", \"show_price_int\": \"12\", \"extend_goods_id\": \"f4a0597e522059201811031\", \"show_price_float\": \"50\", \"manufacturer_name\": \"陕西盘龙药业集团股份有限公司\"}",
|
||||
"goods_number": 300,
|
||||
"name": "黄柏胶囊",
|
||||
"unit": "盒",
|
||||
"spec_desc": "12s*3板",
|
||||
"pc_thumb": "http://hyey.cn/uploadpic/400/a0597/e522059/e522059_0.jpg"
|
||||
},
|
||||
{
|
||||
"order_id": 339,
|
||||
"batch_id": "b8a0597e522051201712011",
|
||||
"type": "extend",
|
||||
"extend_data": "{\"name\": \"丹七片\", \"unit\": \"盒\", \"price\": \"14\", \"sketch\": \"丹七片\", \"gallery\": [\"http://hyey.cn/uploadpic/400/a0597/e522051/e522051_0.jpg\"], \"can_show\": 1, \"drug_form\": \"片剂\", \"spec_desc\": \"0.3g*18s*2板\", \"stock_num\": \"1200\", \"pc_content\": \"\", \"retail_num\": 10, \"show_price\": \"49.98\", \"retail_flag\": 1, \"batch_number\": \"20171201\", \"country_code\": \"Z61021166\", \"entirety_num\": 300, \"term_validity\": \"2020-11\", \"show_price_int\": \"49\", \"extend_goods_id\": \"b8a0597e522051201712011\", \"show_price_float\": \"98\", \"manufacturer_name\": \"陕西盘龙药业集团股份有限公司\"}",
|
||||
"goods_number": 300,
|
||||
"name": "丹七片",
|
||||
"unit": "盒",
|
||||
"spec_desc": "0.3g*18s*2板",
|
||||
"pc_thumb": "http://hyey.cn/uploadpic/400/a0597/e522051/e522051_0.jpg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->getOrderList($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} /order/detail 2.订单详情(朱晓伟)
|
||||
* @apiName detail
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} id 订单id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"invalid_order_goods": [],
|
||||
"buyer_info": {
|
||||
"organization_code": "7864654665456",
|
||||
"invoice_title": "测试企业"
|
||||
},
|
||||
"user_address": {
|
||||
"area_id": 3,
|
||||
"address": "广东省汕头市南澳县撒打算",
|
||||
"consignee": "阿达",
|
||||
"tel": "17605052525"
|
||||
},
|
||||
"order_goods": [
|
||||
{
|
||||
"goods_id": "1744",
|
||||
"batch_id": "2149",
|
||||
"unit_price": "1500.00",
|
||||
"spread_unit_price": "0.00",
|
||||
"spread_flag": 0,
|
||||
"type": "",
|
||||
"goods_number": 100,
|
||||
"is_delete": 0,
|
||||
"name": "不正常人类研究用药",
|
||||
"spec_desc": "100*100ml",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1566891904416.jpg",
|
||||
"app_thumb": "",
|
||||
"batch_number": "PC20190827",
|
||||
"manufacturer_name": "安徽双鹤药业有限责任公司",
|
||||
"term_validity": "2022-08-31",
|
||||
"retail_flag": 0,
|
||||
"total": "150000.00"
|
||||
},
|
||||
{
|
||||
"goods_id": "1770",
|
||||
"batch_id": "2177",
|
||||
"unit_price": "20.00",
|
||||
"spread_unit_price": "0.00",
|
||||
"spread_flag": 0,
|
||||
"type": "",
|
||||
"goods_number": 400,
|
||||
"is_delete": 0,
|
||||
"name": "手疼药",
|
||||
"spec_desc": "0.1g*100板",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1568255630161.jpg",
|
||||
"app_thumb": "",
|
||||
"batch_number": "2022",
|
||||
"manufacturer_name": " 广东宏盈科技有限公司 ",
|
||||
"term_validity": "2023-09-13",
|
||||
"retail_flag": 1,
|
||||
"total": "8000.00"
|
||||
},
|
||||
{
|
||||
"goods_id": "1766",
|
||||
"batch_id": "2167",
|
||||
"unit_price": "43.40",
|
||||
"spread_unit_price": "0.00",
|
||||
"spread_flag": 0,
|
||||
"type": "",
|
||||
"goods_number": 500,
|
||||
"is_delete": 0,
|
||||
"name": "复古糖片新药",
|
||||
"spec_desc": "16粒*2板",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1568019676054.png",
|
||||
"app_thumb": "",
|
||||
"batch_number": "2019090702",
|
||||
"manufacturer_name": "安徽安科余良卿药业有限公司",
|
||||
"term_validity": "2020-09-30",
|
||||
"retail_flag": 1,
|
||||
"total": "21700.00"
|
||||
},
|
||||
{
|
||||
"goods_id": "470",
|
||||
"batch_id": "871",
|
||||
"unit_price": "10.00",
|
||||
"spread_unit_price": "0.00",
|
||||
"spread_flag": 0,
|
||||
"type": "",
|
||||
"goods_number": 80,
|
||||
"is_delete": 0,
|
||||
"name": "匹多莫德口服溶液",
|
||||
"spec_desc": "10ml:0.4g*6支",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/pc_shop_thumb_url_1545011228838.jpg",
|
||||
"app_thumb": "",
|
||||
"batch_number": "2017060303",
|
||||
"manufacturer_name": "江苏吴中医药集团有限公司苏州制药厂",
|
||||
"term_validity": "2019-06-02",
|
||||
"retail_flag": 1,
|
||||
"total": "800.00"
|
||||
}
|
||||
],
|
||||
"order_detail": {
|
||||
"order_id": 403,
|
||||
"order_sn": "20040111571980298718",
|
||||
"status": 6,
|
||||
"pay_type": 2,
|
||||
"pay_status": 1,
|
||||
"express_status": 0,
|
||||
"shipping_fee": "1.00",
|
||||
"goods_amount": "180500.00",
|
||||
"total_amount": "180501.00",
|
||||
"address_id": 141,
|
||||
"express_name": "",
|
||||
"express_sn": "",
|
||||
"create_time": "2020-04-01 11:57:34",
|
||||
"shipping_time": "2020-04-13 11:31:02",
|
||||
"pay_time": "2020-04-01 13:42:56",
|
||||
"finished_time": "0000-01-01 00:00:00",
|
||||
"deadline_time": "2020-05-01 11:57:34",
|
||||
"remark": "",
|
||||
"count_down": 0,
|
||||
"agent": 2,
|
||||
"order_status_str": "待收货",
|
||||
"order_status": 2,
|
||||
"can_pay": 0,
|
||||
"need_cs_confirm": 0,
|
||||
"cancel_flag": 0
|
||||
},
|
||||
"cancel_reason": null
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function detail() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->orderDetail($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} /order/submit 3.创建订单(朱晓伟)
|
||||
* @apiName submit
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} id_group 购物车ID集合 例如"1,2,3,4"
|
||||
* @apiParam {String} address 详细地址
|
||||
* @apiParam {String} consignee 收货人
|
||||
* @apiParam {String} tel 收货人电话
|
||||
* @apiParam {String} remark 备注
|
||||
* @apiParam {Int} area_id 区域id
|
||||
* @apiParam {Int} total_number 总货数
|
||||
* @apiParam {Int} total_amount 总价格
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {"order_id":1}}
|
||||
* */
|
||||
public function submit() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$parames['extend_level'] = Db::name('buyer')->where('buyer_user_id',$this->uid)->value('extend_level');
|
||||
$parames['user_info'] = $this->getUserInfo();
|
||||
$data = model(OrderService::class)->submitOrder($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
} catch (Exception $exception) {
|
||||
$code = $exception->getCode()??0;
|
||||
if($code){
|
||||
$res['errcode'] = $code;
|
||||
$res['errmsg'] = $exception->getMessage();
|
||||
return self::returnMsg(self::SUCCESS, $exception->getMessage(),$res);
|
||||
}
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /order/preview 4.预览订单(朱晓伟)
|
||||
* @apiName preview
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} id_group 购物车ID集合 例如"1,2,3,4"
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"address": {
|
||||
"id": 141,
|
||||
"area_id": 3,
|
||||
"address": "广东省汕头市南澳县撒打算",
|
||||
"consignee": "阿达",
|
||||
"tel": "17605052525"
|
||||
},
|
||||
"goods_list": {
|
||||
"plat": [{
|
||||
"id": 106,
|
||||
"goods_number": 10,
|
||||
"unit_price": "1.87",
|
||||
"goods_name": "丙酸氯倍他索乳膏",
|
||||
"country_code": "H31022876",
|
||||
"drug_form": "乳膏剂",
|
||||
"unit": "支",
|
||||
"spec_desc": "10g:2mg",
|
||||
"manufacturer_name": "上海新亚药业闵行有限公司",
|
||||
"pc_thumb": "www.hyey.cn\/uploadpic\/600\/a0953\/3359054\/3359054_0.jpg",
|
||||
"app_thumb": "www.hyey.cn\/uploadpic\/600\/a0953\/3359054\/3359054_0.jpg",
|
||||
"batch_id": 11817,
|
||||
"retail_flag": 0,
|
||||
"batch_number": "190201",
|
||||
"retail_num": 10,
|
||||
"entirety_num": 600,
|
||||
"term_validity": "2021-01-16",
|
||||
"stock_num": 1300,
|
||||
"is_buy": 0
|
||||
}, {
|
||||
"id": 109,
|
||||
"goods_number": 100,
|
||||
"unit_price": "45.00",
|
||||
"goods_name": "复古糖片新药特制",
|
||||
"country_code": "GM201909",
|
||||
"drug_form": "胶囊剂",
|
||||
"unit": "盒",
|
||||
"spec_desc": "16粒*4板",
|
||||
"manufacturer_name": "安国市天下康制药有限公司",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1568019676054.png",
|
||||
"app_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1568019676054.png",
|
||||
"batch_id": 2168,
|
||||
"retail_flag": 0,
|
||||
"batch_number": "2019090705",
|
||||
"retail_num": 20,
|
||||
"entirety_num": 500,
|
||||
"term_validity": "2020-10-01",
|
||||
"stock_num": 625,
|
||||
"is_buy": 0
|
||||
}],
|
||||
"extend": []
|
||||
},
|
||||
"goods_amount": "4518.70",
|
||||
"total_number": 110,
|
||||
"shipping_fee": "0.00",
|
||||
"total_amount": "4518.70",
|
||||
"is_buy": 0
|
||||
}
|
||||
}
|
||||
* */
|
||||
public function preview()
|
||||
{
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->preOrder($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} /order/cancel 5.取消订单(朱晓伟)
|
||||
* @apiName cancel
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} order_id 订单id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {"order_id":1}}
|
||||
* */
|
||||
public function cancel() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->cancelOrder($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} /order/toPay 6.去支付(朱晓伟)
|
||||
* @apiName toPay
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} order_id 订单id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {"order_id":1}}
|
||||
* */
|
||||
public function toPay() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->toPay($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} /order/count 7.订单数量(朱晓伟)
|
||||
* @apiName count
|
||||
* @apiGroup Order
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": [
|
||||
{
|
||||
"order_status": 1,
|
||||
"count": 2
|
||||
},
|
||||
{
|
||||
"order_status": 2,
|
||||
"count": 2
|
||||
},
|
||||
{
|
||||
"order_status": 6,
|
||||
"count": 0
|
||||
},
|
||||
{
|
||||
"order_status": 3,
|
||||
"count": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
* */
|
||||
public function count() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$parames['order_status'] = 1;
|
||||
$data = [];
|
||||
$item['order_status'] = 1;
|
||||
$item['count'] = model(OrderService::class)->getOrderCount($parames);
|
||||
$data[] = $item;
|
||||
$parames['order_status'] = 2;
|
||||
$item['order_status'] = 2;
|
||||
$item['count'] = model(OrderService::class)->getOrderCount($parames);
|
||||
$data[] = $item;
|
||||
$parames['order_status'] = 6;
|
||||
$item['order_status'] = 6;
|
||||
$item['count'] = model(OrderService::class)->getOrderCount($parames);
|
||||
$data[] = $item;
|
||||
$parames['order_status'] = 3;
|
||||
$item['order_status'] = 3;
|
||||
$item['count'] = model(OrderService::class)->getOrderCount($parames);
|
||||
$data[] = $item;
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
} catch (Exception $exception) {
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
140
金壶/ydyd_service/application/api/controller/PayController.php
Normal file
140
金壶/ydyd_service/application/api/controller/PayController.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\PayService;
|
||||
use app\exceptions\PayException;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\facade\Config;
|
||||
use think\facade\Log;
|
||||
use wxpayNew\lib\WxPayNotify;
|
||||
use wxpayNew\WxPayConfig;
|
||||
|
||||
class PayController extends ApiController
|
||||
{
|
||||
protected $noAuth = ['aliPayCallback','wxPayCallback'];
|
||||
|
||||
/**
|
||||
* @apiDefine Pay 支付管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /pay/appPay 订单现金支付参数(朱晓伟)
|
||||
* @apiGroup Pay
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {int} order_id 订单id
|
||||
* @apiParam {int} pay_type 值1货到付款,值2线下支付,值3小程序支付,值4微信支付,值5支付宝支付
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code":200,
|
||||
"message":"成功",
|
||||
"data":{
|
||||
"aliPayInfo":"alipay_sdk=alipay-sdk-php-20161101&app_id=2016092600600876&biz_content=%7B%22subject%22%3A%22%5Cu652f%5Cu4ed8%5Cu5b9d%5Cu8ba2%5Cu5355%22%2C%22timeout_express%22%3A%22165885m%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22total_amount%22%3A%220.00%22%2C%22out_trade_no%22%3A%222019082048489749%22%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay¬ify_url=http%3A%2F%2Fapi.gamekingtao.top%2Forder-aliPay-callback&sign_type=RSA×tamp=2019-08-21+10%3A38%3A30&version=1.0&sign=fG173y4NgKrXbIpWd0gPHCUiAytfwnDzCMJo%2Fkix3r5pjohAlldgirvV9GQjD%2FrErz4jcQI9ycgrp49SuvdBBs4Ao6u1IoxFHHMHArYbsIT34yYWPvR40AsOXqmNfTyrhnUFSscIBzgQosrZ3plFlqBIqivvgQAfbrIAB8wluXRf1Nb85oQp8M69QGkoAXG51NNfOt%2Bm4cKW%2B4hdz6s2ZsbY1y7cgdtLXkHelI2duLNMWy9w%2FL6UZTUHU6xMAfYW%2BEEQPFNNgnUoet%2FrQBBS5a9jlc6zv52vb8znTId%2B9jA%2FnvdIy2SqmUNi9WTlWzJB%2B4GsG6lnC3cK6NYxPGcCpg%3D%3D",
|
||||
"wxPayInfo":{
|
||||
"errorCode":0,
|
||||
"msg":"预支付完成",
|
||||
"data":{
|
||||
"appid":"wxd8994a99ecb6c5ad",
|
||||
"partnerid":"1516520031",
|
||||
"prepayid":"wx241412507174778076f635510070001215",
|
||||
"noncestr":"6BF2268744B9D5BBDC16988546124B27",
|
||||
"package":"Sign=WXPay",
|
||||
"timestamp":"1540361565",
|
||||
"sign":"9AB0FD4246CE080A91164592E02A83BA",
|
||||
"pay_type":2,
|
||||
"out_trade_no":"w20181024141245529843"
|
||||
}
|
||||
},
|
||||
"pay_type":"1",
|
||||
"out_trade_no":"2019082048489749"
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function appPay()
|
||||
{
|
||||
try{
|
||||
$order_id = input('param.order_id');
|
||||
$payType = input('param.pay_type');
|
||||
$user_id = $this->uid;
|
||||
$order = Db::name('order_info')->where('user_id',$user_id)->where('order_id',$order_id)->find();
|
||||
|
||||
if($order['pay_status'] != 0)
|
||||
{
|
||||
throw new Exception(self::getMessage('ERR_ORDER_STATUS_ERROR'), self::ERR_ORDER_STATUS_ERROR);
|
||||
}
|
||||
switch($payType)
|
||||
{
|
||||
case 1://货到付款
|
||||
$data['pay_type'] = $payType;
|
||||
$data['status'] = 6;
|
||||
Db::name('order_info')->where('user_id',$user_id)->where('order_id',$order_id)->update($data);
|
||||
break;
|
||||
case 2://线下支付
|
||||
$data['pay_type'] = $payType;
|
||||
$data['status'] = 6;
|
||||
Db::name('order_info')->where('user_id',$user_id)->where('order_id',$order_id)->update($data);
|
||||
break;
|
||||
case 3://小程序支付
|
||||
|
||||
break;
|
||||
case 4://微信支付
|
||||
$data['wxPayInfo'] = model(PayService::class)->wxPayInfo($order);
|
||||
break;
|
||||
case 5://支付宝支付
|
||||
$data['aliPayInfo'] = model(PayService::class)->aliPayInfo($order);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('支付方式有误');
|
||||
}
|
||||
$data['pay_type'] = $payType;
|
||||
$data['out_trade_no'] = $order['order_sn'];
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg(self::ERR_ORDER_STATUS_ERROR, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function aliPayCallback(){
|
||||
$result = false;
|
||||
try{
|
||||
$params = $_POST;
|
||||
$result = model(PayService::class)->aliPayCallback($params);
|
||||
} catch (PayException $e) {
|
||||
Log::error('支付宝支付失败');
|
||||
$result = false;
|
||||
} catch (\app\exceptions\Exception $e) {
|
||||
//TODO 进来的订单是待支付状态
|
||||
Log::error('支付宝回调失败');
|
||||
Log::error($e->getMessage());
|
||||
$returnData = $e->getReturnData();
|
||||
model(PayService::class)->aliPayRefund($returnData);
|
||||
$result = false;
|
||||
} finally {
|
||||
if($result)
|
||||
{
|
||||
echo "success";
|
||||
}else{
|
||||
echo "fail";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function wxPayCallback(){
|
||||
try{
|
||||
Log::info("进入微信支付回调");
|
||||
$config = Config::pull('wxpay');
|
||||
$wxConfig = new WxPayConfig($config);
|
||||
$notify = new WxPayNotify();
|
||||
$notify->Handle($wxConfig);
|
||||
} catch (PayException $e) {
|
||||
//TODO 进来的订单是待支付状态
|
||||
Log::record('微信支付失败');
|
||||
echo '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>';
|
||||
} catch (\app\exceptions\Exception $e) {
|
||||
Log::record('微信支付失败');
|
||||
model(PayService::class)->wxPayRefund($e->getReturnData());
|
||||
echo '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
trait SendController
|
||||
{
|
||||
|
||||
/**
|
||||
* 数据返回
|
||||
* @param int $code
|
||||
* @param string $message
|
||||
* @param array $data
|
||||
* @param bool $withHttp
|
||||
* @return string
|
||||
*/
|
||||
public static function returnMsg($code = 200, $message = '', $data = [], $withHttp = false)
|
||||
{
|
||||
|
||||
$return['code'] = (int)$code;
|
||||
$return['message'] = $message;
|
||||
if(is_array($data)){
|
||||
$return['data'] = $data;
|
||||
}else{
|
||||
$ob = (array)$data;
|
||||
if(empty($ob)){
|
||||
$return['data'] = (object)$data;
|
||||
}else{
|
||||
$return['data'] = $data;
|
||||
}
|
||||
}
|
||||
if (true === $withHttp) {
|
||||
return json($return)->code($code);
|
||||
}
|
||||
exit(json_encode($return,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
/** 调用APP登录 **/
|
||||
public static function echoLogin()
|
||||
{
|
||||
echo '<script>
|
||||
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
|
||||
window.webkit.messageHandlers.LoginAction.postMessage(null);
|
||||
} else if (/(Android)/i.test(navigator.userAgent)) {
|
||||
jsObject.LoginAction();
|
||||
}
|
||||
</script>';
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
226
金壶/ydyd_service/application/api/controller/ServiceController.php
Normal file
226
金壶/ydyd_service/application/api/controller/ServiceController.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\OrderService;
|
||||
use app\common\service\PayService;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class ServiceController extends ApiController
|
||||
{
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiDefine Service 售后管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /service/add 1.申请售后(朱晓伟)
|
||||
* @apiGroup Service
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {int} order_id 订单id
|
||||
* @apiParam {int} order_goods_id 订单商品id
|
||||
* @apiParam {int} order_goods_id 订单商品id
|
||||
* @apiParam {int} type 售后类型
|
||||
* @apiParam {String} reason 售后原因
|
||||
* @apiParam {String} refund_price 退款金额
|
||||
* @apiParam {String} refund_content 退款说明
|
||||
* @apiParam {Json} img 图片证明
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"service_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->addService($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /service/getList 2.售后列表(朱晓伟)
|
||||
* @apiGroup Service
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"total": 2,
|
||||
"per_page": 20,
|
||||
"current_page": 1,
|
||||
"last_page": 1,
|
||||
"data": [{
|
||||
"order_sn": "19011917229620248565",
|
||||
"name": "复方陈香胃片",
|
||||
"app_thumb": "http:\/\/",
|
||||
"pc_thumb": null,
|
||||
"spec_desc": "0.56g*48s",
|
||||
"extend_data": "{\"name\": \"复方陈香胃片\", \"unit\": \"盒\", \"price\": \"5.30\", \"sketch\": \"复方陈香胃片\", \"gallery\": [\"http:\/\/hyey.cn\/uploadpic\/400\/a0021\/7387035\/7387035_0.jpg\", \"http:\/\/hyey.cn\/uploadpic\/400\/a0021\/7387035\/7387035_1.jpg\"], \"can_show\": 1, \"drug_form\": \"片剂\", \"spec_desc\": \"0.56g*48s\", \"stock_num\": \"99999+\", \"pc_content\": \"\", \"retail_num\": \"10\", \"show_price\": \"31.70\", \"retail_flag\": 0, \"batch_number\": \"18010701\", \"country_code\": \"Z36021569\", \"entirety_num\": \"200\", \"term_validity\": \"2019-12\", \"show_price_int\": 31, \"extend_goods_id\": \"b8a00217387035180107011\", \"show_price_float\": 69, \"manufacturer_name\": \"江西天施康中药股份有限公司\"}",
|
||||
"goods_number": 10,
|
||||
"unit_price": "5.30",
|
||||
"retail_flag": "整",
|
||||
"manufacturer_name": "江西天施康中药股份有限公司",
|
||||
"id": 2,
|
||||
"order_id": 124,
|
||||
"order_goods_id": 102,
|
||||
"user_id": 298,
|
||||
"status": 1,
|
||||
"type": 0,
|
||||
"reason": null,
|
||||
"refund_price": null,
|
||||
"refund_content": null,
|
||||
"img": null,
|
||||
"admin_user_id": 0,
|
||||
"express": 0,
|
||||
"express_sn": null,
|
||||
"express_remarks": null,
|
||||
"create_time": "1970-01-01",
|
||||
"update_time": "1970-01-01",
|
||||
"delete_time": null,
|
||||
"total_price": 53,
|
||||
"status_text": "订单信息",
|
||||
"type_text": ""
|
||||
}, {
|
||||
"order_sn": "19011917229620248565",
|
||||
"name": "柴黄颗粒",
|
||||
"app_thumb": "http:\/\/ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1542080800757.jpg",
|
||||
"pc_thumb": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com\/pc_shop_thumb_url_1542080800757.jpg",
|
||||
"spec_desc": "4g*12袋",
|
||||
"extend_data": null,
|
||||
"goods_number": 200,
|
||||
"unit_price": "10.50",
|
||||
"retail_flag": "零",
|
||||
"manufacturer_name": "江西京通美联药业有限公司",
|
||||
"id": 1,
|
||||
"order_id": 124,
|
||||
"order_goods_id": 1279,
|
||||
"user_id": 298,
|
||||
"status": 1,
|
||||
"type": 0,
|
||||
"reason": null,
|
||||
"refund_price": null,
|
||||
"refund_content": null,
|
||||
"img": null,
|
||||
"admin_user_id": 0,
|
||||
"express": 0,
|
||||
"express_sn": null,
|
||||
"express_remarks": null,
|
||||
"create_time": "1970-01-01",
|
||||
"update_time": "1970-01-01",
|
||||
"delete_time": null,
|
||||
"total_price": 2100,
|
||||
"status_text": "订单信息",
|
||||
"type_text": ""
|
||||
}]
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getList()
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->getServiceList($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /service/getInfo 3.售后详情(朱晓伟)
|
||||
* @apiGroup Service
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {int} id 服务id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"service_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->getServiceInfo($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /service/express 4.提交物流(朱晓伟)
|
||||
* @apiGroup Service
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {int} id 服务id
|
||||
* @apiParam {String} express 物流公司
|
||||
* @apiParam {String} express_sn 物流单号
|
||||
* apiParam {String} [express_remarks] 物流备注
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"service_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function express()
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->submitService($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /service/cancel 5.撤销售后(朱晓伟)
|
||||
* @apiGroup Service
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {int} id 服务id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"service_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(OrderService::class)->cancelService($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
/**
|
||||
* Class SystemConstantController
|
||||
* @package app\api\controller
|
||||
* 用于app中获取系统配置常量:如对公账号信息、客服信息、服务条款、联系方式等
|
||||
*/
|
||||
class SystemConstantController extends CommonController{
|
||||
/**
|
||||
* @apiDefine SystemConstant 系统配置
|
||||
*/
|
||||
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /SystemConstant/accountInfo 1.对公账号信息(丁超)
|
||||
* @apiName accountInfo
|
||||
* @apiGroup SystemConstant
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"company_name": "安徽医点医滴电子科技有限公司",
|
||||
"company_code": "91340100395430469B",
|
||||
"account_number": "223017051221000006",
|
||||
"bank_name": "徽商银行股份有限公司肥东新城开发区支行",
|
||||
"address": "合肥市肥东县梁园镇合肥上海产业园原路口乡政府院内",
|
||||
"tel": "15155855066"
|
||||
}
|
||||
}
|
||||
*
|
||||
* @apiErrorExample Error-Respons:
|
||||
* {
|
||||
* "code": 500,
|
||||
* "message": "fail",
|
||||
* "data":{
|
||||
* "info": "Err Msg",
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function accountInfo(){
|
||||
$default = [
|
||||
"company_name"=> "安徽医点医滴电子科技有限公司",
|
||||
"company_code"=>"91340100395430469B",
|
||||
"account_number"=>"223017051221000006",
|
||||
"bank_name"=>"徽商银行股份有限公司肥东新城开发区支行",
|
||||
"address"=>"合肥市肥东县梁园镇合肥上海产业园原路口乡政府院内",
|
||||
"tel"=>"15155855066"
|
||||
];
|
||||
$data = $this->initSysConstant()['ACCOUNT_INFO_YDYD']??$default;
|
||||
return self::returnMsg(self::SUCCESS,self::getMessage('SUCCESS'),$data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Exception;
|
||||
class TestController extends ApiController {
|
||||
|
||||
protected $noAuth = ['index','getSign','getAuth'];
|
||||
/**
|
||||
* @apiDefine Test 测试接口
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /test/index 1.测试(朱晓伟)
|
||||
* @apiName index
|
||||
* @apiGroup Test
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function index() {
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /test/getSign 2.获取sign 登录(朱晓伟)
|
||||
* @apiName getSign
|
||||
* @apiGroup Test
|
||||
* @apiParam {String} account 手机号
|
||||
* @apiParam {String} password 账号密码
|
||||
* @apiParam {String} appid
|
||||
* @apiParam {String} appsercet
|
||||
* @apiParam {Integer} timestamp 时间戳
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"sign": "11420815e6b79bd3491b3664404b91fe",
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getSign() {
|
||||
try {
|
||||
$params = input('param.');
|
||||
$str = $params['appsercet'] . $params['appid'] . $params['account'] . md5($params['password']). $params['timestamp'];
|
||||
$data['sign'] = strtolower(md5($str));
|
||||
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} /test/getAuth 3.获取authentication 登录(朱晓伟)
|
||||
* @apiName getAuth
|
||||
* @apiGroup Test
|
||||
* @apiParam {String} appid
|
||||
* @apiParam {String} uid
|
||||
* @apiParam {String} access_token
|
||||
* @apiParam {String} refresh_token
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"auth": "USERID dGVzdC0yLUJ5dU8yZHNaUlFERTQ2TXAwajVGVUd4bFhTSWtDOXY4LVA5eDRkczlNODM1M2F3dlNuOHVlUUhpTlhWMkcwNnlL",
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getAuth() {
|
||||
try {
|
||||
$params = input('param.');
|
||||
$str = 'USERID '. base64_encode($params['appid'].'-'.$params['uid'].'-'.$params['access_token'].'-'.$params['refresh_token']);
|
||||
$data['auth'] = $str;
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
class ThirdApiController extends CommonController {
|
||||
/**
|
||||
* @apiDefine ThirdApi 第三方api管理
|
||||
*/
|
||||
protected $noAuth = ['getAliyunOssStsToken'];
|
||||
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /ThirdApi/getAliyunOssStsToken 1.阿里云oss(丁超)
|
||||
* @apiName getAliyunOssStsToken
|
||||
* @apiGroup ThirdApi
|
||||
* @apiHeader {String} authentication 验证
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
* "code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errcode": 0,
|
||||
"errmsg": "成功获取STS凭证",
|
||||
"data": {
|
||||
"Region": "oss-cn-hangzhou",
|
||||
"AccessKeySecret": "adfhf54775BSjQv29xLTqdTfjsdjhQxd",
|
||||
"AccessKeyId": "STS.NUq4kjdjlfjskvFddggCM5e",
|
||||
"Bucket": "abcd-develop-xxx",
|
||||
"SecurityToken": "uDox2Zt6vT8a6z6aX+safnflagPS2MvVh9aHOVWLRK3c3+klflsgyEdVGuFRQavRBnmJgrrrg+hiDkeJrgUVq3S9aHru4Z8xKKZAkc0mRJBczzseP5aYJK4"
|
||||
}
|
||||
}
|
||||
* }
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function getAliyunOssStsToken(){
|
||||
|
||||
$res = model('AliyunOss','service')->getStsToken()['data']??[];
|
||||
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$res);
|
||||
}
|
||||
}
|
||||
310
金壶/ydyd_service/application/api/controller/TokenController.php
Normal file
310
金壶/ydyd_service/application/api/controller/TokenController.php
Normal file
@@ -0,0 +1,310 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\model\UserModel;
|
||||
use think\Db;
|
||||
use think\facade\Cache;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* 生成token
|
||||
*/
|
||||
class TokenController extends ApiController
|
||||
{
|
||||
protected $noAuth = ['login','refresh'];
|
||||
/**
|
||||
* 请求时间差
|
||||
*/
|
||||
public static $timeDif = 1000000;
|
||||
|
||||
public static $accessTokenPrefix = 'accessToken_';
|
||||
public static $refreshAccessTokenPrefix = 'refreshAccessToken_';
|
||||
public static $expires = 60*60*24*7; //暂时修改60*60*24*7
|
||||
public static $refreshExpires = 60*60*24*90; //刷新token过期时间60*60*24*90
|
||||
|
||||
/**
|
||||
* 测试appid,正式请数据库进行相关验证
|
||||
*/
|
||||
public static $appid = 'test';
|
||||
/**
|
||||
* appsercet
|
||||
*/
|
||||
public static $appsercet = '123456';
|
||||
|
||||
/*获取token*/
|
||||
public function token($user,$data)
|
||||
{
|
||||
$userInfo = [
|
||||
'id' => $user['user_id'],
|
||||
'phone' => $user['phone'],
|
||||
];
|
||||
try {
|
||||
$accessToken = self::setAccessToken(array_merge($userInfo,$data));
|
||||
return $accessToken;
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg(500,'fail',$e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiDefine login 活动管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {any} / 1.整体说明(朱晓伟)
|
||||
* @apiName AAA
|
||||
* @apiGroup login
|
||||
* @apiSuccessExample Success-Response:
|
||||
* 1. 先获取token,其他接口在header里面传入authentication
|
||||
* authentication = USERID base64_encode("appid" + "-" +"uid" + "-" + "access_token" + "-" + "refresh_token") 加密后签名(参数与参数中间需要加上-号)
|
||||
* 2. 若请求地址中含有“:”,表示这个参数是在请求地址中,如:平台公告详情:/messages/platforms/:id,将:id换成不同的值,即可获得id对应的公告详情
|
||||
* 3. 状态码
|
||||
* 所有接口返回值以实际返回结果为准,接口code返回值为200,http状态码也是200表示请求成功,其他表示请求失败。
|
||||
* code值说明:
|
||||
* 401:登录相关接口验证失败时返回
|
||||
* 1xxxx:传递参数提示;
|
||||
* 2xxxx:数据验证提示;
|
||||
* 3xxxx:业务提示;
|
||||
* 4. 参数:
|
||||
* 所有请求参数,除了有“可选”的标记或列表用于搜索的参数外,其余都是必传。
|
||||
* 5. 分页参数名为page,每页展示条数由后台返回
|
||||
* {
|
||||
* "code": 200,
|
||||
* "message": "成功",
|
||||
* "data": {
|
||||
* "total": 60, // 总数据量
|
||||
* "per_page": 10, // 每页数据条数
|
||||
* "current_page": 1, // 当前页数
|
||||
* "last_page": 6, // 数据总页数
|
||||
* "data": [
|
||||
* {
|
||||
* "id": 23356,
|
||||
* ...
|
||||
* },
|
||||
* {
|
||||
* "id": 19244,
|
||||
* ...
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* 6. 各接口返回的数据中,有注释的字段都是重要或者需要可能有用的字段,未注释字段可不用理会。
|
||||
* 完善中...
|
||||
*/
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /token/login 2.获取token 登录(朱晓伟)
|
||||
* @apiName login
|
||||
* @apiGroup login
|
||||
* @apiParam {String} phone 手机号
|
||||
* @apiParam {String} password 账号密码
|
||||
* @apiParam {String} appid
|
||||
* @apiParam {Integer} timestamp 时间戳
|
||||
* @apiParam {String} sign 签名($appsercet+$appid+account+md5(password)+时间戳)
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"access_token": "GFkw82j36Tbs9JrCi5fA1I7ztmouxeX9",
|
||||
"expires_time": 1565762455,
|
||||
"refresh_token": "1xzjD8gJGlSZheH6wKu9pCfRt9rd4IoE",
|
||||
"refresh_expires_time": 1596693655,
|
||||
"client": {
|
||||
"id": 22, //员工ID
|
||||
"phone": "17610889520", //手机号码
|
||||
"appid": "tp5restfultest",
|
||||
"timestamp": 1565157655,
|
||||
"sign": "11420815e6b79bd3491b3664404b91fe",
|
||||
}
|
||||
}
|
||||
}
|
||||
* @apiErrorExample Error-Response:
|
||||
* {
|
||||
"code": 500,
|
||||
"message": "fail",
|
||||
"data": {
|
||||
"info": "短信验证码错误,请重新获取"
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function login(){
|
||||
|
||||
try {
|
||||
$params = input('');
|
||||
self::checkParams($params); //参数校验
|
||||
|
||||
$user = Db::name("users")->where('phone',$params['phone'])->find();
|
||||
$pwd = md5($params['password'].$user['secure_password_key']);
|
||||
if($pwd != $user['password']){
|
||||
return self::returnMsg(401,'账号密码有误',[]);
|
||||
}
|
||||
$accessToken = self::token($user,$params);
|
||||
return self::returnMsg(ApiController::SUCCESS, ApiController::getMessage('SUCCESS'),$accessToken);
|
||||
} catch (Exception $e) {
|
||||
return self::returnMsg($e->getCode(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /token/refresh 3.刷新token (朱晓伟)
|
||||
* @apiName refresh
|
||||
* @apiGroup login
|
||||
* @apiParam {String} refresh_token 参数说明
|
||||
* @apiParam {String} appid 参数说明
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"access_token": "1JGKFnYE8N6C2mAvyk9lpSHZoz4WhId8",
|
||||
"expires_time": 1565852253,
|
||||
"refresh_token": "1xzjD8gJGlSZheH6wKu9pCfRt9rd4IoE",
|
||||
"refresh_expires_time": 1596783453,
|
||||
"client": {
|
||||
"appid": "tp5restfultest"
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function refresh()
|
||||
{
|
||||
$refresh_token = input('refresh_token');
|
||||
$cache_refresh_token = Cache::get(self::$refreshAccessTokenPrefix.$refresh_token); //查看刷新token是否存在
|
||||
if(!$cache_refresh_token){
|
||||
return self::returnMsg(ApiController::ERR_USER_REFRESH_TOKEN_EXPIRE,ApiController::getMessage('ERR_USER_REFRESH_TOKEN_EXPIRE'),[]);
|
||||
}else{
|
||||
if($cache_refresh_token['refresh_token'] !== $refresh_token){
|
||||
return self::returnMsg(ApiController::ERR_USER_TOKEN,ApiController::getMessage('ERR_USER_TOKEN'),[]);
|
||||
}else{ //重新给用户生成调用token
|
||||
$accessToken = self::setAccessToken($cache_refresh_token,$refresh_token);
|
||||
return self::returnMsg(ApiController::SUCCESS, ApiController::getMessage('SUCCESS'),$accessToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数检测
|
||||
*/
|
||||
public static function checkParams($params = [])
|
||||
{
|
||||
//手机号校验
|
||||
if(!$params['phone']){
|
||||
throw new Exception('手机号不能为空',401);
|
||||
}
|
||||
//密码校验
|
||||
if(!$params['password']){
|
||||
throw new Exception('密码不能为空',401);
|
||||
}
|
||||
|
||||
//时间戳校验
|
||||
if(abs($params['timestamp'] - time()) > self::$timeDif){
|
||||
throw new Exception('登录验证异常',401);//'timestamp:'.time()
|
||||
}
|
||||
|
||||
//appid检测,这里是在本地进行测试,正式的应该是查找数据库或者redis进行验证
|
||||
if($params['appid'] !== self::$appid){
|
||||
throw new Exception('登录验证异常',401);
|
||||
}
|
||||
//签名检测
|
||||
$sign = OauthController::makeSign($params,self::$appsercet);
|
||||
if($sign !== $params['sign']){
|
||||
throw new Exception('登录验证异常',401);
|
||||
}
|
||||
}
|
||||
|
||||
/**设置AccessToken
|
||||
* @param $clientInfo
|
||||
* @param null $refresh_token
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
|
||||
protected function setAccessToken($clientInfo,$refresh_token = null)
|
||||
{
|
||||
//生成令牌
|
||||
unset($clientInfo['password']);
|
||||
$accessToken = self::buildAccessToken();
|
||||
if(!$refresh_token){
|
||||
$refresh_token = self::buildAccessToken();
|
||||
}else{
|
||||
$refresh = self::getRefreshTokenInfo($refresh_token);
|
||||
$clientInfo = $refresh['client'];
|
||||
}
|
||||
$accessTokenInfo = [
|
||||
'access_token' => $accessToken,//访问令牌
|
||||
'expires_time' => time() + self::$expires, //过期时间时间戳
|
||||
'refresh_token' => $refresh_token,//刷新的token
|
||||
'refresh_expires_time' => time() + self::$refreshExpires, //过期时间时间戳
|
||||
'client' => $clientInfo,//用户信息
|
||||
];
|
||||
self::saveAccessToken($accessToken, $accessTokenInfo); //保存本次token
|
||||
self::saveRefreshToken($refresh_token,$accessTokenInfo); //保存本次refresh_token
|
||||
$res = UserModel::field('access_token,refresh_token')->where(['user_id'=>$clientInfo['id']])->find();//查询用户token refresh_token
|
||||
if($res){//如果存在 则清除之前的缓存
|
||||
Cache::rm(self::$accessTokenPrefix.$res['access_token']);
|
||||
Cache::rm(self::$refreshAccessTokenPrefix.$res['refresh_token']);
|
||||
Cache::rm('USER_INFO_API'.$clientInfo['id']);
|
||||
}
|
||||
UserModel::update(['access_token'=>$accessToken,'refresh_token'=>$refresh_token],['user_id'=>$clientInfo['id']]);//保存token和refresh_token到数据库,用于单点登录
|
||||
return $accessTokenInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新用的token检测是否还有效
|
||||
*/
|
||||
public static function getRefreshToken($appid = '')
|
||||
{
|
||||
$token = Cache::get(self::$refreshAccessTokenPrefix.$appid);
|
||||
return $token ? $token['refresh_token'] : self::buildAccessToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新用的token检测是否还有效
|
||||
*/
|
||||
public static function getRefreshTokenInfo($refresh_token)
|
||||
{
|
||||
$refresh = Cache::get(self::$refreshAccessTokenPrefix.$refresh_token);
|
||||
return $refresh ? $refresh : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成AccessToken
|
||||
* @return string
|
||||
*/
|
||||
protected static function buildAccessToken($lenght = 32)
|
||||
{
|
||||
//生成AccessToken
|
||||
$str_pol = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmnopqrstuvwxyz";
|
||||
return substr(str_shuffle($str_pol), 0, $lenght);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储token
|
||||
* @param $accessToken
|
||||
* @param $accessTokenInfo
|
||||
*/
|
||||
protected static function saveAccessToken($accessToken, $accessTokenInfo)
|
||||
{
|
||||
//存储accessToken
|
||||
Cache::set(self::$accessTokenPrefix . $accessToken, $accessTokenInfo, self::$expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储refreshToken
|
||||
* @param $refresh_token
|
||||
* @param $accessTokenInfo
|
||||
*/
|
||||
protected static function saveRefreshToken($refresh_token,$accessTokenInfo)
|
||||
{
|
||||
//存储RefreshToken
|
||||
Cache::set(self::$refreshAccessTokenPrefix.$refresh_token, $accessTokenInfo,self::$refreshExpires);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\common\validate\useraddress\UserAddressValidate;
|
||||
|
||||
class UserAddressController extends ApiController
|
||||
{
|
||||
// protected $noAuth = ['addresss'];
|
||||
|
||||
/**
|
||||
* @apiDefine UserAddress 地址管理
|
||||
*/
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /UserAddress/getAddressList 1.地址列表(李程)
|
||||
* @apiName getAddressList
|
||||
* @apiGroup UserAddress
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
"data": {
|
||||
"list": [
|
||||
{
|
||||
"id": 187,
|
||||
"area_id": 1453,
|
||||
"address": "合肥市包河区",
|
||||
"consignee": "李先生",
|
||||
"tel": "15056810203",
|
||||
"is_default": 0,
|
||||
"area_name": "上海市 - 上海城区 - 长宁区",
|
||||
"short_consignee": "李先"
|
||||
},
|
||||
{
|
||||
"id": 188,
|
||||
"area_id": 1453,
|
||||
"address": "合肥瑶海",
|
||||
"consignee": "李先生啊",
|
||||
"tel": "15056810203",
|
||||
"is_default": 0,
|
||||
"area_name": "上海市 - 上海城区 - 长宁区",
|
||||
"short_consignee": "李先"
|
||||
}
|
||||
],
|
||||
"has_address_num": 2,
|
||||
"left_address_num": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//获取地址列表
|
||||
public function getAddressList(){
|
||||
$res_return = model("UserAddress","service")->getAddressList($this->uid);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $res_return);
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /UserAddress/setDefaultAddress 2.设置默认地址(李程)
|
||||
* @apiName setDefaultAddress
|
||||
* @apiGroup UserAddress
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} address_id 地址id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errmsg": "默认地址设置成功"
|
||||
}
|
||||
}
|
||||
*/
|
||||
//设置默认地址
|
||||
public function setDefaultAddress(UserAddressValidate $validate){
|
||||
//参数验证
|
||||
$validate->checkParam('userAddress_setDefaultAddress');
|
||||
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$res_return = model('UserAddress', 'service')->setDefaultAddress($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $res_return);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /UserAddress/makeChangeAddress 3.更新或者新增收货地址(李程)
|
||||
* @apiName makeChangeAddress
|
||||
* @apiGroup UserAddress
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} area_id '区县
|
||||
* @apiParam {String} address 详细地址
|
||||
* @apiParam {Int} address_id 地址id
|
||||
* @apiParam {String} consignee 收件人名称
|
||||
* @apiParam {String} tel 收件人联系电话
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errcode": 0,
|
||||
"errmsg": "操作成功",
|
||||
"data": {
|
||||
"id": "188"
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//更新或者新增收货地址
|
||||
public function makeChangeAddress(UserAddressValidate $validate){
|
||||
$validate->checkParam('UserAddress_makeChangeAddress');
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$res_return = model('UserAddress', 'service')->makeChangeAddress($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $res_return);
|
||||
|
||||
}
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /UserAddress/deleteAddress 4.删除用户配送地址(李程)
|
||||
* @apiName deleteAddress
|
||||
* @apiGroup UserAddress
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} address_id 地址id
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"errmsg": "删除操作成功"
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* 删除用户配送地址 */
|
||||
public function deleteAddress(UserAddressValidate $validate){
|
||||
// $this->checkParam($validate,'identifier');
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$res_return = model('UserAddress', 'service')->deleteAddress($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $res_return);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /UserAddress/addresss 5.地区三级地址(李程)
|
||||
* @apiName addresss
|
||||
* @apiGroup UserAddress
|
||||
* @apiHeader {String} authentication 验证id
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"1": {
|
||||
"id": 1,
|
||||
"area_name": "广东省"
|
||||
},
|
||||
"205": {
|
||||
"id": 205,
|
||||
"area_name": "河南省"
|
||||
},
|
||||
"397": {
|
||||
"id": 397,
|
||||
"area_name": "内蒙古自治区"
|
||||
},
|
||||
"513": {
|
||||
"id": 513,
|
||||
"area_name": "黑龙江省"
|
||||
}
|
||||
}
|
||||
}
|
||||
* */
|
||||
public function addresss(){
|
||||
$res_return = model('UserAddress','service')->addresss();
|
||||
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $res_return);
|
||||
}
|
||||
|
||||
}
|
||||
380
金壶/ydyd_service/application/api/controller/UserController.php
Normal file
380
金壶/ydyd_service/application/api/controller/UserController.php
Normal file
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\UserService;
|
||||
use app\ydyd_service\model\BuyerModel;
|
||||
use app\ydyd_service\model\UserCertificateModel;
|
||||
use app\ydyd_service\service\UserActionService;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\facade\Config;
|
||||
use think\Request;
|
||||
|
||||
class UserController extends ApiController
|
||||
{
|
||||
protected $noAuth = ['register_app','phonecode_app','forgetPassword_app','tell','editPassword'];
|
||||
/**
|
||||
* @apiDefine User 用户管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /user/register_app 1.注册(李程)
|
||||
* @apiName register_app
|
||||
* @apiGroup User
|
||||
* @apiParam {Int} phone 手机号
|
||||
* @apiParam {Int} smscode 收到的验证码
|
||||
* @apiParam {String} password 密码
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{"code":200,"message":"成功","data":{"errmsg":"用户注册成功"}}
|
||||
*/
|
||||
public function register_App()
|
||||
{
|
||||
|
||||
try {
|
||||
$post = $this->request->param('');
|
||||
|
||||
$data = model(UserActionService::class)->register_App($post);
|
||||
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} /user/phonecode_app 2.手机验证码(李程)
|
||||
* @apiName phonecode_app
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} phone 手机号
|
||||
* @apiParam {Int} smscode 收到的验证码
|
||||
* @apiParam {int} status 1表示注册2表示忘记密码
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{"code":200,"message":"成功","data":{"errmsg":"短信已经发送到你的手机,请注意查收"}}
|
||||
*/
|
||||
public function phonecode_App()
|
||||
{
|
||||
|
||||
$parames = $this->request->param('');
|
||||
|
||||
$data = model(UserActionService::class)->phonecode_App($parames);
|
||||
|
||||
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /user/forgetPassword_app 3.重置密码(李程)
|
||||
* @apiName forgetPassword_app
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} phone 手机号
|
||||
* @apiParam {Int} smscode 收到的验证码
|
||||
* @apiParam {Int} password 密碼
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{"code":200,"message":"成功","data":{"errmsg":"用户找回密码成功"}}
|
||||
*/
|
||||
public function forgetPassword_app(Request $request)
|
||||
{
|
||||
$parames = $this->request->param('');
|
||||
$data = model(UserActionService::class)->forgetPassword_app($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /user/checkAuth 4.企业认证检测(朱晓伟)
|
||||
* @apiName checkAuth
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": "finish|authBaisc|authCertificate|authBank"
|
||||
}
|
||||
*/
|
||||
public function checkAuth(Request $request)
|
||||
{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->checkAuth($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {get|post} /user/authBaisc 5.企业认证第一步(基础信息 get查看 post新增|编辑)(朱晓伟)
|
||||
* @apiName authBaisc
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} sub_type 企业类型 post
|
||||
* @apiParam {String} name 企业名称 post
|
||||
* @apiParam {String} consignee 联系人 post
|
||||
* @apiParam {Int} consignee 联系人 post
|
||||
* @apiParam {String} business_address 地址 post
|
||||
* @apiParam {String} area_id 区域id post
|
||||
* @apiParam {String} service_number 客服编号 post
|
||||
* @apiSuccessExample GET Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"buyer_user_id": 298,
|
||||
"area_id": 3,
|
||||
"name": "对方水电费",
|
||||
"business_address": "",
|
||||
"sub_type": "drugstore",
|
||||
"consignee": "王子军",
|
||||
"tel": "17075808888",
|
||||
"custom_service_id": 9,
|
||||
"is_edit": false
|
||||
}
|
||||
}
|
||||
* @apiSuccessExample POST Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": true
|
||||
}
|
||||
*/
|
||||
public function authBaisc(Request $request)
|
||||
{
|
||||
if($request->isPost()){
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->authBaisc($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}else{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->viewBaisc($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {get|post} /user/authCertificate 6.企业认证第二步(资质信息 get查看 post新增|编辑)(朱晓伟)
|
||||
* @apiName authCertificate
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} sub_type 企业类型 post
|
||||
* @apiParam {String} business_license 资质url post(所有资质都按照这种格式)
|
||||
* @apiSuccessExample GET Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"list": [
|
||||
{
|
||||
"certificate_type": "business_license",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/business_license_img_url_1560330649970.jpg"
|
||||
},
|
||||
{
|
||||
"certificate_type": "gsp_license",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/gsp_license_img_url_1560330653130.jpg"
|
||||
},
|
||||
{
|
||||
"certificate_type": "trade_license",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/trade_license_img_url_1560330651312.jpg"
|
||||
},
|
||||
{
|
||||
"certificate_type": "purchase_identity",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/purchase_identity_img_url_1560330656292.jpg"
|
||||
},
|
||||
{
|
||||
"certificate_type": "authority_purchase",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/authority_purchase_img_url_1560330654577.jpg"
|
||||
},
|
||||
{
|
||||
"certificate_type": "tax_regcate",
|
||||
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/tax_regcate_img_url_1560330657786.jpg"
|
||||
}
|
||||
],
|
||||
"is_edit": true
|
||||
}
|
||||
}
|
||||
* @apiSuccessExample POST Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": true
|
||||
}
|
||||
*
|
||||
*/
|
||||
public function authCertificate(Request $request)
|
||||
{
|
||||
if($request->isPost()){
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->authCertificate($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}else{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->viewCertificate($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {get|post} /user/authBank 7.企业认证第三步(银行信息 get查看 post新增|编辑)(朱晓伟)
|
||||
* @apiName authBank
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} invoice_rise 开票抬头 post
|
||||
* @apiParam {String} tax_number 税号 post
|
||||
* @apiParam {String} [bank_name] 开户行 post
|
||||
* @apiParam {String} [bank_account] 银行账号 post
|
||||
* @apiParam {String} [account_name] 持卡人姓名 post
|
||||
* @apiSuccessExample GET Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"id": 307,
|
||||
"user_id": 298,
|
||||
"account_name": "测试",
|
||||
"bank_name": "肥东",
|
||||
"bank_account": "46546546546546",
|
||||
"create_time": "2019-06-04 16:35:22",
|
||||
"invoice_title": "测试企业",
|
||||
"tax_number": "",
|
||||
"is_edit": true
|
||||
}
|
||||
}
|
||||
* @apiSuccessExample POST Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": true
|
||||
}
|
||||
*
|
||||
*/
|
||||
public function authBank(Request $request)
|
||||
{
|
||||
if($request->isPost()){
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->authBank($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}else{
|
||||
try{
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(UserService::class)->viewBank($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
|
||||
}catch (Exception $exception){
|
||||
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /user/tell 8.获取手机号(登录时)(李程)
|
||||
* @apiName tell
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": "15056810203"
|
||||
}
|
||||
*/
|
||||
public function tell()
|
||||
{
|
||||
$phone = $this->clientInfo['phone'];
|
||||
if($phone){
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $phone);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /user/editPassword 8.修改密码(登录时)(李程)
|
||||
* @apiName editPassword
|
||||
* @apiGroup User
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {String} ordpassword 旧密码
|
||||
* @apiParam {String} password 新密码
|
||||
* @apiSuccessExample Success-Response:
|
||||
*{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": "15056810203"
|
||||
}
|
||||
*/
|
||||
public function editPassword()
|
||||
{
|
||||
//
|
||||
$params = input('');
|
||||
$params['phone'] = $this->clientInfo['phone'];
|
||||
$user = Db::name("users")->where('phone',$params['phone'])->find();
|
||||
$pwd = md5($params['ordpassword'] . $user['secure_password_key']);
|
||||
|
||||
if ($pwd != $user['password']) {
|
||||
|
||||
return self::returnMsg(401, '账号密码有误', []);
|
||||
}
|
||||
$tmp = model('User', 'service')->editPassword($params);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $tmp);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新的资源
|
||||
*
|
||||
* @param \think\Request $request
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定资源
|
||||
*
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm && wx_lql
|
||||
* Welfares.php in Project yifu => 文件描述
|
||||
* 2019/8/7 11:05
|
||||
*
|
||||
* ┏┓ ┏┓+ +
|
||||
* ┏┛┻━━━┛┻┓ + +
|
||||
* ┃ ┃
|
||||
* ┃ ━ ┃ ++ + + +
|
||||
*
|
||||
* ████━████ ┃+
|
||||
* ┃ ┃ +
|
||||
* ┃ ┻ ┃
|
||||
* ┃ ┃ + +
|
||||
* ┗━┓ ┏━┛
|
||||
* ┃ ┃
|
||||
* ┃ ┃ + + + +
|
||||
* ┃ ┃
|
||||
* ┃ ┃ + 神兽保佑
|
||||
* ┃ ┃ 代码无bug
|
||||
* ┃ ┃ +
|
||||
* ┃ ┗━━━┓ + +
|
||||
* ┃ ┣┓
|
||||
* ┃ ┏┛
|
||||
* ┗┓┓┏━┳┓┏┛ + + + +
|
||||
* ┃┫┫ ┃┫┫
|
||||
* ┗┻┛ ┗┻┛+ + + +
|
||||
*/
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
class VersionController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @apiDefine Version 版本管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* 不需要鉴权方法
|
||||
* index、save不需要鉴权
|
||||
* ['index','save']
|
||||
* 所有方法都不需要鉴权
|
||||
* [*]
|
||||
*/
|
||||
protected $noAuth = ['index'];
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {get} /version/index 版本更新检测(朱晓伟)
|
||||
* @apiName index
|
||||
* @apiGroup Version
|
||||
* @apiParam {String} [version] 当前版本号,用于版本对比,例如:1.0.0,只允许使用"."分割,不支持下划线
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
* "code": 200,
|
||||
* "message": "成功",
|
||||
* "data": {
|
||||
* "version": 1.0.1,
|
||||
* "url": "http://www.baidu.com",
|
||||
* "describe": "有重大更新啦!!",
|
||||
* "update_method": 0,// 更新方式(0:普通更新;1、强制更新)
|
||||
* }
|
||||
* }
|
||||
* @apiErrorExample Error-Response:
|
||||
* {
|
||||
* "code": 200,
|
||||
* "message": "无更新",
|
||||
* "data": {}
|
||||
* }
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$new_version = '1.4.0';
|
||||
$version =input('param.version');
|
||||
$ret['isUpdate'] = false;
|
||||
$ret['update_method'] = false;
|
||||
if(version_compare($new_version,$version) > 0){
|
||||
$data['version'] = $new_version;
|
||||
$data['url'] = 'itms-apps://apps.apple.com/cn/app/qq-2011/id444934666';
|
||||
$data['describe'] = '1.修复已知bug;
|
||||
2.细节优化;';
|
||||
$ret['iOS'] = $data;
|
||||
|
||||
$data['version'] = $new_version;
|
||||
$data['url'] = 'http://d.firim.info/aw7u';
|
||||
$data['describe'] = '1.修复已知bug;
|
||||
2.细节优化;';
|
||||
$ret['Android'] = $data;
|
||||
$ret['isUpdate'] = true;
|
||||
$ret['update_method'] = true;
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $ret);
|
||||
}
|
||||
return self::returnMsg(self::SUCCESS, '无更新',$ret);
|
||||
}
|
||||
}
|
||||
5
金壶/ydyd_service/application/api/middleware.php
Normal file
5
金壶/ydyd_service/application/api/middleware.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
\app\http\middleware\CrossDomain::class
|
||||
];
|
||||
1
金壶/ydyd_service/application/api/model/.pydio
Normal file
1
金壶/ydyd_service/application/api/model/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
91f1d2ac-e7a0-4cce-ad47-37634cead3fb
|
||||
13
金壶/ydyd_service/application/api/model/UserModel.php
Normal file
13
金壶/ydyd_service/application/api/model/UserModel.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class UserModel extends Model
|
||||
{
|
||||
// 设置当前模型对应的完整数据表名称
|
||||
protected $table = 'ydyd_users';
|
||||
protected $autoWriteTimestamp = true;
|
||||
}?>
|
||||
Reference in New Issue
Block a user