正在显示
10 个修改的文件
包含
337 行增加
和
17 行删除
@@ -35,7 +35,7 @@ class Line extends Backend | @@ -35,7 +35,7 @@ class Line extends Backend | ||
35 | /** | 35 | /** |
36 | * 查看 | 36 | * 查看 |
37 | */ | 37 | */ |
38 | - public function index() | 38 | + public function offline($ids) |
39 | { | 39 | { |
40 | //当前是否为关联查询 | 40 | //当前是否为关联查询 |
41 | $this->relationSearch = true; | 41 | $this->relationSearch = true; |
@@ -49,11 +49,10 @@ class Line extends Backend | @@ -49,11 +49,10 @@ class Line extends Backend | ||
49 | return $this->selectpage(); | 49 | return $this->selectpage(); |
50 | } | 50 | } |
51 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 51 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
52 | - $uid = $this->request->param('ids'); | ||
53 | $total = $this->model | 52 | $total = $this->model |
54 | ->with(['user']) | 53 | ->with(['user']) |
55 | ->where($where) | 54 | ->where($where) |
56 | - ->where('uid',$uid) | 55 | + ->where('uid',$ids) |
57 | ->group('off_uid') | 56 | ->group('off_uid') |
58 | ->order($sort, $order) | 57 | ->order($sort, $order) |
59 | ->count(); | 58 | ->count(); |
@@ -62,7 +61,7 @@ class Line extends Backend | @@ -62,7 +61,7 @@ class Line extends Backend | ||
62 | ->with(['user']) | 61 | ->with(['user']) |
63 | ->field('sum(s_score) as score') | 62 | ->field('sum(s_score) as score') |
64 | ->where($where) | 63 | ->where($where) |
65 | - ->where('uid',$uid) | 64 | + ->where('uid',$ids) |
66 | ->group('off_uid') | 65 | ->group('off_uid') |
67 | ->order($sort, $order) | 66 | ->order($sort, $order) |
68 | ->limit($offset, $limit) | 67 | ->limit($offset, $limit) |
@@ -77,6 +76,7 @@ class Line extends Backend | @@ -77,6 +76,7 @@ class Line extends Backend | ||
77 | 76 | ||
78 | return json($result); | 77 | return json($result); |
79 | } | 78 | } |
79 | + $this->assignconfig("uid",$ids); | ||
80 | return $this->view->fetch(); | 80 | return $this->view->fetch(); |
81 | } | 81 | } |
82 | } | 82 | } |
application/api/certs/apiclient_cert.p12
0 → 100644
不能预览此文件类型
application/api/certs/apiclient_cert.pem
0 → 100644
1 | +-----BEGIN CERTIFICATE----- | ||
2 | +MIIEczCCA9ygAwIBAgIEAjpYmTANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC | ||
3 | +Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | ||
4 | +BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | ||
5 | +MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xODA5MjMwODU5MDda | ||
6 | +Fw0yODA5MjAwODU5MDdaMIGiMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk | ||
7 | +b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE | ||
8 | +CxMFTU1QYXkxNjA0BgNVBAMULeW5v+ilv+Wwj+e6uOearuWGjeeUn+i1hOa6kOWb | ||
9 | +nuaUtuaciemZkOWFrOWPuDESMBAGA1UEBBMJMTAyNDc0NTU3MIIBIjANBgkqhkiG | ||
10 | +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtCiZ9NGAYBPhCIO0I1aHTNCEYCpi0qkBxiqg | ||
11 | +T4lvw/miU/kWCZz+F2H1Wv74xStMv+hFV8H0zZUO9t1Jw6Irj3BxsjoKKUDmhMFX | ||
12 | +ftyu29FEXJHH4qBdcQW8WBhXjo8vUy6BAWWBg4UA3f5FqVSE80vks2Q3qkMLJLUV | ||
13 | +7VTGuReaGB0LrXsOPP5Q4SjxGxy0WcAz6nNMncgVcJUSuAp+gHMKOpE3O48nQxbn | ||
14 | +QNrk6PjHv43SdvqxvqWjLJKnp9BKKnokTD/oinyTzEDGmgOadwA9DFARNyLod59W | ||
15 | +etduk6Idzmb644RU7g9nbMSZ7P+nrFQyBmF/mKAvAotqa8u9DwIDAQABo4IBRjCC | ||
16 | +AUIwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdIkNFUy1DQSBHZW5lcmF0ZSBD | ||
17 | +ZXJ0aWZpY2F0ZSIwHQYDVR0OBBYEFGzGoejfxesthx8ecNlEyhr4fWHyMIG/BgNV | ||
18 | +HSMEgbcwgbSAFD4FJvYiYrQVW4jNZH6w1GKn5YZ0oYGQpIGNMIGKMQswCQYDVQQG | ||
19 | +EwJDTjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4G | ||
20 | +A1UEChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENB | ||
21 | +MR8wHQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50ggkAu1SXK7wA6FcwDgYD | ||
22 | +VR0PAQH/BAQDAgbAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEB | ||
23 | +BQUAA4GBAJSHb7HeBv+XlhnvxnVCmeWePrasFcUtPp/yE6yGqm6MIUGKgeuZkI0U | ||
24 | +gqKZrBi4oJc+2COIYwb0F4NgACql5vAxd4Szpbe6Vq7RLVrjcxP/FIqQD/kXHcnM | ||
25 | +HTsdbX4uLIUUCxO2+YA+LmKEAK9jCI0z4sf1pKICDKMQFJjTWEyw | ||
26 | +-----END CERTIFICATE----- |
application/api/certs/apiclient_key.pem
0 → 100644
1 | +-----BEGIN PRIVATE KEY----- | ||
2 | +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC0KJn00YBgE+EI | ||
3 | +g7QjVodM0IRgKmLSqQHGKqBPiW/D+aJT+RYJnP4XYfVa/vjFK0y/6EVXwfTNlQ72 | ||
4 | +3UnDoiuPcHGyOgopQOaEwVd+3K7b0URckcfioF1xBbxYGFeOjy9TLoEBZYGDhQDd | ||
5 | +/kWpVITzS+SzZDeqQwsktRXtVMa5F5oYHQutew48/lDhKPEbHLRZwDPqc0ydyBVw | ||
6 | +lRK4Cn6Acwo6kTc7jydDFudA2uTo+Me/jdJ2+rG+paMskqen0EoqeiRMP+iKfJPM | ||
7 | +QMaaA5p3AD0MUBE3Iuh3n1Z6126Toh3OZvrjhFTuD2dsxJns/6esVDIGYX+YoC8C | ||
8 | +i2pry70PAgMBAAECggEAL7PkeA+VB1ucJU4CP60krDE2K+RtQExh3N/ijMzeXCzY | ||
9 | +T5XPwQHhwb09YzfKFSMO8m2FFuSTdm/2g2U6p+Nj11o1sLRvhlbZ8uLi0QOMBUZW | ||
10 | +7I/pNleyBkA3i7f+TxAYvtS8ces3rORlw2IVfe2UOnuo9dseZiXUaIbOZIYjDFUC | ||
11 | +o/L3lrVK9NyPazYxqu2Re9XX4Qb0xeUdwUfeRYd+5XD2HnauqHELBvgJToYLydoS | ||
12 | +6dpAYX6GPKraoKV0NNmcZ9DTygWKyCVct0RAIebQv9PSFo2drC1WBOJuJBjIuAcM | ||
13 | +/uyUjkzRaX0h1fOIZx0tNk9x/ft9MuckHPM+meDumQKBgQDiaQGRsdo7aS6Tvp+N | ||
14 | +BY2yT0f8TIpaWPu2N/BCdVdPXUG8tuXI3lM+9M47MiA4J84hzHSJaI+iFBSaUamn | ||
15 | +m91v9kwpjF6Z6m8kzuoCBiJlSmLb+zEM7GXmh38VKzEXDqPyIDKKHIUPo8sGiKW+ | ||
16 | +dDKPw1iERDLTnoc8DrGw59uYnQKBgQDLtCiRm0B+pbtYwycck7uzsv9Ll/eVcsEE | ||
17 | +iCaJ7fcN148EYUUP0EsJXa89+x4wxq+hc4CFFoTLI1vNoZh0KLf8c+v0AoboISY/ | ||
18 | +0Q1tZyajWeWBXovuW6jHbSWQzfYzKEqlrxijx0lkNPEUxFpdF61MBgGemfW9Pw9y | ||
19 | +vL6hhqjOmwKBgGkmhYEJzaXL+sLJREZ1btKCOZd2YMcHDpgZMK9c2djVIeOoOd3p | ||
20 | +S1Yw0dryM76A1h4iW3k5o4ONuefVx2o9XEFUbRjaxVDMbSP2KP4ZpT3Pp0wtRCGR | ||
21 | +ZN4EzcOiFKF1vjSEOZSlHDMgSflV20wxoQ3dlq2PEt/vfzUoSeQ0OmuNAoGBAIt3 | ||
22 | +T4dRajjLs5c0FeUk6JBB7zSMWUCDDs/Rf8FToaBig1KWXjhTfextrfuboLH4dmrt | ||
23 | +r4JvRn/mN4Z0KvLspfs8SsIHsOHhQFTVBoJu6y9P7yhB2UBalRXlDqEzwmqIHYOO | ||
24 | +fCo12XO4I476WHwAJ/Ay9IzoEC1/rU37F/FzRsQdAoGADH4rQb/rSo9ZjZxb5fu2 | ||
25 | +z1I6jEw7vFMtWToZsOdF3nnVhNn5a5Lojj7HzCoeKSCTW9wsCoCBIUwVnStRZpqE | ||
26 | +BdtwWs53uq1ERThKXmkVEgUgD8FL8PT/khSL8N44KeuB3MJ5uL4fKhRQDV3LeqxC | ||
27 | +Cd58ve4U1mn+QVokNnguEM0= | ||
28 | +-----END PRIVATE KEY----- |
application/api/controller/Paybank.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\controller; | ||
4 | + | ||
5 | +use app\common\controller\Api; | ||
6 | +use addons\epay\library\Service; | ||
7 | +use app\admin\model\Porder; | ||
8 | +use think\Db; | ||
9 | +use Yansongda\Pay\Pay; | ||
10 | +use app\admin\model\Account; | ||
11 | +use app\admin\model\User; | ||
12 | +use app\admin\model\Message; | ||
13 | +use app\admin\model\Car; | ||
14 | +use app\admin\model\Product; | ||
15 | +use think\Log; | ||
16 | +use fast\Http; | ||
17 | +use think\Validate; | ||
18 | +use Exception; | ||
19 | +/** | ||
20 | + * 企业付款接口** | ||
21 | + */ | ||
22 | +class Paybank extends Api | ||
23 | +{ | ||
24 | + protected $noNeedLogin = '*'; | ||
25 | + protected $noNeedRight = '*'; | ||
26 | + protected $user_id = '';//token存贮user_id | ||
27 | + protected $KEY = 'cccccccccccccccccccccccccccccc00'; //商户秘钥 | ||
28 | + private $params; | ||
29 | + public function _initialize() | ||
30 | + { | ||
31 | + parent::_initialize(); | ||
32 | + $this->user_id = $this->auth->getUserId(); | ||
33 | + } | ||
34 | + //获取公钥 | ||
35 | + public function getPuyKey(){ | ||
36 | + $this->params = [ | ||
37 | + 'mch_id' => '1515355581',//商户ID | ||
38 | + 'nonce_str' => md5(time()), | ||
39 | + 'sign_type' => 'MD5', | ||
40 | + ]; | ||
41 | + //将数据发送到接口地址 | ||
42 | + $res = $this->send("https://fraud.mch.weixin.qq.com/risk/getpublickey"); | ||
43 | + var_dump($res);exit; | ||
44 | + } | ||
45 | + | ||
46 | +// public function payBank(){ | ||
47 | +// if($this->request->isPost()){ | ||
48 | +// $rsa = new Rsa(file_get_contents(url('/addons/epay/certs/apiclient_cert.pem','','',true)), ''); | ||
49 | +// $data = [ | ||
50 | +// 'enc_bank_no' => $rsa->public_encrypt('1234342343234234'),//收款方银行卡号RSA加密 | ||
51 | +// 'enc_true_name' => $rsa->public_encrypt('李明'),//收款方姓名RSA加密 | ||
52 | +// 'bank_code' => '1002',//收款方开户行 | ||
53 | +// 'amount' => '1',//付款金额 | ||
54 | +// ]; | ||
55 | +// $res = $this->bankPay($data); | ||
56 | +// var_dump($res);exit; | ||
57 | +// }else{ | ||
58 | +// $this->error('请求方式错误'); | ||
59 | +// } | ||
60 | +// } | ||
61 | +// | ||
62 | +// private function bankPay($data){ | ||
63 | +// //构建原始数据 | ||
64 | +// $this->params = [ | ||
65 | +// 'mch_id' => '1515355581',//商户号 | ||
66 | +// 'partner_trade_no' => $this->auth->genPayOrderSn(),//商户付款单号 | ||
67 | +// 'nonce_str' => md5(time()), //随机串 | ||
68 | +// 'enc_bank_no' => $data['enc_bank_no'],//收款方银行卡号RSA加密 | ||
69 | +// 'enc_true_name' => $data['enc_true_name'],//收款方姓名RSA加密 | ||
70 | +// 'bank_code' => $data['bank_code'],//收款方开户行 | ||
71 | +// 'amount' => $data['amount'],//付款金额 | ||
72 | +// ]; | ||
73 | +// //将数据发送到接口地址 | ||
74 | +// return $this->send('https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank'); | ||
75 | +// } | ||
76 | + | ||
77 | + public function send($url){ | ||
78 | + $res = $this->sign(); | ||
79 | + $xml = $this->ArrToXml($res); | ||
80 | + $returnData = $this->postData($url, $xml); | ||
81 | + var_dump($returnData);exit; | ||
82 | + return $this->XmlToArr($returnData); | ||
83 | + } | ||
84 | + public function sign(){ | ||
85 | + return $this->setSign($this->params); | ||
86 | + } | ||
87 | + //数组转xml | ||
88 | + public function ArrToXml($arr) | ||
89 | + { | ||
90 | + if(!is_array($arr) || count($arr) == 0) return ''; | ||
91 | + | ||
92 | + $xml = "<xml>"; | ||
93 | + foreach ($arr as $key=>$val) | ||
94 | + { | ||
95 | + if (is_numeric($val)){ | ||
96 | + $xml.="<".$key.">".$val."</".$key.">"; | ||
97 | + }else{ | ||
98 | + $xml.="<".$key."><![CDATA[".$val."]]></".$key.">"; | ||
99 | + } | ||
100 | + } | ||
101 | + $xml.="</xml>"; | ||
102 | + return $xml; | ||
103 | + } | ||
104 | + /** | ||
105 | + * 获取签名 | ||
106 | + * @param array $arr | ||
107 | + * @return string | ||
108 | + */ | ||
109 | + public function getSign($arr){ | ||
110 | + //去除空值 | ||
111 | + $arr = array_filter($arr); | ||
112 | + if(isset($arr['sign'])){ | ||
113 | + unset($arr['sign']); | ||
114 | + } | ||
115 | + //按照键名字典排序 | ||
116 | + ksort($arr); | ||
117 | + //生成url格式的字符串 | ||
118 | + $str = $this->arrToUrl($arr) . '&key=' .$this->KEY; | ||
119 | + return strtoupper(md5($str)); | ||
120 | + } | ||
121 | + /** | ||
122 | + * 获取带签名的数组 | ||
123 | + * @param array $arr | ||
124 | + * @return array | ||
125 | + */ | ||
126 | + public function setSign($arr){ | ||
127 | + $arr['sign'] = $this->getSign($arr); | ||
128 | + return $arr; | ||
129 | + } | ||
130 | + /** | ||
131 | + * 数组转URL格式的字符串 | ||
132 | + * @param array $arr | ||
133 | + * @return string | ||
134 | + */ | ||
135 | + public function arrToUrl($arr){ | ||
136 | + return urldecode(http_build_query($arr)); | ||
137 | + } | ||
138 | + | ||
139 | + //Xml转数组 | ||
140 | + public function XmlToArr($xml){ | ||
141 | + if($xml == '') return ''; | ||
142 | + libxml_disable_entity_loader(true); | ||
143 | + $arr = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); | ||
144 | + return $arr; | ||
145 | + } | ||
146 | + //发送数据 | ||
147 | + public function postData($url,$postfields){ | ||
148 | + | ||
149 | + $ch = curl_init(); | ||
150 | + $params[CURLOPT_URL] = $url; //请求url地址 | ||
151 | + $params[CURLOPT_HEADER] = false; //是否返回响应头信息 | ||
152 | + $params[CURLOPT_RETURNTRANSFER] = true; //是否将结果返回 | ||
153 | + $params[CURLOPT_FOLLOWLOCATION] = true; //是否重定向 | ||
154 | + $params[CURLOPT_POST] = true; | ||
155 | + $params[CURLOPT_POSTFIELDS] = $postfields; | ||
156 | + $params[CURLOPT_SSL_VERIFYPEER] = false; | ||
157 | + $params[CURLOPT_SSL_VERIFYHOST] = false; | ||
158 | + //以下是证书相关代码 | ||
159 | + $params[CURLOPT_SSLCERTTYPE] = 'PEM'; | ||
160 | + $params[CURLOPT_SSLCERT] = '../certs/apiclient_cert.pem'; | ||
161 | + $params[CURLOPT_SSLKEYTYPE] = 'PEM'; | ||
162 | + $params[CURLOPT_SSLKEY] = '../certs/apiclient_key.pem'; | ||
163 | + | ||
164 | + curl_setopt_array($ch, $params); //传入curl参数 | ||
165 | + $content = curl_exec($ch); //执行 | ||
166 | + curl_close($ch); //关闭连接 | ||
167 | + return $content; | ||
168 | + } | ||
169 | +} |
application/api/controller/Rsa.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\controller; | ||
4 | + | ||
5 | +class RSA{ | ||
6 | + | ||
7 | + private $public_key_resource = ''; //公钥资源 | ||
8 | + private $private_key_resource = ''; //私钥资源 | ||
9 | + /** | ||
10 | + * 构造函数 | ||
11 | + * @param [string] $public_key [公钥数据字符串] | ||
12 | + * @param [string] $private_key [私钥数据字符串] | ||
13 | + */ | ||
14 | + public function __construct($public_key,$private_key) { | ||
15 | + $this->public_key_resource = !empty($public_key) ? openssl_pkey_get_public($this->get_public_key($public_key)) : false; | ||
16 | + $this->private_key_resource = !empty($private_key) ? openssl_pkey_get_private($this->get_private_key($private_key)) : false; | ||
17 | + } | ||
18 | + | ||
19 | + /** | ||
20 | + 获取私有key字符串 重新格式化 为保证任何key都可以识别 | ||
21 | + */ | ||
22 | + public function get_private_key($private_key){ | ||
23 | + $search = [ | ||
24 | + "-----BEGIN RSA PRIVATE KEY-----", | ||
25 | + "-----END RSA PRIVATE KEY-----", | ||
26 | + "\n", | ||
27 | + "\r", | ||
28 | + "\r\n" | ||
29 | + ]; | ||
30 | + | ||
31 | + $private_key=str_replace($search,"",$private_key); | ||
32 | + return $search[0] . PHP_EOL . wordwrap($private_key, 64, "\n", true) . PHP_EOL . $search[1]; | ||
33 | + } | ||
34 | + | ||
35 | + | ||
36 | + /** | ||
37 | + | ||
38 | + 获取公共key字符串 重新格式化 为保证任何key都可以识别 | ||
39 | + */ | ||
40 | + | ||
41 | + public function get_public_key($public_key){ | ||
42 | + $search = [ | ||
43 | + "-----BEGIN PUBLIC KEY-----", | ||
44 | + "-----END PUBLIC KEY-----", | ||
45 | + "\n", | ||
46 | + "\r", | ||
47 | + "\r\n" | ||
48 | + ]; | ||
49 | + $public_key=str_replace($search,"",$public_key); | ||
50 | + return $search[0] . PHP_EOL . wordwrap($public_key, 64, "\n", true) . PHP_EOL . $search[1]; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * 生成一对公私钥 成功返回 公私钥数组 失败 返回 false | ||
55 | + */ | ||
56 | + public function create_key() { | ||
57 | + $res = openssl_pkey_new(); | ||
58 | + if($res == false) return false; | ||
59 | + openssl_pkey_export($res, $private_key); | ||
60 | + $public_key = openssl_pkey_get_details($res); | ||
61 | + return array('public_key'=>$public_key["key"],'private_key'=>$private_key); | ||
62 | + } | ||
63 | + /** | ||
64 | + * 用私钥加密 | ||
65 | + */ | ||
66 | + public function private_encrypt($input) { | ||
67 | + openssl_private_encrypt($input,$output,$this->private_key_resource); | ||
68 | + return base64_encode($output); | ||
69 | + } | ||
70 | + /** | ||
71 | + * 解密 私钥加密后的密文 | ||
72 | + */ | ||
73 | + public function public_decrypt($input) { | ||
74 | + openssl_public_decrypt(base64_decode($input),$output,$this->public_key_resource); | ||
75 | + return $output; | ||
76 | + } | ||
77 | + /** | ||
78 | + * 用公钥加密 | ||
79 | + */ | ||
80 | + public function public_encrypt($input) { | ||
81 | + openssl_public_encrypt($input,$output,$this->public_key_resource,OPENSSL_PKCS1_OAEP_PADDING); | ||
82 | + return base64_encode($output); | ||
83 | + } | ||
84 | + /** | ||
85 | + * 解密 公钥加密后的密文 | ||
86 | + */ | ||
87 | + public function private_decrypt($input) { | ||
88 | + openssl_private_decrypt(base64_decode($input),$output,$this->private_key_resource,OPENSSL_PKCS1_OAEP_PADDING); | ||
89 | + return $output; | ||
90 | + } | ||
91 | +} |
@@ -75,11 +75,10 @@ class Wxpay extends Api | @@ -75,11 +75,10 @@ class Wxpay extends Api | ||
75 | $order = [ | 75 | $order = [ |
76 | 'out_trade_no' => $pay_order_sn,//支付订单号 | 76 | 'out_trade_no' => $pay_order_sn,//支付订单号 |
77 | 'body' => '广西小纸皮再生资源回收有限公司', | 77 | 'body' => '广西小纸皮再生资源回收有限公司', |
78 | -// 'total_fee' => 1, | ||
79 | - 'total_fee' => floatval($total_price)*100,//单位:分 | 78 | + 'total_fee' => 1, |
79 | +// 'total_fee' => floatval($total_price)*100,//单位:分 | ||
80 | 'openid' => $openid, | 80 | 'openid' => $openid, |
81 | 'notify_url' => url('api/Wxpay/notify','','',true), | 81 | 'notify_url' => url('api/Wxpay/notify','','',true), |
82 | - 'return_url' => url('api/Wxpay/notify','','',true), | ||
83 | ]; | 82 | ]; |
84 | //跳转或输出 | 83 | //跳转或输出 |
85 | $this->success('成功',$pay->miniapp($order)); | 84 | $this->success('成功',$pay->miniapp($order)); |
@@ -137,7 +136,7 @@ class Wxpay extends Api | @@ -137,7 +136,7 @@ class Wxpay extends Api | ||
137 | $porderModel = new Porder(); | 136 | $porderModel = new Porder(); |
138 | $porderModel->where(['pay_order_sn'=>$data['out_trade_no']])->update(['status'=>$this->order_status[1]]); | 137 | $porderModel->where(['pay_order_sn'=>$data['out_trade_no']])->update(['status'=>$this->order_status[1]]); |
139 | //减库存,删相应购物车记录 | 138 | //减库存,删相应购物车记录 |
140 | - $this->handle($data['out_trade_no']); | 139 | + $this->handle($data['out_trade_no'],$data['openid']); |
141 | } | 140 | } |
142 | } catch (Exception $e) { | 141 | } catch (Exception $e) { |
143 | echo "验签失败"; | 142 | echo "验签失败"; |
@@ -204,7 +203,7 @@ class Wxpay extends Api | @@ -204,7 +203,7 @@ class Wxpay extends Api | ||
204 | 203 | ||
205 | //充值记录 | 204 | //充值记录 |
206 | $accountModel = new Account(); | 205 | $accountModel = new Account(); |
207 | - $account = $accountModel::create(['uid' => $user['id'], 'money' => $money]); | 206 | + $account = $accountModel::create(['uid' => $user['id'], 'money' => $money,'partner_trade_no'=>$data['out_trade_no']]); |
208 | 207 | ||
209 | //系统充值消息 | 208 | //系统充值消息 |
210 | $messageModel = new Message(); | 209 | $messageModel = new Message(); |
@@ -249,8 +248,12 @@ class Wxpay extends Api | @@ -249,8 +248,12 @@ class Wxpay extends Api | ||
249 | } | 248 | } |
250 | } | 249 | } |
251 | 250 | ||
252 | - | ||
253 | - public function handle($pay_order_sn){ | 251 | + /** |
252 | + * 支付完成处理库存,购物车 | ||
253 | + * @param $pay_order_sn | ||
254 | + * @param $openid | ||
255 | + */ | ||
256 | + public function handle($pay_order_sn,$openid){ | ||
254 | //查询订单信息的商品id,数量num | 257 | //查询订单信息的商品id,数量num |
255 | $data = Db::table('gc_porder') | 258 | $data = Db::table('gc_porder') |
256 | ->where(['pay_order_sn'=>$pay_order_sn]) | 259 | ->where(['pay_order_sn'=>$pay_order_sn]) |
@@ -264,7 +267,7 @@ class Wxpay extends Api | @@ -264,7 +267,7 @@ class Wxpay extends Api | ||
264 | ->select(); | 267 | ->select(); |
265 | foreach($product as &$p_value){ | 268 | foreach($product as &$p_value){ |
266 | foreach($data as $value){ | 269 | foreach($data as $value){ |
267 | - if($p_value['id'] == $value['p_id']){ | 270 | + if($value['p_id'] == $p_value['id']){ |
268 | $p_value['stock'] = $p_value['stock'] - $value['num']; | 271 | $p_value['stock'] = $p_value['stock'] - $value['num']; |
269 | } | 272 | } |
270 | } | 273 | } |
@@ -274,11 +277,10 @@ class Wxpay extends Api | @@ -274,11 +277,10 @@ class Wxpay extends Api | ||
274 | $productModel->saveAll($product); | 277 | $productModel->saveAll($product); |
275 | 278 | ||
276 | $userModel = new User(); | 279 | $userModel = new User(); |
277 | - $user = $userModel->where(['openid' => $data['openid']])->find(); | 280 | + $user = $userModel->where(['openid' => $openid])->find(); |
278 | 281 | ||
279 | //清理购物车 | 282 | //清理购物车 |
280 | $carModel = new Car(); | 283 | $carModel = new Car(); |
281 | $carModel->whereIn('p_id',$pIds)->where('uid',$user['id'])->delete(); | 284 | $carModel->whereIn('p_id',$pIds)->where('uid',$user['id'])->delete(); |
282 | } | 285 | } |
283 | - | ||
284 | } | 286 | } |
1 | define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | 1 | define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { |
2 | 2 | ||
3 | var Controller = { | 3 | var Controller = { |
4 | - index: function () { | 4 | + offline: function () { |
5 | // 初始化表格参数配置 | 5 | // 初始化表格参数配置 |
6 | Table.api.init({ | 6 | Table.api.init({ |
7 | extend: { | 7 | extend: { |
8 | - index_url: 'off/line/index', | 8 | + index_url: 'off/line/offline', |
9 | // add_url: 'off/line/add', | 9 | // add_url: 'off/line/add', |
10 | // edit_url: 'off/line/edit', | 10 | // edit_url: 'off/line/edit', |
11 | // del_url: 'off/line/del', | 11 | // del_url: 'off/line/del', |
12 | // multi_url: 'off/line/multi', | 12 | // multi_url: 'off/line/multi', |
13 | table: 'off_line', | 13 | table: 'off_line', |
14 | + }, | ||
15 | + queryParams: function (params) { //自定义搜索条件 | ||
16 | + params.ids = Config.uid;//将搜索过滤器和操作方法 都转为JSON字符串 | ||
17 | + return params; | ||
14 | } | 18 | } |
15 | }); | 19 | }); |
16 | 20 |
@@ -44,7 +44,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -44,7 +44,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
44 | {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search}, | 44 | {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search}, |
45 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}}, | 45 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}}, |
46 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons: [ | 46 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons: [ |
47 | - {name: 'log', text: '我的团队', title: '我的团队', icon: 'fa fa-list', classname: 'btn btn-xs btn-success btn-dialog', url: "off/line/index"} | 47 | + {name: 'offline', text: '我的团队', title: '我的团队', icon: 'fa fa-list', classname: 'btn btn-xs btn-success btn-dialog', url: "off/line/offline"} |
48 | ]} | 48 | ]} |
49 | ] | 49 | ] |
50 | ] | 50 | ] |
-
请 注册 或 登录 后发表评论