89 lines
2.3 KiB
PHP
Executable File
89 lines
2.3 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: HcyShop-kiki
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\admin\logic;
|
|
|
|
use app\common\model\Pay;
|
|
use think\Db;
|
|
|
|
class PayConfigLogic
|
|
{
|
|
|
|
public static function lists()
|
|
{
|
|
$payModel = new Pay();
|
|
$count = $payModel->count();
|
|
$lists = $payModel->order('sort')->select();
|
|
$lists->append(['status_text']);
|
|
return ['list' => $lists, 'count' => $count];
|
|
}
|
|
|
|
|
|
public static function info($pay_code)
|
|
{
|
|
$payModel = new Pay();
|
|
$result = $payModel->where(['code' => $pay_code])->append(['status_text'])->find();
|
|
return $result;
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes: 余额支付
|
|
* @param $post
|
|
* @author 松鼠
|
|
* @return bool
|
|
*/
|
|
public static function editBalance($post)
|
|
{
|
|
$payModel = new Pay();
|
|
return $payModel->allowField(true)->save($post, ['code' => 'balance']);
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes: 微信支付
|
|
* @param $post
|
|
* @author 松鼠
|
|
* @return bool
|
|
*/
|
|
public static function editWechat($post)
|
|
{
|
|
$config = [
|
|
'pay_sign_key' => $post['pay_sign_key'],
|
|
'mch_id' => $post['mch_id'],
|
|
'apiclient_cert' => $post['apiclient_cert'],
|
|
'apiclient_key' => $post['apiclient_key']
|
|
];
|
|
$post['config'] = json_encode($config, JSON_UNESCAPED_UNICODE);
|
|
|
|
$payModel = new Pay();
|
|
return $payModel->allowField(true)->save($post, ['code' => 'wechat']);
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes: 支付宝
|
|
* @param $post
|
|
* @author 松鼠
|
|
* @return int|string
|
|
* @throws \think\Exception
|
|
* @throws \think\exception\PDOException
|
|
*/
|
|
public static function editAlipay($post)
|
|
{
|
|
$config = [
|
|
'app_id' => $post['app_id'],
|
|
'private_key' => $post['private_key'],//应用私钥
|
|
'ali_public_key' => $post['ali_public_key']//支付宝公钥
|
|
];
|
|
$post['config'] = json_encode($config, JSON_UNESCAPED_UNICODE);
|
|
$payModel = new Pay();
|
|
return $payModel->allowField(true)->save($post, ['code' => 'alipay']);
|
|
}
|
|
|
|
} |