作者 郭盛
1 个管道 的构建 通过 耗费 6 秒

完成支付,订单,投诉.优惠劵等接口

<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/1/13
* Time: 15:41
*/
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
/**
* 优惠劵接口
*/
class Coupon extends Api
{
/**
* @ApiTitle (我的优惠劵列表)
* @ApiSummary (我的优惠劵列表)
* @ApiMethod (POST)
* @ApiRoute (/api/coupon/coupon_list)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果不传或者为1是结算中2是已使用3已过期)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //id,
"user_id"://用户ID
"money"://优惠劵金额,
"expirationtime"://有效期至
}
})
*/
public function coupon_list()
{
$user_id = $this->getUserId();
$type = $this->request->param('type');
if($type == '' || $type == 1){
$data = Db::name('coupon')
->field('id,user_id,money,expirationtime')
->where('is_use',0)
->where('user_id',$user_id)
->order('id desc')
->select();
}elseif ($type == 2){
$data = Db::name('coupon')
->field('id,user_id,money,expirationtime')
->where('is_use',1)
->where('user_id',$user_id)
->order('id desc')
->select();
}elseif ($type == 3){
$data = Db::name('coupon')
->field('id,user_id,money,expirationtime')
->where('is_use',2)
->where('user_id',$user_id)
->order('id desc')
->select();
}else{
$this->error('类型错误');
}
foreach ($data as &$v){
$v['expirationtime'] = date('Y-m-d H:i:s',$v['expirationtime']);
}
$this->success('success',$data);
}
/**
* @ApiTitle (我的关注)
* @ApiSummary (我的关注)
* @ApiMethod (POST)
* @ApiRoute (/api/coupon/myattention)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
*
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"attention_id"://关注ID
"id": //老师id,
"user_id"://老师的用户ID
"name"://老师名字
"sex"://性别
"birth"://出生日期
"idcard"://身份证号
"before"://身份证正面照
"behind"://身份证反面照
"phone"://手机号
"thumbnail"://头像
"address"://常住地
"honor"://头衔
"content"://个人履历
"show"://展示在最前
"desc"://个人简历
"online"://在线时段
"territory_id"://擅长领域ID
"help_num"://帮助人数
"level"://星级
"createtime"://创建时间
}
})
*/
public function myattention()
{
$user_id = $this->getUserId();
$page = $this->request->param('page', 1, 'intval');
$pageNum = $this->request->param('pageNum', 10, 'intval');
$data = Db::name('good')
->alias('a')
->join('teacher b','a.teacher_id = b.id')
->where('a.user_id',$user_id)
->field('a.id as attention_id,b.*')
->order('a.id desc')
->page($page,$pageNum)
->select();
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
foreach ($data as &$v){
//查看老师的已帮助人数以及评分星级
$comment = Db::name('comment')->where('teacher_id',$v['id'])->select();
//评价为五星的人数
$five = Db::name('comment')->where('teacher_id',$v['id'])->where('level',5)->count();
//评价为四星的人数
$four = Db::name('comment')->where('teacher_id',$v['id'])->where('level',4)->count();
//评价为三星的人数
$three = Db::name('comment')->where('teacher_id',$v['id'])->where('level',3)->count();
//评价为二星的人数
$two = Db::name('comment')->where('teacher_id',$v['id'])->where('level',2)->count();
//评价为一星的人数
$one = Db::name('comment')->where('teacher_id',$v['id'])->where('level',1)->count();
if(!empty($comment)){
$v['help_num'] = $five + $four + $three + $two + $one + $v['help_num'];
$v['level'] = ceil(($v['help_num'] * 5 + $four * 4 + $three * 3 + $two * 2 + $one)/$v['help_num']);
}
if($v['sex'] == 1){
$v['sex'] = '男';
}else{
$v['sex'] = '女';
}
$v['before'] = $http.$v['before'];
$v['behind'] = $http.$v['behind'];
$v['thumbnail'] = $http.$v['thumbnail'];
$v['territory_id'] = explode(',',$v['territory_id']);
foreach ($v['territory_id'] as &$val){
$val = Db::name('territory')
->alias('a')
->join('contype b','a.contype_id = b.id')
->where('a.id',$val)
->column('b.title');
}
}
$this->success('success',$data);
}
}
\ No newline at end of file
... ...
... ... @@ -119,6 +119,9 @@ class Index extends Api
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果为空或者为1是今日推荐列表 2是更多老师列表)")
* @ApiParams (name="keyword", type="string", required=false, description="关键字")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
*
*
* @ApiReturn({
"code": 1,
... ... @@ -151,6 +154,8 @@ class Index extends Api
public function today()
{
$token = $this->request->header('token');
$page = $this->request->param('page', 1, 'intval');
$pageNum = $this->request->param('pageNum', 10, 'intval');
//未登录的状态下
if(empty($token)){
$type = $this->request->param('type');
... ... @@ -160,6 +165,7 @@ class Index extends Api
->where('status',1)
->where('is_recommend',1)
->field('status,updatetime',true)
->page($page,$pageNum)
->select();
}else{
if(!empty($keyword)){
... ... @@ -178,6 +184,7 @@ class Index extends Api
->whereOr('honor','Like',"%$keyword%")
->whereOr('user_id','In',$territory)
->field('status,updatetime',true)
->page($page,$pageNum)
->select();
}else{
$data = Db::name('teacher')
... ... @@ -189,6 +196,22 @@ class Index extends Api
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
foreach ($data as &$v){
//查看老师的已帮助人数以及评分星级
$comment = Db::name('comment')->where('teacher_id',$v['id'])->select();
//评价为五星的人数
$five = Db::name('comment')->where('teacher_id',$v['id'])->where('level',5)->count();
//评价为四星的人数
$four = Db::name('comment')->where('teacher_id',$v['id'])->where('level',4)->count();
//评价为三星的人数
$three = Db::name('comment')->where('teacher_id',$v['id'])->where('level',3)->count();
//评价为二星的人数
$two = Db::name('comment')->where('teacher_id',$v['id'])->where('level',2)->count();
//评价为一星的人数
$one = Db::name('comment')->where('teacher_id',$v['id'])->where('level',1)->count();
if(!empty($comment)){
$v['help_num'] = $five + $four + $three + $two + $one + $v['help_num'];
$v['level'] = ceil(($v['help_num'] * 5 + $four * 4 + $three * 3 + $two * 2 + $one)/$v['help_num']);
}
if($v['sex'] == 1){
$v['sex'] = '男';
}else{
... ... @@ -268,6 +291,22 @@ class Index extends Api
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
foreach ($data as &$v){
//查看老师的已帮助人数以及评分星级
$comment = Db::name('comment')->where('teacher_id',$v['id'])->select();
//评价为五星的人数
$five = Db::name('comment')->where('teacher_id',$v['id'])->where('level',5)->count();
//评价为四星的人数
$four = Db::name('comment')->where('teacher_id',$v['id'])->where('level',4)->count();
//评价为三星的人数
$three = Db::name('comment')->where('teacher_id',$v['id'])->where('level',3)->count();
//评价为二星的人数
$two = Db::name('comment')->where('teacher_id',$v['id'])->where('level',2)->count();
//评价为一星的人数
$one = Db::name('comment')->where('teacher_id',$v['id'])->where('level',1)->count();
if(!empty($comment)){
$v['help_num'] = $five + $four + $three + $two + $one + $v['help_num'];
$v['level'] = ceil(($v['help_num'] * 5 + $four * 4 + $three * 3 + $two * 2 + $one)/$v['help_num']);
}
if($v['sex'] == 1){
$v['sex'] = '男';
}else{
... ... @@ -366,6 +405,7 @@ class Index extends Api
"level"://星级
"createtime"://创建时间
"is_guan"://是否关注(1已关注2还未关注)
"you_num"://优惠劵个数
}
})
*/
... ... @@ -396,6 +436,29 @@ class Index extends Api
}else{
$data['is_guan'] = 1;
}
//查看用户是否有优惠劵
$data['you_num'] = Db::name('coupon')
->where('user_id',$user_id)
->where('is_use',0)
->whereTime('expirationtime','>',time())
->count();
//查看老师的已帮助人数以及评分星级
$comment = Db::name('comment')->where('teacher_id',$id)->select();
//评价为五星的人数
$five = Db::name('comment')->where('teacher_id',$id)->where('level',5)->count();
//评价为四星的人数
$four = Db::name('comment')->where('teacher_id',$id)->where('level',4)->count();
//评价为三星的人数
$three = Db::name('comment')->where('teacher_id',$id)->where('level',3)->count();
//评价为二星的人数
$two = Db::name('comment')->where('teacher_id',$id)->where('level',2)->count();
//评价为一星的人数
$one = Db::name('comment')->where('teacher_id',$id)->where('level',1)->count();
if(!empty($comment)){
$data['help_num'] = $five + $four + $three + $two + $one + $data['help_num'];
$data['level'] = ceil(($data['help_num'] * 5 + $four * 4 + $three * 3 + $two * 2 + $one)/$data['help_num']);
}
$data['before'] = $http.$data['before'];
$data['behind'] = $http.$data['behind'];
$data['thumbnail'] = $http.$data['thumbnail'];
... ... @@ -403,7 +466,7 @@ class Index extends Api
$data['territory_id'] = Db::name('territory')
->alias('a')
->join('contype b','a.contype_id = b.id')
->field('a.id,a.money,a.content,b.title')
->field('a.id,a.money,a.content,b.title,b.type')
->whereIn('a.id',$territory_id)
->select();
... ... @@ -411,6 +474,51 @@ class Index extends Api
}
/**
* @ApiTitle (学员评价列表)
* @ApiSummary (学员评价列表)
* @ApiMethod (POST)
* @ApiRoute (/api/index/commentlist)
*
* @ApiParams (name="id", type="string", required=true, description="老师ID")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
'id'://评价ID
'content'://评价内容
'nickname'://昵称
'avatar'://头像
'createtime':创建时间
}
})
*/
public function commentlist()
{
$id = $this->request->param('id');
$page = $this->request->param('page', 1, 'intval');
$pageNum = $this->request->param('pageNum', 10, 'intval');
if(empty($id)){
$this->error('缺少必要参数');
}
$data = Db::name('comment')
->alias('a')
->join('user b','a.user_id = b.id')
->field('a.id,a.content,a.createtime,b.nickname,b.avatar')
->where('a.teacher_id',$id)
->order('a.createtime desc')
->page($page,$pageNum)
->select();
foreach ($data as &$v){
$v['createtime'] = date('Y-m-d',$v['createtime']);
}
$this->success('success',$data);
}
/**
* @ApiTitle (老师关注/取消关注接口)
* @ApiSummary (老师关注/取消关注接口)
* @ApiMethod (POST)
... ... @@ -458,4 +566,6 @@ class Index extends Api
}
}
}
... ...
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/1/13
* Time: 11:35
*/
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
use think\Validate;
use wxapp\pay\WeixinPay;
/**
* 创建订单/支付接口
*/
class Order extends Api
{
/**
* @ApiTitle (创建订单)
* @ApiSummary (创建订单)
* @ApiMethod (POST)
* @ApiRoute (/api/order/create_order)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="teacher_id", type="int", required=true, description="老师ID")
* @ApiParams (name="territory_id", type="int", required=true, description="咨询领域ID")
* @ApiParams (name="is_use", type="int", required=true, description="是否适用优惠劵(0不使用,1使用)")
* @ApiParams (name="money", type="string", required=false, description="金额")
* @ApiParams (name="business", type="string", required=false, description="所属行业")
* @ApiParams (name="address", type="string", required=false, description="经营地区/职能类别")
* @ApiParams (name="product", type="string", required=false, description="产品/职位等级")
* @ApiParams (name="scale", type="string", required=false, description="公司规模/下属人数")
* @ApiParams (name="content", type="string", required=false, description="问题描述")
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1553839125",
"data": {
"order_id":"order_id",//订单id
}
})
*/
public function create_order()
{
$param = $this->request->param();
$param['user_id'] = $this->getUserId();
$validate = new Validate([
'teacher_id' => 'require',
'territory_id' => 'require',
'is_use' => 'require',
'money'=>'require',
'business'=>'require',
'address'=>'require',
'product'=>'require',
'scale'=>'require',
'content'=>'require',
]);
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$param['createtime'] = time();
$param['num'] = get_order_sn();
$data = Db::name('order')->insertGetId($param);
$this->success('success',['order_id'=>$data]);
}
/**
* @ApiTitle (支付)
* @ApiSummary (支付)
* @ApiMethod (POST)
* @ApiRoute (/api/order/pay)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="order_id", type="inter", required=true, description="订单id")
*
*/
public function pay()
{
$user_id = $this->getUserId();
$order_id = $this->request->param('order_id');
if(empty($order_id)){
$this->error('缺少必要参数');
}
$order = Db::name('order')->where(['id'=>$order_id,'user_id'=>$user_id])->find();
if(empty($order)){
$this->error('查询为空');
}
if($order['status'] != 1){
$this->error('订单状态不合法');
}
//微信支付
$openid = $this->getOpenId();
$pay = new WeixinPay();
$this->success('SUCCESS',$pay->pay($openid,$order['num'],"小微问问",$order['money'],url('api/pay/notify','','',true)));
}
/**
* @ApiTitle (我的订单列表)
* @ApiSummary (我的订单列表)
* @ApiMethod (POST)
* @ApiRoute (/api/order/orderList)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果为空或者为1是进行中 2是已完成3是售后)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //订单id,
"num"://订单号,
"content"://问题描述
"expirationtime"://到期时间
"teacher_id"://老师ID
"name"://老师名称
"thumbnail"://头像
"finish_status"://完成状态(1进行中2已完成3售后)
}
})
*/
public function orderList()
{
$user_id = $this->getUserId();
$type = $this->request->param('type');
if($type == '' || $type == 1){
$data = Db::name('order')
->alias('a')
->join('teacher b','a.teacher_id = b.id')
->where('a.user_id',$user_id)
->where('a.finish_status',1)
->field('a.*,b.name,b.thumbnail')
->select();
}elseif ($type == 2){
$data = Db::name('order')
->alias('a')
->join('teacher b','a.teacher_id = b.id')
->where('a.finish_status',2)
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->select();
}elseif ($type == 3){
$data = Db::name('order')
->alias('a')
->join('teacher b','a.teacher_id = b.id')
->where('a.finish_status',3)
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->select();
}else{
$this->error('类型有误');
}
foreach ($data as &$v){
$v['expirationtime'] = date('Y-m-d H:i',$v['expirationtime']);
}
$this->success('success',$data);
}
/**
* @ApiTitle (投诉详情)
* @ApiSummary (投诉详情)
* @ApiMethod (POST)
* @ApiRoute (/api/order/detail)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="order_id", type="int", required=true, description="订单ID")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //投诉id,
"user_id"://用户ID
"teacher_id"://老师ID
"order_id"://订单ID
"wxnum"://微信号
"createtime"://创建时间
"content"://投诉理由
"phone"://手机号
}
})
*/
public function detail()
{
$user_id = $this->getUserId();
$order_id = $this->request->param('order_id');
if(empty($order_id)){
$this->error('缺少必要参数');
}
$data = Db::name('complaint')
->where('order_id',$order_id)
->where('user_id',$user_id)
->find();
$this->success('success',$data);
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/1/13
* Time: 11:31
*/
namespace app\api\controller;
use app\common\controller\Api;
use EasyWeChat\Foundation\Application;
use think\Db;
use EasyWeChat\Payment\Order;
/**
* 支付回调(无需调用)
*/
class Pay extends Api
{
protected $options;
function _initialize()
{
parent::_initialize();
$this->options = [
'app_id' => config('app_id'),
'secret' => config('app_secret'),
'payment' => [
'merchant_id' => config('wx_mch_id'),
'key' => config('wx_pay_key'),
'cert_path' => config('cert_path'),
'key_path' => config('key_path'),
],
];
}
/**
* 支付回调
* @throws \EasyWeChat\Core\Exceptions\FaultException
*/
public function notify(){
$app = new Application($this->options);
$response = $app->payment->handleNotify(function($notify, $successful){
// 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
$out_trade_no=$notify->out_trade_no;
$order = Db::name('order')->where(['num'=>$out_trade_no])->find();
//判断用户是否有邀请人
$invite = Db::name('user')->where('id',$order['user_id'])->find();
if(empty($invite['invite_id'])){
if (!$order) { // 如果订单不存在
return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
}
// 如果订单存在
// 检查订单是否已经更新过支付状态
if ($order['status'] != 1) { // 判断是否已经支付
return true; // 已经支付成功了就不再更新了
}
// 用户是否支付成功
if ($successful) {
Db::startTrans();
$update['status'] = 2;
$update['paytime'] = time();
$update['expirationtime'] = $update['paytime'] + 86400*7;
$update['finish_status'] = 1;
} else { // 用户支付失败
$update['status']=1;
}
Db::name('order')->where('num',$out_trade_no)->update($update);
Db::commit();
return true; // 返回处理完成
}else{
//判断邀请的用户是否第一次购买
$is_one = Db::name('order')->where('user_id',$order['user_id'])->where('status',2)->find();
if(empty($is_one)){
if (!$order) { // 如果订单不存在
return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
}
// 如果订单存在
// 检查订单是否已经更新过支付状态
if ($order['status'] != 1) { // 判断是否已经支付
return true; // 已经支付成功了就不再更新了
}
// 用户是否支付成功
if ($successful) {
Db::startTrans();
$update['status'] = 2;
$update['paytime'] = time();
$update['expirationtime'] = $update['paytime'] + 86400*7;
$update['finish_status'] = 1;
//查询优惠劵金额
$you = Db::name('setvalid')->where('id',1)->find();
$coupon['user_id'] = $invite['invite_id'];
$coupon['money'] = $you['money'];
$coupon['createtime'] = time();
$coupon['expirationtime'] = $coupon['createtime']+7*86400;
Db::name('coupon')->insertGetId($coupon);
} else { // 用户支付失败
$update['status']=1;
}
Db::name('order')->where('num',$out_trade_no)->update($update);
Db::commit();
return true; // 返回处理完成
}else{
if (!$order) { // 如果订单不存在
return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
}
// 如果订单存在
// 检查订单是否已经更新过支付状态
if ($order['status'] != 1) { // 判断是否已经支付
return true; // 已经支付成功了就不再更新了
}
// 用户是否支付成功
if ($successful) {
Db::startTrans();
$update['status'] = 2;
$update['paytime'] = time();
$update['expirationtime'] = $update['paytime'] + 86400*7;
$update['finish_status'] = 1;
} else { // 用户支付失败
$update['status']=1;
}
Db::name('order')->where('num',$out_trade_no)->update($update);
Db::commit();
return true; // 返回处理完成
}
}
});
$response->send();
}
}
\ No newline at end of file
... ...
... ... @@ -301,7 +301,7 @@ class Teacher extends Api
$data = Db::name('comment')
->insertGetId($param);
$teacher = Db::name('teacher')->where('id',$param['teacher_id'])->find();
// $teacher = Db::name('teacher')->where('id',$param['teacher_id'])->find();
// Db::name('teacher')->where('id',$param['teacher_id'])
if(empty($data)){
$this->error('失败');
... ... @@ -310,5 +310,51 @@ class Teacher extends Api
}
}
/**
* @ApiTitle (投诉老师)
* @ApiSummary (投诉老师)
* @ApiMethod (POST)
* @ApiRoute (/api/teacher/complaint)
*
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="teacher_id", type="int", required=true, description="老师ID")
* @ApiParams (name="order_id", type="int", required=true, description="订单ID")
* @ApiParams (name="phone", type="string", required=true, description="手机号")
* @ApiParams (name="wxnum", type="string", required=false, description="微信号")
* @ApiParams (name="content", type="string", required=true, description="评价内容")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
'id'://投诉ID
}
})
*/
public function complaint()
{
$param = $this->request->param();
$param['user_id'] = $this->getUserId();
$validate = new Validate([
'teacher_id' => 'require',
'order_id' =>'require',
'phone' => 'require',
'content' => 'require',
]);
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$param['createtime'] = time();
$data = Db::name('complaint')->insertGetId($param);
if(empty($data)){
$this->error('失败');
}else{
$this->success('投诉成功',['id'=>$data]);
}
}
}
\ No newline at end of file
... ...
... ... @@ -87,6 +87,7 @@ class User extends Api
* @ApiParams (name="session_key", type="string", required=true, description="session_key")
* @ApiParams (name="encrypted_data", type="string", required=true, description="encrypted_data")
* @ApiParams (name="iv", type="string", required=true, description="iv")
* @ApiParams (name="invite_id", type="int", required=false, description="邀请人ID")
* @ApiReturn({
"code": 1,
"msg": "登陆成功",
... ... @@ -161,8 +162,14 @@ class User extends Api
->update($userData);
$this->success("登录成功!", ['token' => $token]);
} else {
Db::startTrans();
if(empty($data['inviter'])){
$invite_id = '';
}else{
$invite_id = $data['invite_id'];
}
Db::startTrans();
$userId = Db::name("user")->insertGetId([
'invite_id' => $invite_id,
'status' => 'normal',
'gender' => $wxUserData['gender'],
'nickname' => $wxUserData['nickName'],
... ...
... ... @@ -281,6 +281,13 @@ return [
'api_url' => 'https://api.fastadmin.net',
],
//小程序参数
'app_id' => 'wx5a6be915d4b4573a',
'app_secret' => '0c25373c08df1b57a972b18a0b05526e',
'app_id' => 'wxe47ca040e37484a7',
'app_secret' => 'f8782151f37d47015268e30890c1b275',
//商户账号
'wx_mch_id' => '1567728571',
'wx_pay_key' => 'c2P0MOK0otuL6dFo520jRotFTsmvNqNc', // 支付 密钥
// 如需使用敏感接口(如退款、发送红包等)需要配置 API 证书路径(登录商户平台下载 API 证书)
'cert_path' => ROOT_PATH.'public/cert/apiclient_cert.pem', // XXX: 绝对路径!!!!
'key_path' => ROOT_PATH.'public/cert/apiclient_key.pem', // XXX: 绝对路径!!!!
];
... ...
此 diff 太大无法显示。
... ... @@ -40,8 +40,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'status', title: __('Status'),formatter: Table.api.formatter.status,custom: {1:'success', 2:'error'},searchList:{'0':'待审核','1': '审核通过','2':'审核未通过'}},
{field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.label,searchList:{'0': '不推荐','1':'推荐'}},
{field: 'territory_id', title: __('Territory_id'), operate:false},
{field: 'help_num', title: __('Help_num'), operate:false},
{field: 'level', title: __('Level'), operate:false},
// {field: 'help_num', title: __('Help_num'), operate:false},
// {field: 'level', title: __('Level'), operate:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
... ...
不能预览此文件类型
-----BEGIN CERTIFICATE-----
MIID8DCCAtigAwIBAgIUVNQwgvoV58m8NEEDVrOUj7ivISgwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMTkxMjEwMDYwNTMwWhcNMjQxMjA4MDYwNTMwWjCBgTETMBEGA1UEAwwK
MTU2NzcyODU3MTEbMB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x2eSI1BVCzvUm1
W8C7PIg0wbpcmZuS0qrCJHG0IYh6SnXowe+eEVvtpxi93oQWm0eDkpBaJorjKAZl
PVQElXRzRQKBgC46S/fGZ1EIVApgBeykvs4ciSENeHVfymmF0lRLgF7a7kiXdkP1
gHjrzbVA4mcM2rDbb89AbUR6vM7a4z3FxfL70nd4bgLAGuqkCvCwAw44cDaYpKMr
2eO5uqKpIIuncQRPn9gSeN35ukLilCI48gOTDuId2BwOOHtOhksg+ETJAoGAH8Td
tgeup4tkKyE/FHpoo4zwRIv3TPgQuw62W27FwJLcDOSVhI786lzPVVI2vTxsihr+
kU2cClV5/dQe6TSTezqfkXrhrt9X5zLVa3KglUt6NCXAjk8nxHQJrmDBM9siSMcW
6DtO4DchTH5Z24e+9HChE9p82vIaGZHVymaW4ekCgYEAty8Ay4LblT/FcntYArCg
8imPPf8Pc+gbP9vbxIJzRaP9deFNRMxa/Vq+MG8Hhh0eLVIBnuvk6lc6mOXxXzDn
ZNjJm4IMYKZ9aqj66vR4SqvX6hUT2qH7fJAjac70lJvsvu6KxBsx91qhKMz3j70v
U2bHTyo9f7C97NaF/RadobA=
-----END PRIVATE KEY-----
... ...
欢迎使用微信支付!
附件中的三份文件(证书pkcs12格式、证书pem格式、证书密钥pem格式),为接口中强制要求时需携带的证书文件。
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
不同开发语言下的证书格式不同,以下为说明指引:
证书pkcs12格式(apiclient_cert.p12)
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
部分安全性要求较高的API需要使用该证书来确认您的调用身份
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户号(如:1900006031)
证书pem格式(apiclient_cert.pem)
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
证书密钥pem格式(apiclient_key.pem)
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
备注说明:
由于绝大部分操作系统已内置了微信支付服务器证书的根CA证书, 2018年3月6日后, 不再提供CA证书文件(rootca.pem)下载
\ No newline at end of file
... ...