v1.1.44
This commit is contained in:
parent
46d47de0fb
commit
1922b35cba
15
README.md
15
README.md
@ -10,6 +10,21 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
### v1.1.44
|
||||||
|
|
||||||
|
```
|
||||||
|
新增:小程序转发到朋友圈(灰度安卓用户)
|
||||||
|
优化:微信打款时验证冻结资金是否合法
|
||||||
|
优化:mysql报错时记录Error SQL
|
||||||
|
修复:后台权限缺少文件列表和回收站
|
||||||
|
修复:地区表中部分地区不存在
|
||||||
|
修复:获取直播房间列表接口报错
|
||||||
|
修复:后台订单详情页报错
|
||||||
|
修复:小程序端富文本视频高度不生效
|
||||||
|
--------------------------------
|
||||||
|
注:本次更新须重新发布小程序
|
||||||
|
```
|
||||||
|
|
||||||
### v1.1.43
|
### v1.1.43
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -51,6 +51,7 @@ function base_url()
|
|||||||
$request = Request::instance();
|
$request = Request::instance();
|
||||||
$subDir = str_replace('\\', '/', dirname($request->server('PHP_SELF')));
|
$subDir = str_replace('\\', '/', dirname($request->server('PHP_SELF')));
|
||||||
$baseUrl = $request->scheme() . '://' . $request->host() . $subDir . ($subDir === '/' ? '' : '/');
|
$baseUrl = $request->scheme() . '://' . $request->host() . $subDir . ($subDir === '/' ? '' : '/');
|
||||||
|
// $baseUrl = 'https://' . $request->host() . $subDir . ($subDir === '/' ? '' : '/');
|
||||||
}
|
}
|
||||||
return $baseUrl;
|
return $baseUrl;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace app\common\exception;
|
namespace app\common\exception;
|
||||||
|
|
||||||
use think\exception\Handle;
|
|
||||||
use think\Log;
|
use think\Log;
|
||||||
|
use think\exception\Handle;
|
||||||
|
use think\exception\DbException;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,13 +56,20 @@ class ExceptionHandler extends Handle
|
|||||||
private function recordErrorLog(Exception $e)
|
private function recordErrorLog(Exception $e)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'file' => $e->getFile(),
|
'file' => $e->getFile(),
|
||||||
'line' => $e->getLine(),
|
'line' => $e->getLine(),
|
||||||
'message' => $this->getMessage($e),
|
'message' => $this->getMessage($e),
|
||||||
'code' => $this->getCode($e),
|
'code' => $this->getCode($e),
|
||||||
|
'TraceAsString' => $e->getTraceAsString()
|
||||||
];
|
];
|
||||||
|
// 如果是mysql报错, 则记录Error SQL
|
||||||
|
if ($e instanceof DbException) {
|
||||||
|
$data['TraceAsString'] = "[Error SQL]: " . $e->getData()['Database Status']['Error SQL'];
|
||||||
|
}
|
||||||
|
// 日志标题
|
||||||
$log = "[{$data['code']}]{$data['message']} [{$data['file']}:{$data['line']}]";
|
$log = "[{$data['code']}]{$data['message']} [{$data['file']}:{$data['line']}]";
|
||||||
$log .= "\r\n" . $e->getTraceAsString();
|
// 错误trace
|
||||||
|
$log .= "\r\n{$data['TraceAsString']}";
|
||||||
Log::record($log, 'error');
|
Log::record($log, 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class Room extends WxBase
|
|||||||
{
|
{
|
||||||
// 微信接口url
|
// 微信接口url
|
||||||
$accessToken = $this->getAccessToken();
|
$accessToken = $this->getAccessToken();
|
||||||
$apiUrl = "http://api.weixin.qq.com/wxa/business/getliveinfo?access_token={$accessToken}";
|
$apiUrl = "https://api.weixin.qq.com/wxa/business/getliveinfo?access_token={$accessToken}";
|
||||||
// 请求参数
|
// 请求参数
|
||||||
$params = $this->jsonEncode(['start' => 0, 'limit' => 100]);
|
$params = $this->jsonEncode(['start' => 0, 'limit' => 100]);
|
||||||
// 执行请求
|
// 执行请求
|
||||||
@ -33,11 +33,12 @@ class Room extends WxBase
|
|||||||
$this->error = 'not found errcode';
|
$this->error = 'not found errcode';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((int)$response['errcode'] > 1) {
|
// 容错: empty room list
|
||||||
|
if ($response['errcode'] > 1 && $response['errcode'] != 9410000) {
|
||||||
$this->error = $response['errmsg'];
|
$this->error = $response['errmsg'];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class Express extends BaseModel
|
|||||||
public static function getAll()
|
public static function getAll()
|
||||||
{
|
{
|
||||||
$model = new static;
|
$model = new static;
|
||||||
return $model->order(['sort' => 'asc', $this->getPk() => 'desc'])->select();
|
return $model->order(['sort' => 'asc', $model->getPk() => 'desc'])->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,8 +64,10 @@ class Printer extends BaseModel
|
|||||||
*/
|
*/
|
||||||
public static function getAll()
|
public static function getAll()
|
||||||
{
|
{
|
||||||
return (new static)->where('is_delete', '=', 0)
|
$model = new static;
|
||||||
->order(['sort' => 'asc', $this->getPk() => 'desc'])->select();
|
return $model->where('is_delete', '=', 0)
|
||||||
|
->order(['sort' => 'asc', $model->getPk() => 'desc'])
|
||||||
|
->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ class Region extends BaseModel
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 当前数据版本号
|
// 当前数据版本号
|
||||||
private static $version = '1.2.4';
|
private static $version = '1.2.5';
|
||||||
|
|
||||||
// 县级市别名 (兼容微信端命名)
|
// 县级市别名 (兼容微信端命名)
|
||||||
private static $county = [
|
private static $county = [
|
||||||
|
@ -119,4 +119,4 @@ class Withdraw extends Basics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,25 +22,26 @@ class Base
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存小程序码到文件
|
* 保存小程序码到文件
|
||||||
* @param $wxapp_id
|
* @param $wxappId
|
||||||
* @param $scene
|
* @param $scene
|
||||||
* @param null $page
|
* @param null $page
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \app\common\exception\BaseException
|
* @throws \app\common\exception\BaseException
|
||||||
|
* @throws \think\Exception
|
||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
protected function saveQrcode($wxapp_id, $scene, $page = null)
|
protected function saveQrcode($wxappId, $scene, $page = null)
|
||||||
{
|
{
|
||||||
// 文件目录
|
// 文件目录
|
||||||
$dirPath = RUNTIME_PATH . 'image' . '/' . $wxapp_id;
|
$dirPath = RUNTIME_PATH . 'image' . '/' . $wxappId;
|
||||||
!is_dir($dirPath) && mkdir($dirPath, 0755, true);
|
!is_dir($dirPath) && mkdir($dirPath, 0755, true);
|
||||||
// 文件名称
|
// 文件名称
|
||||||
$fileName = 'qrcode_' . md5($wxapp_id . $scene . $page) . '.png';
|
$fileName = 'qrcode_' . md5($wxappId . $scene . $page) . '.png';
|
||||||
// 文件路径
|
// 文件路径
|
||||||
$savePath = "{$dirPath}/{$fileName}";
|
$savePath = "{$dirPath}/{$fileName}";
|
||||||
if (file_exists($savePath)) return $savePath;
|
if (file_exists($savePath)) return $savePath;
|
||||||
// 小程序配置信息
|
// 小程序配置信息
|
||||||
$wxConfig = WxappModel::getWxappCache($wxapp_id);
|
$wxConfig = WxappModel::getWxappCache($wxappId);
|
||||||
// 请求api获取小程序码
|
// 请求api获取小程序码
|
||||||
$Qrcode = new Qrcode($wxConfig['app_id'], $wxConfig['app_secret']);
|
$Qrcode = new Qrcode($wxConfig['app_id'], $wxConfig['app_secret']);
|
||||||
$content = $Qrcode->getQrcode($scene, $page);
|
$content = $Qrcode->getQrcode($scene, $page);
|
||||||
@ -51,14 +52,14 @@ class Base
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网络图片到临时目录
|
* 获取网络图片到临时目录
|
||||||
* @param $wxapp_id
|
* @param $wxappId
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param string $mark
|
* @param string $mark
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function saveTempImage($wxapp_id, $url, $mark = 'temp')
|
protected function saveTempImage($wxappId, $url, $mark = 'temp')
|
||||||
{
|
{
|
||||||
$dirPath = RUNTIME_PATH . 'image' . '/' . $wxapp_id;
|
$dirPath = RUNTIME_PATH . 'image' . '/' . $wxappId;
|
||||||
!is_dir($dirPath) && mkdir($dirPath, 0755, true);
|
!is_dir($dirPath) && mkdir($dirPath, 0755, true);
|
||||||
$savePath = $dirPath . '/' . $mark . '_' . md5($url) . '.png';
|
$savePath = $dirPath . '/' . $mark . '_' . md5($url) . '.png';
|
||||||
if (file_exists($savePath)) return $savePath;
|
if (file_exists($savePath)) return $savePath;
|
||||||
@ -74,4 +75,4 @@ class Base
|
|||||||
return $savePath;
|
return $savePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,11 @@ class Withdraw extends Controller
|
|||||||
*/
|
*/
|
||||||
public function money($id)
|
public function money($id)
|
||||||
{
|
{
|
||||||
|
// 提现记录详情
|
||||||
$model = WithdrawModel::detail($id);
|
$model = WithdrawModel::detail($id);
|
||||||
if ($model->money()) {
|
// 验证已冻结佣金是否合法
|
||||||
|
// 合法 -> 确认打款
|
||||||
|
if (!$model->verifyUserFreezeMoney($model['user_id'], $model['money']) && $model->money()) {
|
||||||
return $this->renderSuccess('操作成功');
|
return $this->renderSuccess('操作成功');
|
||||||
}
|
}
|
||||||
return $this->renderError($model->getError() ?: '操作失败');
|
return $this->renderError($model->getError() ?: '操作失败');
|
||||||
@ -76,4 +79,4 @@ class Withdraw extends Controller
|
|||||||
return $this->renderError($model->getError() ?: '操作失败');
|
return $this->renderError($model->getError() ?: '操作失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,13 @@ namespace app\store\model\dealer;
|
|||||||
|
|
||||||
use app\store\model\User as UserModel;
|
use app\store\model\User as UserModel;
|
||||||
use app\store\model\Wxapp as WxappModel;
|
use app\store\model\Wxapp as WxappModel;
|
||||||
|
use app\common\model\dealer\User as dealerUserModel;
|
||||||
use app\common\model\dealer\Withdraw as WithdrawModel;
|
use app\common\model\dealer\Withdraw as WithdrawModel;
|
||||||
use app\common\library\wechat\WxPay;
|
|
||||||
use app\common\service\Order as OrderService;
|
use app\common\service\Order as OrderService;
|
||||||
use app\common\service\Message as MessageService;
|
use app\common\service\Message as MessageService;
|
||||||
use app\common\enum\dealer\withdraw\PayType as PayTypeEnum;
|
use app\common\enum\dealer\withdraw\PayType as PayTypeEnum;
|
||||||
use app\common\enum\dealer\withdraw\ApplyStatus as ApplyStatusEnum;
|
use app\common\enum\dealer\withdraw\ApplyStatus as ApplyStatusEnum;
|
||||||
|
use app\common\library\wechat\WxPay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商提现明细模型
|
* 分销商提现明细模型
|
||||||
@ -40,14 +41,14 @@ class Withdraw extends WithdrawModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分销商提现列表
|
* 获取分销商提现列表
|
||||||
* @param null $user_id
|
* @param null $userId
|
||||||
* @param int $apply_status
|
* @param int $apply_status
|
||||||
* @param int $pay_type
|
* @param int $pay_type
|
||||||
* @param string $search
|
* @param string $search
|
||||||
* @return \think\Paginator
|
* @return \think\Paginator
|
||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
public function getList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '')
|
public function getList($userId = null, $apply_status = -1, $pay_type = -1, $search = '')
|
||||||
{
|
{
|
||||||
// 构建查询规则
|
// 构建查询规则
|
||||||
$this->alias('withdraw')
|
$this->alias('withdraw')
|
||||||
@ -57,7 +58,7 @@ class Withdraw extends WithdrawModel
|
|||||||
->join('dealer_user dealer', 'dealer.user_id = withdraw.user_id')
|
->join('dealer_user dealer', 'dealer.user_id = withdraw.user_id')
|
||||||
->order(['withdraw.create_time' => 'desc']);
|
->order(['withdraw.create_time' => 'desc']);
|
||||||
// 查询条件
|
// 查询条件
|
||||||
$user_id > 0 && $this->where('withdraw.user_id', '=', $user_id);
|
$userId > 0 && $this->where('withdraw.user_id', '=', $userId);
|
||||||
!empty($search) && $this->where('dealer.real_name|dealer.mobile', 'like', "%$search%");
|
!empty($search) && $this->where('dealer.real_name|dealer.mobile', 'like', "%$search%");
|
||||||
$apply_status > 0 && $this->where('withdraw.apply_status', '=', $apply_status);
|
$apply_status > 0 && $this->where('withdraw.apply_status', '=', $apply_status);
|
||||||
$pay_type > 0 && $this->where('withdraw.pay_type', '=', $pay_type);
|
$pay_type > 0 && $this->where('withdraw.pay_type', '=', $pay_type);
|
||||||
@ -100,11 +101,17 @@ class Withdraw extends WithdrawModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认已打款
|
* 确认已打款
|
||||||
* @return bool
|
* @param bool $verifyUserFreezeMoney 验证已冻结佣金是否合法
|
||||||
|
* @return bool|mixed
|
||||||
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
public function money()
|
public function money($verifyUserFreezeMoney = true)
|
||||||
{
|
{
|
||||||
$this->transaction(function () {
|
// 验证已冻结佣金是否合法
|
||||||
|
if ($verifyUserFreezeMoney && !$this->verifyUserFreezeMoney($this['user_id'], $this['money'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->transaction(function () {
|
||||||
// 更新申请状态
|
// 更新申请状态
|
||||||
$this->allowField(true)->save([
|
$this->allowField(true)->save([
|
||||||
'apply_status' => 40,
|
'apply_status' => 40,
|
||||||
@ -119,8 +126,8 @@ class Withdraw extends WithdrawModel
|
|||||||
'money' => -$this['money'],
|
'money' => -$this['money'],
|
||||||
'describe' => '申请提现',
|
'describe' => '申请提现',
|
||||||
]);
|
]);
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,6 +139,10 @@ class Withdraw extends WithdrawModel
|
|||||||
*/
|
*/
|
||||||
public function wechatPay()
|
public function wechatPay()
|
||||||
{
|
{
|
||||||
|
// 验证已冻结佣金是否合法
|
||||||
|
if (!$this->verifyUserFreezeMoney($this['user_id'], $this['money'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 微信用户信息
|
// 微信用户信息
|
||||||
$user = $this['user']['user'];
|
$user = $this['user']['user'];
|
||||||
// 生成付款订单号
|
// 生成付款订单号
|
||||||
@ -144,10 +155,27 @@ class Withdraw extends WithdrawModel
|
|||||||
// 请求付款api
|
// 请求付款api
|
||||||
if ($WxPay->transfers($orderNO, $user['open_id'], $this['money'], $desc)) {
|
if ($WxPay->transfers($orderNO, $user['open_id'], $this['money'], $desc)) {
|
||||||
// 确认已打款
|
// 确认已打款
|
||||||
$this->money();
|
$this->money(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证已冻结佣金是否合法
|
||||||
|
* @param $userId
|
||||||
|
* @param $money
|
||||||
|
* @return bool
|
||||||
|
* @throws \think\exception\DbException
|
||||||
|
*/
|
||||||
|
public function verifyUserFreezeMoney($userId, $money)
|
||||||
|
{
|
||||||
|
$dealerUserInfo = dealerUserModel::detail($userId);
|
||||||
|
if ($dealerUserInfo['freeze_money'] < $money) {
|
||||||
|
$this->error = '数据错误:已冻结的佣金不能小于提现的金额';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "1.1.43"
|
"version": "1.1.44"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user