[更新]整理代码结构

This commit is contained in:
Anyon 2017-05-11 18:20:32 +08:00
parent 706bda151d
commit a523d5c8df
4 changed files with 7 additions and 45 deletions

View File

@ -1,30 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Think.Admin
// +----------------------------------------------------------------------
// | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/Think.Admin
// +----------------------------------------------------------------------
namespace app\wechat\controller;
use controller\BasicAdmin;
/**
* 微信入口控制器
* Class Index
* @package app\wechat\controller
* @author Anyon <zoujingli@qq.com>
* @date 2017/03/24 14:43
*/
class Index extends BasicAdmin {
public function index() {
}
}

View File

@ -15,7 +15,6 @@
namespace service;
use CURLFile;
use think\Config;
/**
* HTTP请求服务

View File

@ -60,7 +60,7 @@ class NodeService {
* @param string $node 节点
* @return bool
*/
static public function checkAuthNode($node) {
public static function checkAuthNode($node) {
$auth_node = strtolower($node);
if (session('user.username') === 'admin' || stripos($node, 'admin/index') === 0) {
return true;

View File

@ -117,27 +117,20 @@ class PayService {
* @param string $from 订单来源
* @return bool|string
*/
public static function createWechatPrepayid(WechatPay $pay, $openid, $order_no, $fee, $title, $trade_type = 'JSAPI', $from = 'shop') {
public static function createWechatPrepayid(WechatPay $pay, $openid, $order_no, $fee, $title, $trade_type = 'JSAPI', $from = 'wechat') {
$map = ['order_no' => $order_no, 'is_pay' => '1', 'expires_in' => time(), 'appid' => $pay->appid];
$where = 'appid=:appid and order_no=:order_no and (is_pay=:is_pay or expires_in>:expires_in)';
$prepayinfo = Db::name('WechatPayPrepayid')->where($where, $map)->find();
if (empty($prepayinfo) || empty($prepayinfo['prepayid'])) {
$out_trade_no = DataService::createSequence(18, 'WXPAY-OUTER-NO');
$prepayid = $pay->getPrepayId($openid, $title, $out_trade_no, $fee, url("@wechat/notify", '', true, true), $trade_type);
if (empty($prepayid)) {
if (!($prepayid = $pay->getPrepayId($openid, $title, $out_trade_no, $fee, url("@wechat/notify", '', true, true), $trade_type))) {
Log::error("内部订单号{$order_no}生成预支付失败,{$pay->errMsg}");
return false;
}
$data = [
'appid' => $pay->appid, // 对应公众号APPID
'prepayid' => $prepayid, // 微信支付预支付码
'order_no' => $order_no, // 内部订单号
'out_trade_no' => $out_trade_no, // 微信商户订单号
'fee' => $fee, // 需要支付费用(单位为分)
'trade_type' => $trade_type, // 发起支付类型
'expires_in' => time() + 5400, // 微信预支付码有效时间1.5小时最长为2小时
'from' => $from // 订单来源
];
$data = ['prepayid' => $prepayid, 'order_no' => $order_no, 'out_trade_no' => $out_trade_no, 'fee' => $fee, 'trade_type' => $trade_type];
$data['from'] = $from;
$data['appid'] = $pay->appid;
$data['expires_in'] = time() + 5400; //微信预支付码有效时间1.5小时(最长为2小时)
if (Db::name('WechatPayPrepayid')->insert($data) > 0) {
Log::notice("内部订单号{$order_no}生成预支付成功,{$prepayid}");
return $prepayid;