**
系统说明
黄色版本的数码盲盒4.0,功能非常完善,可以打包双端app,有些小改动,图片全部本地化,对接易支付接口,短信宝短信
**
页面展示
部分代码
<?php
namespace app\api\controller;
use addons\epay\library\Service;
use app\api\model\CoinRecord;
use app\api\model\Delivery;
use app\api\model\DeliveryTrade;
use app\api\model\Order;
use app\api\model\Prizerecord;
use app\api\model\RechargeOrder;
use app\common\controller\Frontend;
use think\Db;
use app\api\library\Retail;
/**
* 支付宝支付接口
* Class Alipay
* @package app\api\controller
* @version 1.0
* @author fuyelk <fuyelk@fuyelk.com>
*/
class Alipay extends Frontend
{
protected $noNeedLogin = ['notifyx', 'boxpaysuccess', 'rechargesuccess'];
protected $noNeedRight = ['*'];
/**
* 盲盒订单支付
* @throws \Exception
* @author fuyelk <fuyelk@fuyelk.com>
*/
public function boxpay($orderid = '')
{
if (empty($orderid)) {
$this->error('订单ID不能为空');
}
$order = Order::where('id', $orderid)->where('user_id', $this->auth->id)->where('status', 'unpay')->find();
if (empty($order)) {
$this->error('订单有误', '');
}
$mny = mt_rand(1,4)/100;
$coin_price = $order->rmb_amount + $mny;
$params = [
//'amount' => $order->rmb_amount,
'amount' => $coin_price,
'orderid' => $order->out_trade_no,
'type' => "alipay",
'title' => $order->box_name,
'notifyurl' => $this->request->domain() . '/api/alipay/notifyx/orderfrom/buybox',
'returnurl' => $this->request->domain() . '/api/alipay/boxpaysuccess',
'method' => "wap",
];
$query = input('get.');
if (isset($query['orderid'])) {
unset($query['orderid']);
}
$this->auth->redis->set($order->out_trade_no, $query, 60 * 30); // 将参数存入缓存,30分钟
//echo 222;
echo \addons\eepay\Service::pay($params);
// echo \addons\epay\library\Service::submitOrder($params);
}
/**
* 充值订单支付
* @throws \Exception
* @author fuyelk <fuyelk@fuyelk.com>
*/
public function rechargepay($orderid = '')
{
if (empty($orderid)) {
$this->error('订单ID不能为空');
}
$order = RechargeOrder::where('id', $orderid)->where('user_id', $this->auth->id)->where('status', 'unpay')->find();
if (empty($order)) {
$this->error('订单有误', '');
}
$mny = mt_rand(1,4)/100;
$coin_price = $order->rmb_amount + $mny;
$params = [
'amount' => $coin_price,
'orderid' => $order->out_trade_no,
'type' => "alipay",
'title' => '充值',
'notifyurl' => $this->request->domain() . '/api/alipay/notifyx/orderfrom/recharge',
'returnurl' => $this->request->domain() . '/api/alipay/rechargesuccess',
'method' => "wap",
];
$query = input('get.');
if (isset($query['orderid'])) {
unset($query['orderid']);
}
$this->auth->redis->set($order->out_trade_no, $query, 60 * 30); // 将参数存入缓存,30分钟
```php