最火数码盲盒

**

系统说明

黄色版本的数码盲盒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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AALoveTouch

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值