hrjy преди 2 години
родител
ревизия
0d9aefda34

+ 30 - 0
app/admin/controller/user/Out.php

@@ -4,6 +4,7 @@ namespace app\admin\controller\user;
 
 use app\admin\controller\AuthController;
 use app\admin\controller\Union;
+use app\admin\model\order\StoreOrder;
 use app\admin\model\User;
 use crmeb\services\{ExpressService,
     FormBuilder,
@@ -213,4 +214,33 @@ class Out extends AuthController
             return Json::fail('添加失败');
     }
 
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function user_push($uid = 0)
+    {
+        return $this->fetch();
+    }
+
+
+    public function user_push_list()
+    {
+
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['auction'],
+            ['uid'],
+            ['spread_uid']
+        ]);
+
+        $data = StoreOrder::list($where);
+
+        return Json::successlayui($data);
+    }
+
 }

+ 43 - 0
app/admin/model/order/StoreOrder.php

@@ -1284,4 +1284,47 @@ HTML;
         $offline = self::getOrderWhere($where, new self)->count();
         return compact('weixin', 'yue', 'offline');
     }
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+            ->field('*')
+            ->order('id DESC');
+
+
+        if ($where['uid']) $model->where('uid', $where['uid']);
+        if ($where['spread_uid']){
+            $uids = User::where('spread_uid', $where['spread_uid'])->column('uid');
+            $model->where('uid', 'in', $uids);
+        }
+
+        $data['count'] = $model->count();
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+
+
+        $list = $model->select();
+        $list = count($list) ? $list->toArray() : [];
+
+        foreach ($list as &$item)
+        {
+            $user = User::where('uid', $item['uid'])->find();
+            if ($user['spread_uid']){
+                $spread = User::where('uid', $user['spread_uid'])->find();
+            }else{
+                $spread['nickname'] = '没有推广人';
+            }
+            $item['nickname'] = $user['nickname'].'/'.$user['uid'];
+            $item['spread_name'] = $spread['nickname'].'/'.$user['spread_uid'];
+
+        }
+
+        $data['data'] = $list;
+        return $data;
+
+    }
+
 }

+ 6 - 2
app/admin/model/user/UserPartake.php

@@ -34,7 +34,7 @@ class UserPartake extends BaseModel
     public static function list($where)
     {
         $model = self::alias('a')
-            ->field('a.*,b.nickname,c.name')
+            ->field('a.*,b.nickname,c.name,c.number')
             ->order('a.id DESC')
             ->leftJoin('user b', 'b.uid = a.uid')
             ->leftJoin('out c', 'c.id = a.out_id');
@@ -65,8 +65,12 @@ class UserPartake extends BaseModel
         $list = count($list) ? $list->toArray() : [];
         foreach ($list as &$item)
         {
+            $uids = User::where('spread_uid', $item['uid'])->column('uid');
             if ($item['money'] == 0){
-                $item['money'] = User::where('uid', $item['uid'])->find()['pay_price'];
+                $item['money'] = StoreOrder::where('uid', 'in', $uids)
+                    ->where('paid', 1)
+                    ->where('is_participate', 0)
+                    ->sum('pay_price');
             }
         }
         $data['data'] = $list;

+ 178 - 0
app/admin/view/user/out/user_push.php

@@ -0,0 +1,178 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline {
+        border: none;
+    }
+
+    .btn-outline:hover {
+        background-color: #0e9aef;
+        color: #fff;
+    }
+
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+
+    .layui-btn-primary {
+        margin-right: 10px;
+        margin-left: 0 !important;
+    }
+
+    label {
+        margin-bottom: 0 !important;
+        margin-top: 4px;
+    }
+</style>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15" id="app">
+        搜索条件
+                <div class="layui-col-md12">
+                    <div class="layui-card">
+                        <div class="layui-card-header">搜索条件</div>
+                        <div class="layui-card-body">
+                            <div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">
+                                <form class="layui-form layui-form-pane" action="">
+                                    <div class="layui-form-item">
+
+                                        <div class="layui-col-lg12">
+                                            <label class="layui-form-label" style="top: -5.5px;">推广人</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" id="spread_uid" name="spread_uid" class="layui-input" placeholder="推广人">
+                                            </div>
+                                            <label class="layui-form-label" style="top: -5.5px;">消费人</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" id="uid" name="uid" class="layui-input" placeholder="消费人">
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <div class="layui-input-inline">
+                                                <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                                    <i class="layui-icon layui-icon-search"></i>搜索</button>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">消费列表</div>
+                <div class="layui-card-body">
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
+                    </script>
+                    <script type="text/html" id="is_participate">
+                        {{# if(d.is_participate == 0){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" style="color: red">未结算</button>
+                        {{# } }}
+                        {{# if(d.is_participate == 1){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs">已结算</button>
+                        {{# } }}
+                    </script>
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
+                                onclick="$eb.createModalFrame('{{d.title}}-编辑','{:Url('edit')}?id={{d.id}}',{h:700,w:1100})">
+                            编辑
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
+                                onclick="$eb.createModalFrame('{{d.title}}-编辑内容','{:Url('edit_content')}?id={{d.id}}')">
+                            编辑内容
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
+                            删除
+                        </button>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layList.tableList('List', "{:Url('user_push_list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'spread_name', title: '推广人', align: 'center'},
+            {field: 'nickname', title: '消费人', align: 'center'},
+            {field: 'pay_price', title: '消费额度', align: 'center'},
+            {field: 'is_participate', title: '是否结算',templet: '#is_participate', align: 'center'},
+            // {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            // {field: 'right', title: '操作', align: 'center', toolbar: '#act'},
+        ];
+    });
+
+    //查询
+    layList.search('search', function (where) {
+        layList.reload(where, true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event, data, obj) {
+        switch (event) {
+            case 'delete':
+                var url = layList.U({c: 'user.out', a: 'delete', q: {id: data.id}});
+                var code = {title: "操作提示", text: "确定将该商品移入回收站吗?", type: 'info', confirm: '是的,移入回收站'};
+                $eb.$swal('delete', function () {
+                    $eb.axios.get(url).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success', res.data.msg);
+                            obj.del();
+                            location.reload();
+                        } else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function (err) {
+                        $eb.$swal('error', err);
+                    });
+                }, code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                location.href = layList.U({a: 'edit', q: {id: data.id}});
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status', function (odj, value) {
+        if (odj.elem.checked == true) {
+            layList.baseGet(layList.Url({c: 'user.out', a: 'set_status', p: {status: 1, id: value}}), function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        } else {
+            layList.baseGet(layList.Url({c: 'user.out', a: 'set_status', p: {status: 0, id: value}}), function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 1 - 0
app/admin/view/user/user_partake/index.php

@@ -136,6 +136,7 @@
             {field: 'nickname', title: '用户昵称', align: 'center'},
             {field: 'name', title: '出局名称', align: 'center'},
             {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            {field: 'number', title: '达标额度', align: 'center'},
             {field: 'money', title: '累计金额', align: 'center'},
             {field: 'create_time', title: '参与时间', align: 'center'},
             {field: 'right', title: '操作', align: 'center', toolbar: '#act'},

+ 404 - 0
app/api/controller/Gmdemo.php

@@ -0,0 +1,404 @@
+<?php
+/**
+ * @Author: Marte
+ * @Date:   2017-07-31 15:26:02
+ * @Last Modified by:   Marte
+ * 1、getPostData 获取对方发过来的请求使用此方法对获取到的数据进行解密解签后得到数据
+ * 2、runJson 返回数据给对方使用此方法对数据进行拼接加签加密后返回
+ * 3、getToken 获取token方法,可以自行储存在文件内重复使用,过期后再次获取
+ * 4、postJry 业务请求数据拼接,发送请求接口
+ * 5、cityQuery 业务请求封装
+ * 6、decryptByPublicKey  rsa解密方法
+ * 7、encryptByPrivateKey  rsa加密方法
+ * 8、decrypt   aes解密方法
+ * 9、encrypt   aes加密方法
+ */
+
+namespace app\api\controller;
+
+
+use app\api\controller\AuthController as Controller;
+
+class Gmdemo extends Controller{
+
+    //以下参数都需要金融云提供
+    //AES偏移量
+    protected $iv = 'abcdefghABCDEFGH';
+    protected $appID = "96c8268e-cfa4-497f-9329-a5e3417f0825";
+    protected $appSecretKey = "921b3c06-eaed-7b1c-e053-010000717745";
+    protected $tokenUrl = "https://mouldai.com/apiSIT/tzyj/approveDev";//回归环境
+    protected $token;
+    //合作机构自有公钥
+    const PUBLIC_KEY = "DE3w4DgjV+np0oHQzSDUgvlxGKPhi/gHBRp8dtjun+z6uqrRJE6B1qswZpaSCs3tp0tm98ZjjL9RTuNh4dyUuA==";
+    //合作机构自有私钥
+    const PRIVATE_KEY = "778NKKZgdS9IGm/crvajNPoq5CHJNEKXptciF/1SU3I=";
+    //泰隆银行公钥
+    const CGB_PUBLIC_KEY = "kZYtvaa+HIImu0xhONxte8wyXmMBe7HKKf1i1fqU7Wf8PrsmvAguPNClPXfOoxqW8gmy5qrFK9oX3tvmrq4r0A==";
+
+    public function _initialize()
+    {
+        // 初始化加密扩展
+        echo "--------php_crypto_init 初始化开始--------\n";
+        $path = "/opt/php/libcryptAPIsm_lnx64.so";
+        php_crypto_init($path);
+        echo "--------php_crypto_init 初始化结束-------\n";
+    }
+    function string2hex($string){
+        $hex = '';
+        for($i = 0;$i < strlen($string); $i++){
+            $ch = dechex(ord($string[$i]));
+            if(strlen($ch)==1){
+                $ch = "0".$ch;
+            }
+            $hex .=$ch;
+        }
+        return $hex;
+    }
+    //获取token
+    public function getToken(){
+        //获取6位数字符串
+        $seqNO = (string)rand(100000,999999);
+        //获取16位随机字符串并md5 转大写 得到
+        $key = strtoupper(md5($this->getKey()));
+		
+		
+		//echo $this->string2hex(base64_decode(self::PRIVATE_KEY));
+		
+		echo $this->string2hex(base64_decode(self::PUBLIC_KEY));
+		
+            
+        //初始化转换密钥信息
+        php_HextoAsc($this->string2hex(base64_decode(self::PRIVATE_KEY)),$k1);
+        php_HextoAsc($this->string2hex(base64_decode(self::PUBLIC_KEY)),$k2);
+        php_HextoAsc($this->string2hex(base64_decode(self::CGB_PUBLIC_KEY)),$gf_k);
+
+        //拼接参数数组
+        $data = [
+            'appID' => $this->appID,
+            'seqNO' => $seqNO,
+            'random'=> strtoupper(md5($seqNO)),
+            'sm2EncryptData' => $this->SM2Encrypt($key,$gf_k), //sm2加密key
+            'sm2Sign' => $this->SM2Sign($key,$k2,$k1), //sm2加密key
+        ];
+
+        //拼接签名参数,md5转大写
+        $data['sign'] = $this->SM3Crypt($data['random'] . $data['seqNO'] . $this->appSecretKey . $key);
+
+        //发送post接口请求
+        $res = $this->https_post($this->tokenUrl,$data);
+		
+        //解密返回token数据
+        $token = $this->SM2Decrypt(base64_decode($res['sm2EncryptData']),$k1);
+
+        $this->token = $token;
+        //返回token
+        return $token;
+    }
+
+    //业务请求数据
+    public function postJry()
+    {
+        //创建模拟请求数据,必须包含head,body
+        $data = [
+            'head' => [
+                'id' => 8989
+            ],
+            'body' => [
+                'code'=>"000000",
+                'msg'=>"测试请求"
+            ]
+        ];
+        $res = $this->scanPaymentCode($data);
+        dump("返回结果");
+        halt($res);
+
+    }
+
+    //业务请求封装
+    public function scanPaymentCode($array=[])
+    {
+        //初始化转换密钥信息
+        php_HextoAsc($this->string2hex(base64_decode(self::PRIVATE_KEY)),$k1);
+        php_HextoAsc($this->string2hex(base64_decode(self::PUBLIC_KEY)),$k2);
+        php_HextoAsc($this->string2hex(base64_decode(self::CGB_PUBLIC_KEY)),$gf_k);
+//        $this->string2hex(base64_decode(self::PRIVATE_KEY));
+//        $this->string2hex(base64_decode(self::PUBLIC_KEY));
+//        $this->string2hex(base64_decode(self::CGB_PUBLIC_KEY));
+
+
+        //数据转json
+        $json = json_encode($array, JSON_UNESCAPED_UNICODE);
+        //获取随机6位字符串数字
+        $seqNO = (string)rand(100000,999999);
+        //获取随机字符串秘钥,md5 并转大写
+        $key = strtoupper(md5($this->getKey()));
+        //拼接请求数据
+        $data = [
+            'appID' => $this->appID,
+            'seqNO' => $seqNO,
+            'signMethod' => "SM3",
+            'encryptMethod' => "SM4",
+            'appAccessToken'=> $this->getToken(),//获取token
+            'sm2EncryptData' => $this->SM2Encrypt($key,$gf_k), //sm2加密key
+            'sm2Sign' => $this->SM2Sign($key,$k2,$k1), //sm2加密key
+        ];
+
+        //拼接签名参数,md5转大写
+        $data['sign'] = $this->SM3Crypt($json . $data['seqNO'] . $this->appSecretKey . $key);
+        //AES加密业务数据
+        $data['reqData'] = $this->SM4Encrypt($json,$data['seqNO'] . $data['appAccessToken'] . $this->appSecretKey . $key);
+
+        dump("业务数据json");
+        dump($json);
+        dump("请求数据");
+        dump($data);
+        $res = $this->https_post("https://mouldai.com/apiSIT/tzyj/scanPaymentCode",$data);
+
+        //解密sm2密钥
+        $sm2Key =  $this->SM2Decrypt(base64_decode($res['sm2EncryptData']),$k1);
+
+        dump("sm2解密数据:".$sm2Key);
+
+        //SM4解密数据
+        $rspData = $this->SM4Decrypt($res['rspData'],$res['seqNO'] .$data['appAccessToken']. $this->appSecretKey. $sm2Key);
+
+        dump("sm4解密报文数据:".$rspData);
+
+        //sm3验签数据校验
+        $sm3SignData = $this->SM3Crypt($rspData . $res['seqNO'] .$this->appSecretKey . $sm2Key);
+
+        dump("sm3响应报文拼接加签:".$sm3SignData);
+
+        $signData = $res['sign'];
+
+        dump("sm3响应报文签名:".$signData);
+
+        if ($sm3SignData == $signData) {
+            dump("验签成功!");
+        }
+
+        dump($res);
+        return $res;
+    }
+    //获取post数据并解密解签获得业务数据
+    public function getPostData()
+    {
+        //获取post数据
+        $arr = input("post.");
+        //模拟post获取数据
+        $arr = '{"sign":"1CA0926A5C8BC2E2347E57016650E731","signMethod":"MD5","rsaEncryptData":"xs8lNVCj4ZCsAbXoJHI+AmRPqDJk01dlt3q7Jb9Vox4SNvvx6F+DclM2v1FdnDxAsNgXBERLXCc3SOFnqtrcMdYxc2GKyF+YTLJKjX0NmlGkXlO2oipIzhIL94la\/NGEzlT+JL4I8KF5vZvE+4gudkg0mZ+jC6jPWc+qyM6RROdwbgYPCiOpVTaQ+jtIxwz4rCY\/a2z\/fAFazzApUbyRxsCTVRESJ+3dU8V9zYxE7VzrV+IlOCwJdAIAfGPcwjq5wd3p\/3yEeFDBbZz0N6jnIEIlkCH99NsNFWIYY2mH0K2z+ccpJlBejoNq+FaxusS2DvZfJhp8xa3dav8itVyiSw==","encryptMethod":"AES","reqData":"QbYx9PwqKwy30K1SSgiorq9Sg9taSxImEw6qwY93N0QhsRb1UHqBghS+WmbBRZxrBTCMYNGBsG1GFvUdJxIrdXaQ4qBU\/PTpIjLlD+bvRyE27OYgHrSpQ6umylxWXSTYUIO0qbdTjNTR8UwRKPlHjuUJ149E5eH+s\/oyE6zZi9KNzx8BwjeZ\/Qeo\/CQF7fMuu3uJF7XOOIDqLidXvevQEr8hHLUyT40a\/NZsOAoqQSoNppazy+tDuttATH7gFWjFKNzRtt89wDdbjWNtK95tc\/uUBojfjg5HKcctSmqQ7jW6HvA2J5k3WnC6mxsTdaU9WPjtKbnqGUTkoM9YbJs1VghcnnQLSH49wAY7kB5SwWwTaPkHZy5kvytfMvLjwgjUioW0qYSpZyaBww4dSXJ0bQ1Mb+TArunrCpIzl2T4ZkzWT3\/j0m4bJoq7le4l03NVAn8iA3ju2asrBbrySTWzQ9vXDQbq1q+S5uh9YTXrVq0dM6CMNV8KquOCEC0UyaTKxCK2+cAS9LDQD4APXRTuNhkR57LKox2CfvN+CTDlWw8QfFfYKdNpmt\/OHklrUez0LcfMluc08ce1fvoDCuOqMN51y5qhV+d3utWa5rBjvzhE8de5qi54l3qW4EV03sQRdvN7R433fxOVt33N1mZ3NOwx1xjnJ4ivdVuhZ1XbGHd\/B7NGGafQbx3RChEIT250Kl3vih\/P2yF1ozQC8MY6sAHgOxAufmos8DoOwwWy9L59lNqN2sAnVpPalvjM4UCa8pkSrToDaoU4Sc44JOBghQ==","appAccessToken":"","seqNO":"127600","appID":"a539d3d7-3d4b-454b-9c49-7fb83fb8b611"}';//正式获取数据删除这里
+        $arr = json_decode($arr, true); //正式获取数据删除这里
+
+        //检验字段是否缺失
+        if (!isset($arr['rsaEncryptData']) || !isset($arr['seqNO']) || !isset($arr['signMethod']) || !isset($arr['sign']) || !isset($arr['encryptMethod']) || !isset($arr['reqData']) || !isset($arr['appID'])) {
+            return $this->runJson("1000001", "缺少参数");
+        }
+        dump("获取到的post数据");
+        dump($arr);
+        //rsa解密秘钥字段rsaEncryptData
+        $rasKey = $this->decryptByPublicKey($arr['rsaEncryptData']);
+        dump("解密后的秘钥");
+        dump($rasKey);
+        //拼接秘钥
+        $key = $arr['seqNO'] . $this->token . $this->appSecretKey . $rasKey;
+
+        //秘钥转md5 转大写
+        $key = strtoupper(md5($key));
+
+        //aes解密
+        $res = $this->decrypt($arr['reqData'], $key);
+
+        $res = json_decode($res, true);
+        dump("数据结果");
+        halt($res);
+    }
+
+    //SM2Encrypt
+    function SM2Encrypt($data,$pubkey){
+        //sm2加密
+        $recode = php_SM2Encrypt($data, $cipher, $pubkey);
+
+        echo "<br/>recode:$recode \n";
+
+        //php_SM2Encrypt接口返回的密文值是c1c3c2格式,以下示例转DER编码
+        $recode = php_SM2FormatConvert(102,$cipher, $der);
+        echo "<br/>recode:$recode \n";
+
+        //SM2加密字符串转base64编码
+        $sm2encrypted = base64_encode($der);
+
+        echo "<br/>sm2加密字符串base64:$sm2encrypted \n";
+
+        return $sm2encrypted;
+    }
+
+    //SM2Decrypt
+    function SM2Decrypt($data,$privkey){
+        //php_SM2Decrypt 接收密文值是c1c3c2格式,若对方给的密文值是DER格式 则通过如下方式转换,然后再传入接口解密
+        $recode = php_SM2FormatConvert(101,$data,$c1c3c2);
+        echo "<br/>recode:$recode \n";
+
+        //解密
+        $recode = php_SM2Decrypt($c1c3c2,$plain,$privkey);
+        echo "<br/>recode:$recode \n";
+        echo "<br/>解密数据plain: $plain\n";
+        return $plain;
+    }
+
+    //SM2Sign
+    function SM2Sign($data,$pubkey,$privkey){
+        //签名
+        $recode = php_SM2Sign($data, $redata,$privkey,$pubkey);
+        echo "<br/>recode:$recode \n";
+
+        //php_SM2Sign接口返回的签名值是RS格式,以下示例转DER编码
+        $php_func = 'php_SM2FormatConvert';
+        $recode = $php_func(202,$redata, $der);
+        echo "<br/>recode:$recode \n";
+        echo "<br/>data: ".$data." len:".strlen($data)." \n";
+        echo "<br/>signValue DER: ".base64_encode($der)." len:".strlen($der)." \n";
+
+        //加签数据base64返回
+        $sm2SignData = base64_encode($der);
+        return $sm2SignData;
+    }
+
+    //SM3Crypt
+    function SM3Crypt($data){
+        $recode = php_SM3Crypt($data,$sm3hash);
+        echo "<br/>recode:$recode \n";
+        //加签数据base64返回
+        return strtoupper($this->string2hex($sm3hash));
+    }
+
+    //16进制转换为二进制
+    function hex2String($hexdata){
+        $bindata="";
+        for ($i=0;$i < strlen($hexdata);$i+=2) {
+            $bindata.=chr(hexdec(substr($hexdata,$i,2)));
+        }
+        return $bindata;
+    }
+
+    //SM4Encrypt
+    function SM4Encrypt($data,$password){
+        //加密密码做特殊处理  先MD5转换大写 从第8位开始截取16个字符串
+        $password = substr(strtoupper(md5($password)),8,16);
+        echo "<br/>【SM4】MD5加密密码=======".$password;
+
+        //接口是密文key,将明文key加密后再传入php_SM4CBCCrypt进行数据加密
+        //不必要每次都加密key,建议手工加密一次,将key密文保存使用,key明文保存至安全的地方
+        //若是会话级别的key则自行定策略
+        $recode = php_CryptKey(0, $password,$key);
+        echo "<br/>recode:$recode \n";
+
+        //加密
+        $recode = php_SM4CBCCrypt(0,$data,$redata,$key,$this->iv);
+        echo "<br/>recode:$recode \n";
+        echo "<br/>redata: ".base64_encode($redata)." \n";
+
+        $SM4Encryptdata = base64_encode($redata);
+        return $SM4Encryptdata;
+    }
+
+    //SM4Encrypt
+    function SM4Decrypt($data,$password){
+        echo "<br/>SM4解密数据=======".$data;
+
+        //加密密码做特殊处理
+        $password = substr(strtoupper(md5($password)),8,16);
+        echo "<br/>MD5密码=======".$password;
+
+        //接口是密文key,将明文key加密后再传入php_SM4CBCCrypt进行数据加密
+        //不必要每次都加密key,建议手工加密一次,将key密文保存使用,key明文保存至安全的地方
+        //若是会话级别的key则自行定策略
+        $recode = php_CryptKey(0, $password,$key);
+        echo "<br/>recode:$recode \n";
+
+        //解密
+        $recode = php_SM4CBCCrypt(1,base64_decode($data),$dedata,$key,$this->iv);
+        echo "<br/>sm4[解密]recode:$recode \n";
+        return $dedata;
+    }
+
+    /**
+     * 公钥解密
+     * @param 密文数据 $data
+     * @return 原文结果 string
+     */
+    private function decryptByPublicKey($data) {
+        $data = base64_decode($data);
+        openssl_public_decrypt($data,$decrypted,$this->publicKey,OPENSSL_PKCS1_PADDING);//公钥解密
+        return $decrypted;
+    }
+    /**
+     * 私钥加密
+     * @param 原始数据 $data
+     * @return 密文结果 string
+     */
+    private function encryptByPrivateKey($data) {
+        openssl_private_encrypt($data,$encrypted,$this->privateKey,OPENSSL_PKCS1_PADDING);//私钥加密
+        $encrypted = base64_encode($encrypted);//加密后的内容通常含有特殊字符,需要编码转换下,在网络间通过url传输时要注意base64编码是否是url安全的
+        return $encrypted;
+    }
+
+    //封装返回数据
+    private function runJson($code="000000",$msg="完成"){
+        return json(['code'=>$code,'message'=>$msg]);
+
+        //以下加密信息返回,暂时不用使用
+//        $data = [
+//            'signMethod'    => 'MD5',
+//            'encryptMethod' => 'AES',
+//            'appID' => $this->appID,
+//            'seqNO' => (string)rand(100000,999999),
+//            'appAccessToken' => ''
+//        ];
+//        $json = json_encode(['code'=>$code, 'message'=>$msg]);
+//        $key = strtoupper(md5(getKey()));//随机秘钥
+//        $data['rsaEncryptData'] = $this->encryptByPrivateKey($key);
+//        $data['reqData'] = $this->encrypt($json, $key);
+//        $data['sign'] = strtoupper(md5($data['reqData'] . $data['seqNO'] . $this->appSecretKey . $key ));
+//        return json($data);
+    }
+
+    // curl post请求
+    private function https_post($url, $data = null)
+    {
+        $data = json_encode($data, JSON_UNESCAPED_SLASHES);
+        $header [] = 'Content-Type:application/x-www-form-urlencoded';
+        $ch = curl_init();
+        curl_setopt ( $ch, CURLOPT_HTTPHEADER, $header );
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
+        @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+        curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        $tmpInfo = curl_exec($ch);
+        curl_close($ch);
+        $tmpInfo1 = json_decode($tmpInfo, true);
+        return $tmpInfo1;
+    }
+    /**
+     * 获得随机字符串
+     **/
+    private function getKey($length = 16)
+    {
+        // 密码字符集,可任意添加你需要的字符
+        $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ2345678';
+        $key = '';
+        for ($i = 0; $i < $length; $i++) {
+            // 这里提供两种字符获取方式
+            // 第一种是使用 substr 截取$chars中的任意一位字符;
+            // 第二种是取字符数组 $chars 的任意元素
+            // $key .= substr($chars, mt_rand(0, strlen($chars) – 1), 1);
+            $key .= $chars[mt_rand(0, strlen($chars) - 1)];
+        }
+        return $key;
+    }
+
+}

+ 15 - 0
app/api/controller/order/StoreOrderController.php

@@ -2,6 +2,7 @@
 
 namespace app\api\controller\order;
 
+use app\api\controller\Gmdemo;
 use app\admin\model\system\{
     SystemAttachment, ShippingTemplates
 };
@@ -338,6 +339,20 @@ class StoreOrderController
                     return app('json')->fail(is_array($error) && isset($error['msg']) ? $error['msg'] : $error);
                 }
                 break;
+            case 'ztpay':
+                $gm = new Gmdemo();
+                $data = [
+                    'mechNo' => 123456,// 商户号
+                    'inetNo' => $order['order_id'],//订单号
+                    'sndTmstmp' => date('YmdHis', time()),
+                    'pdDsc' => '=商品购买',
+                    'pymntAmt' => $order['pay_price'] * 100, // 交 易 单 位 为 分
+                    'ccy' => 156,
+                    'channelCode' => ''//渠道号
+                ];
+                $res = $gm->scanPaymentCode($data);
+                halt($res);
+
             case 'offline':
                 StoreOrder::createOrderTemplate($order);
                 if (StoreOrder::setOrderTypePayOffline($order['order_id']))

+ 343 - 0
app/api/controller/phpcrypto.php

@@ -0,0 +1,343 @@
+<?php
+function string2hex($string){
+    $hex = '';
+    for($i = 0;$i < strlen($string); $i++){
+        $ch = dechex(ord($string[$i]));
+        if(strlen($ch)==1){
+            $ch = "0".$ch;
+        }
+        $hex .=$ch;
+    }
+    return $hex;
+}
+/*
+function hex2string($hex){
+	//echo "$hex \n";
+	$string = '';
+	for($i = 0;$i < strlen($hex);$i++){
+		$string .= chr(hexdec($hex[$i].$hex[$i++]));
+	}
+	return $string;
+}
+*/
+if(!extension_loaded('phpcrypto')) {
+    dl('phpcrypto.so');
+}
+
+$module = 'phpcrypto';
+$functions = get_extension_funcs($module);
+echo "Functions available in the test extension:\n";
+foreach($functions as $func) {
+    echo $func."\n";
+}
+echo "\n";
+
+//先加载动态库,否则无法调用接口
+function test_php_crypto_init(){
+    $php_func = 'php_crypto_init';
+    echo "--------$php_func--------\n";
+    $path = "/opt/php/libcryptAPIsm_lnx64.so";//国密动态库路径
+    $recode = $php_func($path);
+    echo "recode:$recode \n";//如果非零,则加载失败
+}
+
+//test php_SM4Crypt1
+function test_php_SM4Crypt1(){
+    $php_func = 'php_SM4Crypt1';
+    echo "--------$php_func--------\n";
+    $data = "this is a test! 这是个测试!";
+    $key = "1234567890123456";//如果是hex编码,务必解码
+    $recode = $php_func(0,$data,$redata,$key);
+    echo "recode:$recode \n";
+    echo "redata: ".string2hex($redata)." len:".strlen($redata)." \n";
+    $recode = $php_func(1,$redata,$dedata,$key);
+    echo "recode:$recode \n";
+    echo "plain: ".$dedata." \n";
+}
+
+//test SM4Crypt2
+function test_php_SM4Crypt2(){
+    $php_func = 'php_SM4Crypt2';
+    echo "--------$php_func--------\n";
+    $data = "this is a test! 这是个测试!";
+    $key = "1234567890123456";//如果是hex编码,务必解码
+    $recode = $php_func(0,$data,$redata,$key);
+    echo "recode:$recode \n";
+    echo "redata: ".string2hex($redata)." len:".strlen($redata)." \n";
+    $recode = $php_func(1,$redata,$dedata,$key);
+    echo "recode:$recode \n";
+    echo "plain: ".$dedata." \n";
+}
+
+//test php_CryptFile
+function test_php_CryptFile(){
+    $php_func = 'php_CryptFile';
+    echo "--------$php_func--------\n";
+    $flag = 2;
+    $infilename = "/home/essc50mysql/mf/src_crypt/test_cryptfile";
+    $encodefilename = "/home/essc50mysql/mf/src_crypt/test_encode_cryptfile";
+    $format = 1;
+    $key = "1234567890123456";//如果是hex编码,务必解码
+    $recode = $php_func($flag, $key, $infilename,$encodefilename,$format);
+    echo "recode:$recode \n";
+    $flag = 3;
+    $decodefilename = "/home/essc50mysql/mf/src_crypt/test_decode_cryptfile";
+    $recode = $php_func($flag, $key, $encodefilename,$decodefilename,$format);
+    echo "recode:$recode \n";
+}
+
+//test php_CryptKey
+function test_php_CryptKey(){
+    $php_func = 'php_CryptKey';
+    echo "--------$php_func--------\n";
+    $flag = 0;
+    $plainkey = "1234567890123456";
+    $recode = $php_func($flag, $plainkey,$cipherkey);
+    echo "recode:$recode \n";
+    echo "cipherkey: ".string2hex($cipherkey)." len:".strlen($cipherkey)." \n";
+    $flag = 2;
+    $recode = $php_func($flag, NULL,$genkey);
+    echo "recode:$recode \n";
+    echo "genkey: ".string2hex($genkey)." len:".strlen($genkey)." \n";
+}
+
+//test php_SM3Crypt
+function test_php_SM3Crypt(){
+    $php_func = 'php_SM3Crypt';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!";
+    $recode = $php_func($data,$sm3hash);
+    echo "recode:$recode \n";
+    echo "sm3hash=================: ".string2hex($sm3hash)." len:".strlen($sm3hash)."============= \n";
+}
+
+//test php_MACCrypt
+function test_php_MACCrypt(){
+    $php_func = 'php_MACCrypt';
+    echo "--------$php_func--------\n";
+    $flag = 0;
+    $data = "this is test 这是测试!this is test 这是测试!";
+    $key = "1234567890123456";
+    $recode = $php_func($flag,$data, $key,$redata);
+    echo "recode:$recode \n";
+    echo "flag:".$flag." redata: ".string2hex($redata)." len:".strlen($redata)." \n";
+    $flag = 1;
+    $recode = $php_func($flag,$data, $key,$redata);
+    echo "recode:$recode \n";
+    echo "flag:".$flag." redata: ".string2hex($redata)." len:".strlen($redata)." \n";
+}
+
+//test php_CryptLmkMac
+function test_php_CryptLmkMac(){
+    $php_func = 'php_CryptLmkMac';
+    echo "--------$php_func--------\n";
+    $recode = $php_func($data,$version, $pubkey);
+    echo "recode:$recode \n";
+    echo "keymac: ".string2hex($data)." version:".$version." pubkey".string2hex($pubkey)." len:".strlen($pubkey)." \n";
+}
+
+//test php_SM2Genkey
+function test_php_SM2Genkey(){
+    $php_func = 'php_SM2Genkey';
+    //echo "--------$php_func--------\n";
+    $recode = $php_func($privkey, $pubkey);
+    //echo "recode:$recode \n";
+    echo "privkey: ".string2hex($privkey)." len:".strlen($privkey)." pubkey: ".string2hex($pubkey)." len:".strlen($pubkey)." \n";
+
+    echo "sm2密钥对:"+array($privkey, $pubkey);
+
+    return array($privkey, $pubkey);
+}
+
+
+//test php_SM2Sign
+function test_php_SM2SignAndSM2Verify(){
+    $php_func = 'php_SM2Sign';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!this is test 这是测试!";//数据有中文则需要注意字符编码的问题
+    $sm2keys = test_php_SM2Genkey();//0 privkey 1 pubkey
+    //签名
+    $recode = $php_func($data, $redata,$sm2keys[0],$sm2keys[1]);
+    echo "recode:$recode \n";
+    echo "signValue: ".string2hex($redata)." len:".strlen($redata)." \n";
+    //php_SM2Sign接口返回的签名值是RS格式,以下示例转DER编码
+    $php_func = 'php_SM2FormatConvert';
+    $recode = $php_func(202,$redata, $der);
+    echo "recode:$recode \n";
+    echo "signValue DER: ".string2hex($der)." len:".strlen($der)." \n";
+
+    //验签
+    $php_func = 'php_SM2Verify';
+    $recode = $php_func($data, $redata,$sm2keys[1]);
+    echo "recode:$recode \n";
+
+    //php_SM2Verify 接收的签名值是RS格式,若对方给的签名值是DER格式
+    //则通过如下方式转换,然后再验签
+    $php_func = 'php_SM2FormatConvert';
+    $recode = $php_func(201,$der, $rs);
+    echo "recode:$recode \n";
+    echo "signValue RS: ".string2hex($rs)." len:".strlen($rs)." \n";
+}
+
+//test php_SM2SignHash php_SM2VerifyHash
+function test_php_SM2SignHashAndSM2VerifyHash(){
+    $php_func = 'php_SM2SignHash';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!this is test 这是测试!";
+    $sm2keys = test_php_SM2Genkey();//0 privkey 1 pubkey
+
+    $php_func = 'php_SM3Crypt';
+    $recode = $php_func($data,$sm3hash);
+    echo "recode:$recode \n";
+    echo "sm3hash: ".string2hex($sm3hash)." len:".strlen($sm3hash)." \n";
+
+    $php_func = 'php_SM2SignHash';
+    $recode = $php_func($sm3hash, $redata,$sm2keys[0]);
+    echo "recode:$recode \n";
+    echo "signValue: ".string2hex($redata)." len:".strlen($redata)." \n";
+    $php_func = 'php_SM2VerifyHash';
+    $recode = $php_func($sm3hash, $redata,$sm2keys[1]);
+    echo "recode:$recode \n";
+}
+
+//test php_SM2Encrypt php_SM2Decrypt
+function test_php_SM2EncryptAndSM2Decrypt(){
+    $php_func = 'php_SM2Encrypt';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!this is test 这是测试!";
+    $sm2keys = test_php_SM2Genkey();//0 privkey 1 pubkey
+
+    //加密
+    $recode = $php_func($data, $cipher,$sm2keys[1]);
+    echo "recode:$recode \n";
+    echo "cipher: ".string2hex($cipher)." len:".strlen($cipher)." \n";
+    //php_SM2Encrypt接口返回的密文值是c1c3c2格式,以下示例转DER编码
+    $php_func = 'php_SM2FormatConvert';
+    $recode = $php_func(102,$cipher, $der);
+    echo "recode:$recode \n";
+    echo "cipher DER: ".string2hex($der)." len:".strlen($der)." \n";
+
+    //解密
+    $php_func = 'php_SM2Decrypt';
+    $recode = $php_func($cipher, $plain,$sm2keys[0]);
+    echo "recode:$recode \n";
+    echo "plain: $plain\n";
+
+    //php_SM2Decrypt 接收密文值是c1c3c2格式,若对方给的密文值是DER格式
+    //则通过如下方式转换,然后再传入接口解密
+    $php_func = 'php_SM2FormatConvert';
+    $recode = $php_func(101,$der, $c1c3c2);
+    echo "recode:$recode \n";
+    echo "cipher c1c3c2: ".string2hex($c1c3c2)." len:".strlen($c1c3c2)." \n";
+}
+
+//test php_HextoAsc php_AsctoHex
+function test_php_HextoAscAndAsctoHex(){
+    $php_func = 'php_AsctoHex';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!this is test 这是测试!";
+
+    $recode = $php_func($data, $hex);
+    echo "recode:$recode \n";
+    echo "hex: $hex len:".strlen($hex)." \n";
+    $php_func = 'php_HextoAsc';
+    $recode = $php_func($hex, $asc);
+    echo "recode:$recode \n";
+    echo "plain: $asc\n";
+}
+
+//test php_base64_decode php_base64_encode
+function test_php_base64_decodeAndbase64_encode(){
+    $php_func = 'php_base64_encode';
+    echo "--------$php_func--------\n";
+    $data = "this is test 这是测试!this is test 这是测试!";
+
+    $recode = $php_func($data, $base64);
+    echo "recode:$recode \n";
+    echo "base64char: $base64 len:".strlen($base64)." \n";
+    $php_func = 'php_base64_decode';
+    $recode = $php_func($base64, $orgin);
+    echo "recode:$recode \n";
+    echo "plain: $orgin\n";
+}
+
+//test
+function test_php_SM2FormatConvert(){
+    $php_func = 'php_SM2FormatConvert';
+    echo "--------$php_func--------\n";
+    //hex编码的DER密文
+    $data =
+        "308198021F5A9D5395EE7A52463E07727CAEA3001A3D95ADF105992B3F8430C0B63D5272022011BC87B586EA976FF2A8009393FE3F71FEBD11FD249F59796054DB66B4789C6D04201D3FAEF883C8D839DDF36FC083B125DE65D8E58B3AACEB97CEBCF529A8F0C2A7043119C9E04B8DB90E6CC0898A85665DA1FA990B4DB6197AE55674D68C3AB5328D408D0B7EBAE99ED6C8243FED2A18C024545A";
+    //先解码再转der格式(如果是base64编码,则用base64解码)
+    $php_HextoAsc = 'php_HextoAsc';
+    $recode = $php_HextoAsc($data, $dataAsc);
+    $recode = $php_func(101,$dataAsc, $c1c3c2);
+    echo "recode:$recode \n";
+    echo "c1c3c2: ".string2hex($c1c3c2)." len:".strlen($c1c3c2)." \n";
+}
+
+//test SM4CBCCrypt
+function test_php_SM4CBCCrypt(){
+    $php_func = 'php_SM4CBCCrypt';
+    echo "--------$php_func--------\n";
+    $data = "this is a test! 这是个测试!";
+    $plainkey = "1234567890123456";//如果是hex编码,务必解码
+
+    //接口是密文key,将明文key加密后再传入php_SM4CBCCrypt进行数据加密
+    //不必要每次都加密key,建议手工加密一次,将key密文保存使用,key明文保存至安全的地方
+    //若是会话级别的key则自行定策略
+    $php_CryptKey = 'php_CryptKey';
+    $recode = $php_CryptKey(0, $plainkey,$key);
+    echo "recode:$recode \n";
+
+    //打印key密文
+    $php_hex = 'php_AsctoHex';
+    $recode = $php_hex($key, $hex);
+    echo "recode:$recode \n";
+    echo "hex: $hex len:".strlen($hex)." \n";
+
+    $iv = "1234567812345678";
+    //加密
+    $recode = $php_func(0,$data,$redata,$key,$iv);
+    echo "recode:$recode \n";
+    echo "redata: ".string2hex($redata)." len:".strlen($redata)." \n";
+    //解密
+    $recode = $php_func(1,$redata,$dedata,$key,$iv);
+    echo "recode:$recode \n";
+    echo "plain: ".$dedata." \n";
+}
+
+function run_test(){
+    //先初始化接口,初始化成功后,可重复调用加解密接口
+    test_php_crypto_init();
+
+    test_php_SM4Crypt1();
+    echo "\n";
+    test_php_SM4Crypt2();
+    echo "\n";
+    test_php_CryptFile();
+    echo "\n";
+    test_php_CryptKey();
+    echo "\n";
+    test_php_SM3Crypt();
+    echo "\n";
+    test_php_MACCrypt();
+    echo "\n";
+    test_php_CryptLmkMac();
+    echo "\n";
+    test_php_SM2SignAndSM2Verify();
+    echo "\n";
+    test_php_SM2SignHashAndSM2VerifyHash();
+    echo "\n";
+    test_php_SM2EncryptAndSM2Decrypt();
+    echo "\n";
+    test_php_HextoAscAndAsctoHex();
+    echo "\n";
+    test_php_base64_decodeAndbase64_encode();
+    echo "\n";
+    test_php_SM2FormatConvert();
+    echo "\n";
+    test_php_SM4CBCCrypt();
+}
+run_test();
+?>

+ 6 - 0
app/api/controller/user/UserController.php

@@ -60,6 +60,12 @@ class UserController
         $info['commissionCount'] = bcsub($info['brokerage_price'], $info['broken_commission'], 2);
         if ($info['commissionCount'] < 0)
             $info['commissionCount'] = 0;
+        $uids = User::where('spread_uid', $request->uid())->column('uid');
+        $info['pay_price'] = StoreOrder::where('uid', 'in', $uids)
+            ->where('paid', 1)
+            ->where('is_participate', 0)
+            ->sum('pay_price');
+
         return app('json')->success($info);
     }
 

+ 18 - 1
app/api/controller/user/UserPartakeController.php

@@ -2,6 +2,7 @@
 
 namespace app\api\controller\user;
 
+use app\admin\model\order\StoreOrder;
 use app\models\system\SystemGroupData;
 use app\models\user\Out;
 use app\models\user\User;
@@ -89,7 +90,7 @@ class UserPartakeController
         ]);
 
         $data = UserPartake::alias('a')
-            ->field('a.*,c.name')
+            ->field('a.*,c.name,c.number')
             ->order('a.id DESC')
             ->leftJoin('out c', 'c.id = a.out_id')
             ->where('uid', $request->uid())
@@ -105,5 +106,21 @@ class UserPartakeController
 
     }
 
+    public function user_push_list(Request $request)
+    {
+
+        $where = UtilService::getMore([
+            ['page', 1],
+            ['limit', 20],
+            ['uid'],
+            ['spread_uid']
+
+        ]);
+        $where['spread_uid'] = $request->uid();
+
+        $data = StoreOrder::list($where);
+        return app('json')->success($data);
+    }
+
 
 }

+ 12 - 4
app/models/user/UserPartake.php

@@ -4,6 +4,8 @@
 namespace app\models\user;
 
 
+use app\admin\model\order\StoreOrder;
+use app\admin\model\user\User;
 use think\Model;
 
 class UserPartake extends Model
@@ -24,13 +26,19 @@ class UserPartake extends Model
         foreach ($user as $item){
             $partake = UserPartake::where('uid', $item['uid'])->where('status', 0)->find();
             if ($partake){
+                $uids = User::where('spread_uid', $item['uid'])->column('uid');
+                $money = StoreOrder::where('uid', 'in', $uids)
+                    ->where('paid', 1)
+                    ->where('is_participate', 0)
+                    ->sum('pay_price');
                 $out = Out::where('id', $partake['out_id'])->find();
-                if ($item['pay_price'] >= $out['number']){
-                    User::where('uid', $item['uid'])->dec('pay_price', $out['number'])->update();
-                    User::where('uid', $item['uid'])->inc('use_price', $out['number'])->update();
+                if ($money >= $out['number']){
+                    User::where('uid', $item['uid'])->dec('pay_price', $money)->update();
+                    User::where('uid', $item['uid'])->inc('use_price', $money)->update();
                     $partake['status'] = 1;
-                    $partake['money'] = $out['number'];
+                    $partake['money'] = $money;
                     $partake->save();
+                    StoreOrder::where('uid', 'in', $uids)->where('paid', 1)->where('is_participate', 0)->update(['is_participate' => 1]);
                 }
             }
         }

+ 1 - 0
route/api/route.php

@@ -171,6 +171,7 @@ Route::group(function () {
     Route::get('partake/out/:id', 'user.UserPartakeController/out_detail')->name('outList');//出局奖励列表
     Route::post('partake/participate_in', 'user.UserPartakeController/participate_in')->name('participate_in');//参与
     Route::get('partake/partake', 'user.UserPartakeController/partake')->name('partake');//参与记录
+    Route::get('partake/user_push_list', 'user.UserPartakeController/user_push_list')->name('user_push_list');//下级消费记录
 })->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true);
 //未授权接口
 Route::group(function () {