可运营的手机挖矿类源码(含商城、支付)

发布时间:2021-04-06
技术:mysql+php+redis+js

概述

项目写了有一段时间了,写来自己运营的,可惜不会运行,忍心分享了,写这个项目用了1个多月的时间。数据库用的是MYSQL,后端用的PHP,前端和后端没有分离,html+css+js,可以打包app,支付用的是支付宝官方支付。打包得借助apicloud,支付也得借助apicloud打包。

详细

项目写了一个多月,原本写这个项目打算自己团队运营一下的,可惜不懂运营,又不想程序没啥用,就分享了,有需要的可以看一下,学习也行,里面的知识点挺多的。用的话要有点技术功底,不是分离的,里面涉及到了代币交易,商城,支付宝支付,海报分享,缓存,矿机自动挖矿等功能模块。浏览器端所有源码都在压缩包中,包括数据库。打包需要借助apicloud,源码我写到底部了的源码比较简单,我写到底部了,有需要的可以看看,不懂的可以联系我。

配置:

环境 php7.0   Apache/Nginx Mysql

1.导入数据库run_fengzhist_co.sql

2.修改  数据库配置

/APP/Conf/config.php

/application/database.php

/config/database.php

3.程序运行目录/public

4.设置thinkphp伪静态。

前台账号 13598391186  密码 123456

后台 /admin/login/index.html  账号 admin 密码 自己改一下

找到这个表 manage_user 修改 password为:653e7710db9484aec0247f233790e74d

密码是:123456


先看图看演示吧:

部分截图:


未标题-1.jpg

项目结构图(thingkphp):

WX20210404-120300@2x.png

部分代码PHP:

<?php
namespace app\index\controller;

use app\common\entity\User;
use app\common\entity\Config;
use app\common\entity\Log;
use app\common\entity\UserProduct;
use think\Request;
use think\Db;

class Index extends Base
{
    public function index()
    {
        //获取公告
        $article = new \app\index\model\Article();
        $articleList = $article->getArticleList(1);
        $service = new \app\common\entity\Sl();
        $sl = $service->where('types',1)->select();
        return $this->fetch('index', ["list" => $articleList,"sl"=>$sl]);
    }

    public function task()
    {
        //获取公告
        $service = new \app\common\entity\task();
        $data = $service->select();
        $service = new \app\common\entity\Sl();
        $sl = $service->where('types',1)->select();
        foreach ($data as $k=> $v) {

            $data[$k]['imgs'] = str_replace('\\', '/', $v['img']);
        }
        return $this->fetch('task', ["list" => $data,"sl"=>$sl]);
    }
    public function tasks(){

        return $this->fetch('tasks');
    }

    /**
     * 公告详情
     */
    public function articleinfo(Request $requset)
    {
        $articleId = $requset->get("articleId");
        $articleTitle = $requset->get("title");
        $type = $requset->get("type");
        if (!(int)$articleId) {
            $this->error("公告不存在!!");
        }
        $articleinfo = \app\common\entity\Article::where('article_id', $articleId)->find();
        if (!$articleinfo) {
            $this->error("公告不存在!!");
        }
        return $this->fetch("articleinfo", ['articleinfo' => $articleinfo,'type'=>$type,'title'=>$articleTitle]);
    }
    public function lingqu(Request $requset)
    {
        $user = User::where('id', $this->userId)->find();
        $register_time = strtotime($user['register_time']);
        $time = 1615392000;
        if($time>$register_time){
            $model = new UserProduct();
            $result = $model->addInfo($user->id, 1, UserProduct::TYPE_REGISTER);
            if (!$result) {
               Log::addLog(Log::TYPE_PRODUCT, '注册送矿机失败', [
                  'user_id' => $user->id,
                  'mobile' => $user->mobile
               ]);
            }
            $user->register_time = time();
            $user->save();
            return json()->data(['code' => 1, 'message' => '领取成功']);
        }
        return json()->data(['code' => 1, 'message' => '不符合领取条件']);
    }

    /**
     * 排行榜
     */
    public function phb()
    {
        //获取开采率排行榜 前50名
//        Db::name('user')->whereTime('reg_time','>','this week')->select();
        $list = User::field('nick_name,avatar,product_rate')->order('product_rate', 'desc')->limit(50)
            ->select();
        return $this->fetch('phb', [
            'list' => $list
        ]);
    }
    /**
      * cec计划
    */
    public function plan()
    {
      $magic = User::sum('magic');
      if($magic>268000){
        $magic = 268000;
      }
      $product_rate = User::sum('product_rate');
      return $this->fetch('plan',[
        'magic' => $magic,
        'product_rate' =>$product_rate,
      ]);
    }
    /**
      * 开通vip
    */
    public function vip()
    {
      //获取用户详细信息
      $user = new \app\index\model\User();
      $userInfo = $user->getInfo($this->userId);
      return $this->fetch('vip',[
         'vip' => $userInfo['vip']
      ]);
    }
    public function openVip(Request $request)
    {
        $user = new \app\index\model\User();
        $userInfo = $user->getInfo($this->userId);
        if($userInfo['vip']==1){
           return json(['code' => 0, 'message' => '您已经是VIP用户']);
        }
        $val = Config::getValue("real_vip");
        $outTradeNo = uniqid();     //你自己的商品订单号,不能重复
        $apply = new \app\index\model\Apply();
        $orderStr = $apply->getApply($val,'开通VIP',$outTradeNo);
        $orderList=Db::table('order_play')->where('uid',$this->userId)->where("star", 1)->where('types',2)->select();
        $time = time();
        if(count($orderList)>0){
           $data = array();
           $data['order_id'] = $outTradeNo;
           $data['create_time'] = $time;
           $data['price'] = $val;
           $res = Db::table('order_play')->where('uid', $this->userId)->where('types',2)->update($data);
           return json(['code' => 1, 'message' => $orderStr,'order'=>$outTradeNo]);
        }
        $db = Db::name('order_play');
        $num = $db->insert(['order_id'=>$outTradeNo,'uid'=>$this->userId,'price'=>$val,'create_time'=>$time,'star'=>1,'types'=>2]);
        if($num!=1)
        {
           return json(['code' => 0, 'message' => '订单创建失败,请稍后在试']);
        }
        return json(['code' => 1, 'message' => $orderStr,'order'=>$outTradeNo]);
    }
    //支付成功修改状态
    public function updateVip(Request $request)
    {
        $user = new \app\index\model\User();
        $userInfo = $user->getInfo($this->userId);
        $time = time();
        $date = date('Y',time()) + 1 . '-' . date('m-d H:i:s');//一年后日期
        $yearTime = strtotime($date);
        $data = array();
        $data['create_time'] = $time;
        $data['star'] = 2;
        $res = Db::table('order_play')->where('uid', $this->userId)->where('types',2)->update($data);
        $db = Db::name('money_log');
        $val = Config::getValue("real_vip");
        $num = $db->insert(['user_id'=>$this->userId,'price'=>$val,'create_time'=>$time,'types'=>2,'remark'=>'开通VIP','star'=>1]);
        if($num!=1)
        {
           return json(['code' => 0, 'message' => '矿机购买记录创建失败']);
        }
        $userInfo->vip=1;
        $userInfo->vip_end_time= $yearTime;
        $userInfo->save();
        return json(['code' => 1, 'message' => '购买成功']);
    }
    //余额支付
    public function yuOpenVip(Request $request)
    {
        $user = new \app\index\model\User();
        $userInfo = $user->getInfo($this->userId);
        if($userInfo['vip']==1){
           return json(['code' => 0, 'message' => '您已经是VIP用户']);
        }
        $val = Config::getValue("real_vip");
        $outTradeNo = uniqid();     //你自己的商品订单号,不能重复
        if($userInfo['money']<$val){
            return json(['code' => 0, 'message' => '余额不足,请先充值']);
        }
        $orderList=Db::table('order_play')->where('uid',$this->userId)->where("star", 1)->where('types',2)->select();
        $time = time();
        $date = date('Y',time()) + 1 . '-' . date('m-d H:i:s');//一年后日期
        $yearTime = strtotime($date);
        if(count($orderList)>0){
           $data = array();
           $data['order_id'] = $outTradeNo;
           $data['create_time'] = $time;
           $data['price'] = $val;
           $newData['star'] = 2;
           $res = Db::table('order_play')->where('uid', $this->userId)->where('types',2)->update($data);
            //生成记录
           $db = Db::name('money_log');
           $num = $db->insert(['user_id'=>$this->userId,'price'=>$val,'create_time'=>$time,'types'=>2,'remark'=>'开通VIP','star'=>3]);
           if($num!=1)
           {
              return json(['code' => 0, 'message' => '购买记录创建失败']);
           }
           $userInfo->vip=1;
           $userInfo->money=$userInfo['money']-$val;
           $userInfo->vip_end_time= $yearTime;
           $userInfo->save();
           return json(['code' => 1, 'message' => '购买成功']);
        }
        $db = Db::name('order_play');
        $num = $db->insert(['order_id'=>$outTradeNo,'uid'=>$this->userId,'price'=>$val,'create_time'=>$time,'star'=>2,'types'=>2]);
        if($num!=1)
        {
           return json(['code' => 0, 'message' => '订单创建失败,请稍后在试']);
        }
        $db = Db::name('money_log');
        $num = $db->insert(['user_id'=>$this->userId,'price'=>$val,'create_time'=>$time,'types'=>2,'remark'=>'开通VIP','star'=>3]);
        if($num!=1)
        {
            return json(['code' => 0, 'message' => '购买记录创建失败']);
        }
        $userInfo->vip=1;
        $userInfo->money=$userInfo['money']-$val;
        $userInfo->vip_end_time= $yearTime;
        $userInfo->save();
        return json(['code' => 1, 'message' => '购买成功']);
    }
}

部分代码前端:

<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title>提现</title>
    <!--head-->
    {include file="layout/head" /}
    <style>
        .mui-content{
            padding: 20px;
        }
        .money{
            display: flex;
            align-items: center;
            background: #ffffff;
            margin-top: 15px;
            padding: 20px 15px;
            border-radius: 8px;
            height: 100px;
            justify-content: center;
            flex-flow: column;
        }
        .fangshi{
            margin-top: 15px;
            background: #ffffff;
            padding:  15px;
            border-radius: 8px;
        }
        .fangshi-title{
            display: flex;
            justify-content: space-between;
        }
        .zfb{
            display: flex;
            align-items: center;
        }
        .zfb img{
            width: 45px;
        }
        .zfb-txt{
            display: flex;
            flex-flow: column;
            padding-left: 12px;
        }
        .fangshi-select{
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 20px;
        }
        .select-fh img{
            width: 30px;
        }
        .fixed-money{
            background: #ffffff;
            margin-top: 15px;
            padding:  15px;
            border-radius: 8px;
        }
        .fixeds{
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            margin-top: 15px;
        }
        .fixed-one{
            width: 29.3%;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 50px;
            border: 1px solid #5ac1e0;
            margin: 2%;
            border-radius: 6px;
        }
        .fixed-one span{
            color: #1a95e4;
            font-size: 18px;
        }
        .zhuyi{
            margin-top: 20px;
        }
        .tixan-txt{
            display: flex;
            flex-flow: column;
            margin-top: 10px;
        }
        .tixan-txt span{
            color: #808080;
            font-size: 14px;
            padding-top: 4px;
        }
        .btn{
            margin-top: 50px;
            background: #1a95e4;
            color: #FFF;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 30px;
        }
        .btn span{
            font-size: 17px;
        }
       .active span{
            font-weight: bold;
        }
        .gobing{
            padding: 4px 10px;
            background: #1a95e4;
            color: #FFF;
            border-radius: 10px;
        }
        .toast{
            display: none;
        }
    </style>
</head>
<body>
<header class="mui-bar mui-bar-nav my-header">
    <a href="javascript:history.back(-1)" class="mui-icon mui-icon-left-nav mui-pull-left" ></a>
    <h1 id="title" class="mui-title">提现</h1>
</header>
<div class="mui-content">
    <div class="money">
        <span style="font-weight: bold;font-size: 25px">{$money}</span>
        <span style="padding-top: 6px;color: #808080">余额(元)</span>
    </div>
    <div class="fangshi">
        <div class="fangshi-title">
            <span style="font-size: 16px">提现方式</span>
            <span style="color: #808080">单日限额10000元</span>
        </div>
        <div class="fangshi-select">
            <div class="zfb">
                <img src="/static/images/zfbzf.png" alt="">
                <div class="zfb-txt">
                    <span style="color: #000;font-size: 14px">支付宝提现</span>
                    <span style="color: #808080;padding-top: 4px;font-size: 12px">手续费{$shouxu}.00%</span>
                </div>
            </div>
            <div class="select-fh">
                {if $userInfo['zfb']}
                <img src="/static/images/select-true.png" alt="">
                {else}
                <a class="gobind" href="/index/member/zfb">去绑定</a>
                {/if}
            </div>
        </div>
    </div>
    <div class="fixed-money">
        <div class="jine-txt" style="display: flex;justify-content: space-between">
            <span style="font-size: 16px">提现金额</span>
            <span style="font-size: 12px" class="toast">实际到账:<i style="font-size: 14px;font-style: normal" class="num">95 </i>元</span>
        </div>
        <div class="fixeds">
            {foreach $tixiannum as $key=>$c}
            <div class="fixed-one">
                <span class="yuan">{$c}</span>
                <span>元</span>
            </div>
            {/foreach}
        </div>
    </div>
    <div class="zhuyi">
        <div class="jine-txt">
            <span style="font-size: 14px">注意事项</span>
        </div>
        <div class="tixan-txt">
            <span>1、提现将在周一至周五工作日24小时内审核到账,周末不处理审核,请耐心等待</span>
            <span>2、提现手续费普通用户为{$usershuxu}.00%,vip用户为{$vipshoxu}.00%</span>
            <span>3、提现不到账?请查看 <a href="{:url('member/tixianshuoming')}">提现说明</a></span>
        </div>
    </div>
    <div class="btn">
        <span>确定</span>
    </div>
</div>
<!--footer-->
{include file="layout/footer" /}
<!--js-->
<script>
$(".fixed-one").click(function (){
    $(this).addClass("active");
    $(this).siblings().removeClass('active');
    let val = Number($(this).children('.yuan').html());
    //手续费
    let fei = Number('{$shouxu}')
    //实际到账
    let num = val-(val*fei/100);
    $(".num").html(num);
    $(".toast").css("display",'block')
})
$(".btn").click(function (){
    if($(".active .yuan").html()){
        let val = Number($(".active .yuan").html());
        mui.confirm('你确定要提现' + val + '元吗', '', ['取消', '确定'], function (e) {
            if (e.index == 1) {
                mui.showLoading("处理中..", "div");
                $.post("{:url('member/moneytixian')}", {money: val}, function (response) {
                    mui.hideLoading();
                    mui.alert(response.message);
                    if (response.code == 1) {
                       setTimeout(()=>{
                           location.reload()
                       },1000)
                    }
                }, 'json')
            }
        })
    }else {
        mui.toast("请选择提现金额");
    }
})
</script>
</body>
</html>

apicloud调用源码:

<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>晶源矿场</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/common.css" />
</head>

<body style='background:#EDEDED;'>
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    var launchRemoved = false;
    var loadingRemoved = false;
    apiready = function() {

        api.setStatusBarStyle({
            style: 'light',
            // color:'transparent'
        });
        checkStoragePermission();
        api.openFrame({
            name: 'main',
            url: 'http://run.fengzhist.com/index/product/index',
            bounces: false,
            rect: {
                w: 'auto',
                h: 'auto'
            },
            progress: {
                type: 'page'
            }
        });
        api.setFrameClient({
            frameName: 'main'
        }, function(ret) {
            onBrowserStateChange(ret);
        });
        removeLogic();
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.historyBack({
                frameName: 'main'
            }, function(ret, err) {
                if (!ret.status) {
                    api.closeWidget();
                }
            });
        });
        removeLogic();
    };
    function onBrowserStateChange(ret) {
        if (0 == ret.state) { //开始加载
            if (!launchRemoved) {
                launchRemoved = true;
                removeLaunch();
            }
        }
        if (2 == ret.state) {
            if (!loadingRemoved) {
                loadingRemoved = true;
                document.getElementById('loading').style.display = 'none';
            }
        }
    }
    function removeLogic() {
        setTimeout(function() {
            if (!launchRemoved) {
                launchRemoved = true;
                removeLaunch();
            }
        }, 3000);
    }
    function removeLaunch() {
        api.removeLaunchView({
            animation: {
                type: "fade",
                subType: "from_right",
                duration: 300
            }
        });
    }
    var CODE_STORAGE = 1000001;
    var CODE_PHONE = 1000002;
    function checkStoragePermission() {
        var perms = ['storage'];
        var rets = api.hasPermission({
            list: perms
        });
        var toReq = [];
        for (var i in rets) {
            if (!rets[i].granted) {
                toReq.push(rets[i].name);
            }
        }
        if (toReq.length > 0) {
            _confirm(toReq, CODE_STORAGE, '请在设置中开启存储空间权限,以正常使用功能。');
        } else {
            checkPhonePermission();
        }
    }
    function checkPhonePermission() {
        var perms = ['phone'];
        var rets = api.hasPermission({
            list: perms
        });
        var toReq = [];
        for (var i in rets) {
            if (!rets[i].granted) {
                toReq.push(rets[i].name);
            }
        }
        if (toReq.length > 0) {
            // _confirm(toReq, CODE_PHONE, 'APP需使用电话权限确定设备ID,以保证通讯的安全性。\n请在设置中开启电话权限,以正常使用功能。');
        }
    }
    function reqPermission(_perms, _code, _msg) {
        api.requestPermission({
            list: _perms,
            code: _code
        }, function(ret, err) {
            var list = ret.list;
            var toReq = [];
            for (var i in list) {
                if (!list[i].granted) {
                    toReq.push(list[i].name);
                }
            }
            if (ret.code == CODE_STORAGE) {
                if (toReq.length > 0) {
                    _confirm(toReq, _code, _msg);
                } else {
                    checkPhonePermission();
                }
            }
        });
    }
    function _confirm(_perms, _code, _msg) {
        api.confirm({
            title: '权限申请',
            msg: _msg ? _msg : '请在设置中开启相关权限,以正常使用功能。',
            buttons: ['取消', '去设置']
        }, function(ret, err) {
            if (1 == ret.buttonIndex) {
                api.closeWidget({
                    silent: true
                });
            } else {
                reqPermission(_perms, _code, _msg);
            }
        });
    }
    //保存海报图片
    function preservationImg(img) {
        var filename = "cec" + new Date().getTime() + ".jpg";
        api.download({
            url: "http://run.fengzhist.com" + img,
            savePath: "fs://" + filename
        }, function(ret, err) {
            if (ret.state == 1) {
                api.saveMediaToAlbum({
                    path: "fs://" + filename
                }, function(ret, err) {

                    if (ret && ret.status) {
                        api.toast({
                            msg: '保存成功',
                            duration: 3000,
                            location: 'bottom'
                        });
                    } else {
                        api.toast({
                            msg: '保存失败',
                            duration: 3000,
                            location: 'bottom'
                        });
                    }
                });
            } else {
                alert("保存失败");
            }
        });
    }
    //实名认证支付宝支付
    function getAlipayInfo(realname, cardid) {
        api.ajax({
            url: "http://run.fengzhist.com/index/member/Alipay?real_name=" + realname + "&card_id=" + cardid,
            method: 'get',
            timeout: 2000,
            dataType: 'json',
            returnAll: false,
        }, function(ret, err) {
            if (ret.code == 0) {
                api.toast({
                    msg: ret.message,
                    duration: 2000,
                    location: 'bottom'
                });
            } else if (ret.code == 403) {
                api.alert({
                    title: '温馨提示',
                    msg: ret.message,
                    buttons: ['确定']
                });
            } else if (ret.code == 200){
                upAlipay(ret.message,1);
            }else {
              heshiCars(ret.message, realname, cardid,ret.order)
            }
        })
    }
    //核实身份信息
    function heshiCars(info, realname, cardid,order) {
      api.showProgress({
          title: '联网查询中...',
          text: '请稍等...',
      });
      setTimeout(()=>{
        api.ajax({
            url: "http://op.juhe.cn/idcard/query?key=7028f158300f634ecd1c8dc7941b79ae&realname=" + realname + "&idcard=" + cardid + "&orderid=1",
            method: 'get',
            timeout: 2000,
            dataType: 'json',
            returnAll: false,
        }, function(ret, err) {
            console.log(JSON.stringify(ret))
            api.hideProgress();
            if(ret.reason=='成功'){
              api.toast({
                  msg: '身份验证通过',
                  duration: 3000,
                  location: 'bottom'
              });
              upAlipay(info,1);
              upstar(realname, cardid,order);
            }else {
              api.toast({
                  msg: ret.reason,
                  duration: 3000,
                  location: 'bottom'
              });
            }
        })
      },2000)
    }
    //修改状态
    function upstar(realname, cardid,order) {
        api.ajax({
            url: "http://run.fengzhist.com/index/member/upstar?real_name=" + realname + "&card_id=" + cardid+"&order="+order,
            method: 'get',
            timeout: 2000,
            dataType: 'json',
            returnAll: false,
        }, function(ret, err) {
            console.log(JSON.stringify(ret))
        })
    }
    //唤起支付宝支付
    function upAlipay(info,star,para) {
        var aliPayPlus = api.require('aliPayPlus');
        aliPayPlus.payOrder({
            orderInfo: info
        }, function(ret, err) {
            if (ret.code == 9000) {
                if (star == 1) {
                  upuser(); //实名认证
                }
                if (star == 2) {
                  minerAlipaySuccess(para)//购买矿机
                }
                if (star == 3) {
                  updateVip(); //开通vip
                }
                if(star == 4){
                  updateShop(para); //够买商品
                }
                if (star == 5) {
                  updateMoney(para); //余额充值
                }
                api.toast({
                    msg: '支付成功',
                    duration: 3000,
                    location: 'bottom'
                });
            } else if (ret.code == 8000) {
                api.alert({
                    title: '支付结果',
                    msg: '支付结果未知,请联系客服人员',
                    buttons: ['确定']
                });
            } else if (ret.code == 4000) {
                api.alert({
                    title: '支付结果',
                    msg: '支付失败',
                    buttons: ['确定']
                });
            } else if (ret.code == 5000) {
                api.alert({
                    title: '支付结果',
                    msg: '重复支付',
                    buttons: ['确定']
                });
            } else if (ret.code == 6001) {
                api.toast({
                    msg: '用户主动取消支付',
                    duration: 3000,
                    location: 'bottom'
                });
            } else if (ret.code == 6002) {
                api.toast({
                    msg: '网络连接出错',
                    duration: 3000,
                    location: 'bottom'
                });
            } else if (ret.code == 6004) {
                api.alert({
                    title: '支付结果',
                    msg: '支付结果未知,请联系客服人员',
                    buttons: ['确定']
                });
            }
        });
    }
    //实名认证支付完成
    function upuser() {
        api.ajax({
            url: "http://run.fengzhist.com/index/member/upuser",
            method: 'get',
            timeout: 2000,
            dataType: 'json',
            returnAll: false,
        }, function(ret, err) {
            console.log(JSON.stringify(ret))
        })
    }
    //复制
    function apiCopy(token) {
      var clipBoard = api.require('clipBoard');
    	clipBoard.set({
       		value: token
    	}, function(ret, err) {
        	if (ret) {
            api.toast({
                msg: '复制成功',
                duration: 3000,
                location: 'bottom'
            });
    		} else {
        		alert("复制失败,请重试");
        	}
    	});
    }
    //矿机购买
    function minerAlipay(para){
      api.ajax({
          url: "http://run.fengzhist.com/index/product/AlipayRecharge?product_id=" + para,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          if (ret.code == 1) {
            upAlipay(ret.message,2,para);
          }else {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //支付完成
    function minerAlipaySuccess(para){
      api.ajax({
          url: "http://run.fengzhist.com/index/product/AlipayRechargeSuccess?product_id="+para,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          console.log(JSON.stringify(ret))
          if (ret.code == 1) {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //vip支付
    function vipPlay(){
      api.ajax({
          url: "http://run.fengzhist.com/index/index/openVip",
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          console.log(JSON.stringify(ret));
          if (ret.code == 1) {
            upAlipay(ret.message,3);
          }else {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //修改vip状态
    function updateVip(){
      api.ajax({
          url: "http://run.fengzhist.com/index/index/updateVip",
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          console.log(JSON.stringify(ret))
          if (ret.code == 1) {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //商品购买
    function shopPay(addressid,shopid,spec,beizhu){
      if (spec==undefined || spec=='undefined') {
        spec="";
      }
      api.ajax({
          url: "http://run.fengzhist.com/index/shops/createOrder?address_id="+addressid+"&shop_id="+shopid+"&spec="+spec+"&beizhu="+beizhu,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
        console.log(JSON.stringify(ret));
          if (ret.code == 1) {
            upAlipay(ret.message,4,ret.order);
          }else {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //修改商品订单
    function updateShop(order) {
      api.ajax({
          url: "http://run.fengzhist.com/index/shops/updateOrder?order_id="+order,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          if (ret.code == 1) {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
            api.openFrame({
                name: 'main',
                url: 'http://run.fengzhist.com/index/shops/tobidelivered.html',
                bounces: false,
                rect: {
                    w: 'auto',
                    h: 'auto'
                },
                progress: {
                    type: 'page'
                }
            });
          }
      })
    }
    //充值
    function chongzhi(money) {
      api.ajax({
          url: "http://run.fengzhist.com/index/member/yuchongzhi?money="+money,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          if (ret.code == 1) {
            upAlipay(ret.message,5,ret.order);
          }else {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
    //更新余额
    function updateMoney(para) {
      api.ajax({
          url: "http://run.fengzhist.com/index/member/updatemoney?order_id="+para,
          method: 'get',
          timeout: 2000,
          dataType: 'json',
          returnAll: false,
      }, function(ret, err) {
          console.log(JSON.stringify(ret))
          if (ret.code == 1) {
            api.toast({
                msg: ret.message,
                duration: 3000,
                location: 'bottom'
            });
          }
      })
    }
</script>

</html>

说明一下不打包一样可以运行,只能在浏览器端运行,这个项目本来就是web端项目,里面有些调用原生的方法自己调整一下就可以了,保存图片和充值、支付改一下就好了。


有什么问题可以联系我。

本实例支付的费用只是购买源码的费用,如有疑问欢迎在文末留言交流,如需作者在线代码指导、定制等,在作者开启付费服务后,可以点击“购买服务”进行实时联系,请知悉,谢谢
手机上随时阅读、收藏该文章 ?请扫下方二维码