@@ -0,0 +1,32 @@ | |||
The Yii framework is free software. It is released under the terms of | |||
the following BSD License. | |||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) | |||
All rights reserved. | |||
Redistribution and use in source and binary forms, with or without | |||
modification, are permitted provided that the following conditions | |||
are met: | |||
* Redistributions of source code must retain the above copyright | |||
notice, this list of conditions and the following disclaimer. | |||
* Redistributions in binary form must reproduce the above copyright | |||
notice, this list of conditions and the following disclaimer in | |||
the documentation and/or other materials provided with the | |||
distribution. | |||
* Neither the name of Yii Software LLC nor the names of its | |||
contributors may be used to endorse or promote products derived | |||
from this software without specific prior written permission. | |||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGE. |
@@ -0,0 +1 @@ | |||
AHdn4Rhtts2iuS68 |
@@ -0,0 +1 @@ | |||
VD3pWrda5YjvBMkl |
@@ -0,0 +1,72 @@ | |||
require 'yaml' | |||
require 'fileutils' | |||
domains = { | |||
frontend: 'y2aa-frontend.dev', | |||
backend: 'y2aa-backend.dev' | |||
} | |||
config = { | |||
local: './vagrant/config/vagrant-local.yml', | |||
example: './vagrant/config/vagrant-local.example.yml' | |||
} | |||
# copy config from example if local config not exists | |||
FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local]) | |||
# read config | |||
options = YAML.load_file config[:local] | |||
# check github token | |||
if options['github_token'].nil? || options['github_token'].to_s.length != 40 | |||
puts "You must place REAL GitHub token into configuration:\n/yii2-app-advanced/vagrant/config/vagrant-local.yml" | |||
exit | |||
end | |||
# vagrant configurate | |||
Vagrant.configure(2) do |config| | |||
# select the box | |||
config.vm.box = 'ubuntu/trusty64' | |||
# should we ask about box updates? | |||
config.vm.box_check_update = options['box_check_update'] | |||
config.vm.provider 'virtualbox' do |vb| | |||
# machine cpus count | |||
vb.cpus = options['cpus'] | |||
# machine memory size | |||
vb.memory = options['memory'] | |||
# machine name (for VirtualBox UI) | |||
vb.name = options['machine_name'] | |||
end | |||
# machine name (for vagrant console) | |||
config.vm.define options['machine_name'] | |||
# machine name (for guest machine console) | |||
config.vm.hostname = options['machine_name'] | |||
# network settings | |||
config.vm.network 'private_network', ip: options['ip'] | |||
# sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine) | |||
config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant' | |||
# disable folder '/vagrant' (guest machine) | |||
config.vm.synced_folder '.', '/vagrant', disabled: true | |||
# hosts settings (host machine) | |||
config.vm.provision :hostmanager | |||
config.hostmanager.enabled = true | |||
config.hostmanager.manage_host = true | |||
config.hostmanager.ignore_private_ip = false | |||
config.hostmanager.include_offline = true | |||
config.hostmanager.aliases = domains.values | |||
# provisioners | |||
config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] | |||
config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false | |||
config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' | |||
# post-install message (vagrant console) | |||
config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}" | |||
end |
@@ -0,0 +1,27 @@ | |||
-----BEGIN RSA PRIVATE KEY----- | |||
MIIEogIBAAKCAQEArwuahgHV/vnx5tMyIo+qNZul/DiWtXouicY6fcfuF9y6SIcu | |||
A5hYfAnyAU3dACK44SGWrScv4OaB5fGQOtkomb8cK5Ibc7p9312Tag04+RMqHrl0 | |||
GroLn7qqRodrPulrkmTDrO9xymEhS2RMYSENoDMaBSiXlfnYQQOU9//UTlDAgB/O | |||
1ZqB7VyuYh3pUUtYN2M/E+7d4VDTpFevD9gEDLPRiWpIOoudw/cAFXX+l5f5R8tQ | |||
lFmy8QY+M0+NqbkZ03FsiNCNXhN5ldUGKCmxA89lGhV9m5/ABTbPjuAjOOv934sP | |||
pV73pNUPIG15r5e5tyPzITNeA/SYQHkaP+++bwIDAQABAoIBAFE741Q5WeRgfkCO | |||
1n9viKAkQZ2RbW9+6kYJ9m8U74unZdPu2A3XD4lQ3Dx6tAsyEfZ4rgJhYzjOAI6D | |||
0lldGhhvtlUKEy9b5rpYJOdch4ofuLZVfmpA2NAhwo/EnKKvlLp1hNGmtXokJV1l | |||
iISy4C3uSS8HrYFuV0ukq+eDlDVbQ6m580aGbkz3h2lHWQ9hAI7Zo6FfD+0aR0Gw | |||
yyS/XCXiEZ4ghqgpPdNsi9W40ETXybFDxzhbdhmbxDye5IHtaPJ/yLEUhpndwHOz | |||
euHD42ocr77WTBotqyLGiPiWeJdXHtaNgFVvf0zRUxWtb+P0Aiz6i8zXdoz03v24 | |||
6jBl4SECgYEA3bq+Oj6Hj/NNCnUWhAgY41s+mmDftPn+mLDylfkYmntZ9YQNnEZs | |||
+Gw9QNljXHzFeWg8E07v1njM+xhHcf5EaRJ7BWnVvJ/rC9wSzHIBngxb5KkjS0ZQ | |||
v7rGwgz2+EfGasiM7KoJicCLaJMu6jobp85BuWj18QqMbL/zsLS5CGkCgYEAyhmw | |||
3J7NrobQhnEwYmr//NUN4Re0u0bjWzBVuKHC9PZsMj6uh9I/9g7LyGg5TUM1GANn | |||
gZV0g3UX9w/Cjk4Gnr3keyWI7wZF+GDBjBJRcWhGL1IJsICxUcyJTnHn8hxc7Ka9 | |||
B97eRP+axrJpBS/KkUUljmsgwwt1TRkxU0+4dRcCgYBn9TFRT5XxmQoq+ADJgJ5i | |||
opo0eW0JhhincHccd8DgVSs1YGedOKvIwb7qU8IxT9KqfIOGLgFnFhZNN/HvcV6T | |||
wPVq8Vcj6/qhAdrSfjVh67t99ws0NNCRRDoCK1/zwns1/7eLEqIMMvlp23Aoo3vp | |||
7luEWcDN9bsnFcxksib62QKBgBs4aJzeer+GAvIIrsaiuMXaAFuP8NTEkHzIvtL2 | |||
XqbVxe7iiGlcxSakCYh9mTIx2iXY14kZky7dh5PMOJ0oHzYkR3Datl3TT3tLtOXj | |||
1bpbnBBlkU6Hltp4nQnGx8HRVia9snor524Nq1AV2ZVMQZFdadiLz0bV9T+kJAOf | |||
mi2TAoGAETyFca7A2uzouyxQTLjJ5umZwAd03j8MWwT3u6vau0SU+Dfe3WL+T3KE | |||
rC/E2dUaII4a50LKMaVLYkrXCygKR2U9EWuDspzFd6fJGGPgeJhSNF4bxZhTUDpU | |||
ugy3+m5b2+6Fe59lbuq7tUIiVVmRPmwBZ/QnfvSmsQlkr55xvh8= | |||
-----END RSA PRIVATE KEY----- |
@@ -0,0 +1,90 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIFhzCCBG+gAwIBAgIQLIW51UR3rinQBHTR5BuY3DANBgkqhkiG9w0BAQsFADBE | |||
MQswCQYDVQQGEwJDTjEaMBgGA1UECgwRV29TaWduIENBIExpbWl0ZWQxGTAXBgNV | |||
BAMMEFdvU2lnbiBEViBTU0wgQ0EwHhcNMTcxMjExMDkzMTQ5WhcNMTgxMjExMDkz | |||
MTQ5WjAqMQswCQYDVQQGEwJDTjEbMBkGA1UEAwwSKi56aGl6aHVjaHV4aW5nLmNu | |||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArwuahgHV/vnx5tMyIo+q | |||
NZul/DiWtXouicY6fcfuF9y6SIcuA5hYfAnyAU3dACK44SGWrScv4OaB5fGQOtko | |||
mb8cK5Ibc7p9312Tag04+RMqHrl0GroLn7qqRodrPulrkmTDrO9xymEhS2RMYSEN | |||
oDMaBSiXlfnYQQOU9//UTlDAgB/O1ZqB7VyuYh3pUUtYN2M/E+7d4VDTpFevD9gE | |||
DLPRiWpIOoudw/cAFXX+l5f5R8tQlFmy8QY+M0+NqbkZ03FsiNCNXhN5ldUGKCmx | |||
A89lGhV9m5/ABTbPjuAjOOv934sPpV73pNUPIG15r5e5tyPzITNeA/SYQHkaP+++ | |||
bwIDAQABo4ICjTCCAokwDAYDVR0TAQH/BAIwADA8BgNVHR8ENTAzMDGgL6Athito | |||
dHRwOi8vd29zaWduLmNybC5jZXJ0dW0ucGwvd29zaWduLWR2Y2EuY3JsMHcGCCsG | |||
AQUFBwEBBGswaTAuBggrBgEFBQcwAYYiaHR0cDovL3dvc2lnbi1kdmNhLm9jc3At | |||
Y2VydHVtLmNvbTA3BggrBgEFBQcwAoYraHR0cDovL3JlcG9zaXRvcnkuY2VydHVt | |||
LnBsL3dvc2lnbi1kdmNhLmNlcjAfBgNVHSMEGDAWgBTKm40uRFBCitkCZTIanoDz | |||
iAQqtTAdBgNVHQ4EFgQUoPY4TlW2/R9W/EH9n+reZFhVfj8wDgYDVR0PAQH/BAQD | |||
AgWgMIIBIAYDVR0gBIIBFzCCARMwCAYGZ4EMAQIBMIIBBQYMKoRoAYb2dwIFAQ8D | |||
MIH0MIHxBggrBgEFBQcCAjCB5DAfFhhBc3NlY28gRGF0YSBTeXN0ZW1zIFMuQS4w | |||
AwIBARqBwFVzYWdlIG9mIHRoaXMgY2VydGlmaWNhdGUgaXMgc3RyaWN0bHkgc3Vi | |||
amVjdGVkIHRvIHRoZSBDRVJUVU0gQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0 | |||
ZW1lbnQgKENQUykgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZSBoZXJlaW4gYW5k | |||
IGluIHRoZSByZXBvc2l0b3J5IGF0IGh0dHBzOi8vd3d3LmNlcnR1bS5wbC9yZXBv | |||
c2l0b3J5LjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwLwYDVR0RBCgw | |||
JoISKi56aGl6aHVjaHV4aW5nLmNughB6aGl6aHVjaHV4aW5nLmNuMA0GCSqGSIb3 | |||
DQEBCwUAA4IBAQCsWK6G1oakXw0SoYYnzA89VIlDNqiQckVMEfl89zWqi7h9tgN5 | |||
+yOUAMj2xLog6dSFzblyscn0qSfkllkWG+ySyLMoKg9lU+NM/w3SH8HIdG6ogjoN | |||
VyOyZnDEynM0+Rf8/H8RV9iWTC7/iiFdL2sNBj5XQnvt3yRDqFD+Il3bvECPXGoj | |||
BW0tkx1PsPmnZgmG1E15QkXFlsMmN6sptB1IlRa1JKrvAVgm/KD4L/alcpe0pYu0 | |||
UIuQgIojMtpYPJDU9Y1yu/DNzvAi1Y91Pw5asUlgs4FS8xt0O9cgM9RQnX0BH5Dw | |||
jZlD0cWLOiipT7IDvvGsxRZspQwR7kLpWHD6 | |||
-----END CERTIFICATE----- | |||
-----BEGIN CERTIFICATE----- | |||
MIIEtTCCA52gAwIBAgIRAOIaIRqokeLTVFn/020nxCYwDQYJKoZIhvcNAQELBQAw | |||
fjELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu | |||
QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEiMCAG | |||
A1UEAxMZQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQTAeFw0xNzA1MTgwNzQ2MTRa | |||
Fw0yNzA1MTgwNzQ2MTRaMEQxCzAJBgNVBAYTAkNOMRowGAYDVQQKDBFXb1NpZ24g | |||
Q0EgTGltaXRlZDEZMBcGA1UEAwwQV29TaWduIERWIFNTTCBDQTCCASIwDQYJKoZI | |||
hvcNAQEBBQADggEPADCCAQoCggEBAMhQeIUezKdIBlpnoWm0+HG5nu8859lksQEG | |||
OIeNiayAqhlxG5b4+wVEJ8DmCP77qDOoKVjW5owTIvZHc4F2MEqTOt6/XL3+P6an | |||
bKdPN5/nhKghN+45ywgFYn1AcI5kYdPFQmNfNYGC3jaHISHttC2xz8NQHyHRI3sy | |||
g3hkPdyNeLC+4rTOLs5SYZT+vHr3biOipBO5n68A0Ho86RQ6d0RmBRArAJskD+U/ | |||
Qco3F2pl7T0CDOuCXZ/ld3Ga7Bvb1G/lAbM/cEr6endnaLaHmI+6gYWRZVqOELVi | |||
T9dkYnpspHxtcgsVUl1lFf3GSfWAX/Jvnd3IstCa9E3dmAWm8IUCAwEAAaOCAWYw | |||
ggFiMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFMqbjS5EUEKK2QJlMhqe | |||
gPOIBCq1MB8GA1UdIwQYMBaAFAh2zcsH/yT2xc3tu5C84oQ3RnX3MA4GA1UdDwEB | |||
/wQEAwIBBjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwNQYDVR0fBC4w | |||
LDAqoCigJoYkaHR0cDovL3N1YmNhLmNybC5jZXJ0dW0ucGwvY3RuY2EuY3JsMGsG | |||
CCsGAQUFBwEBBF8wXTAoBggrBgEFBQcwAYYcaHR0cDovL3N1YmNhLm9jc3AtY2Vy | |||
dHVtLmNvbTAxBggrBgEFBQcwAoYlaHR0cDovL3JlcG9zaXRvcnkuY2VydHVtLnBs | |||
L2N0bmNhLmNlcjA5BgNVHSAEMjAwMC4GBFUdIAAwJjAkBggrBgEFBQcCARYYaHR0 | |||
cDovL3d3dy5jZXJ0dW0ucGwvQ1BTMA0GCSqGSIb3DQEBCwUAA4IBAQAAn17fM+SE | |||
dRJdtuP6BtLY4kfJu/xPVpFlTpl1Wq2GlzSOBWEIvqsrvSz141D5mmPZ1hqMIdbn | |||
4uq0sC48tAD3Mi18RLbfitm3o0tjYxsbI27tltVMbvyld/k3JOyj0wVljju9fDHc | |||
yIK6akmE/C6UDLtqvRAx0m7xc5z+YIJRabXi33x4AmV7HTyVs6Lm6AGb+KqaJzDd | |||
X9Qqj24EuP/noicvKYP9g9Uf6aGPB5TWliIoEpJWz6qD/PophMB4nuj3ccO0LMJ+ | |||
k5QFRWs2hZmev1M8hpqBoMwpoG/jy5AOwntqRqRsSkbR+6tZ3aCWKU1hNnkZcfHJ | |||
11ozB0OSfC7K | |||
-----END CERTIFICATE----- | |||
-----BEGIN CERTIFICATE----- | |||
MIIEtDCCA5ygAwIBAgIRAJOShUABZXFflH8oj+/JmygwDQYJKoZIhvcNAQELBQAw | |||
PjELMAkGA1UEBhMCUEwxGzAZBgNVBAoTElVuaXpldG8gU3AuIHogby5vLjESMBAG | |||
A1UEAxMJQ2VydHVtIENBMB4XDTA4MTAyMjEyMDczN1oXDTI3MDYxMDEwNDYzOVow | |||
fjELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu | |||
QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEiMCAG | |||
A1UEAxMZQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQTCCASIwDQYJKoZIhvcNAQEB | |||
BQADggEPADCCAQoCggEBAOP7faNyusLwyRSH9WsBTuFuQAe6bSddf/dbLbNax1Ff | |||
q6QypmGHtm4PhtIwApf412lXoRg5XWpkecYBWaw8MUo4fNIE0kso6CBfOweizE1z | |||
2/OuT8dW1Vqnlon686to1COGWSfPCSe8rG5ygxwwct/gounS4XR1Gb0qnnsVVAQb | |||
10M5rVUoxeIau/TA5K44STPMdoWfOUXSpJ7yEoxR+HzkLX/1rF/rFp+xLdG6zJFC | |||
d0wlyZA4b9vwzPuOHpdZPtVgTuYFKO1JeRNLukjbL/ly0znK/h/YNHL1tEDPMQHD | |||
7N4RLRddH7hQ0V4Zp2neBzMoylCV+adUy1SGUEWp+UkCAwEAAaOCAWswggFnMA8G | |||
A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFAh2zcsH/yT2xc3tu5C84oQ3RnX3MFIG | |||
A1UdIwRLMEmhQqRAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNw | |||
LiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQYIDAQAgMA4GA1UdDwEB/wQEAwIB | |||
BjAsBgNVHR8EJTAjMCGgH6AdhhtodHRwOi8vY3JsLmNlcnR1bS5wbC9jYS5jcmww | |||
aAYIKwYBBQUHAQEEXDBaMCgGCCsGAQUFBzABhhxodHRwOi8vc3ViY2Eub2NzcC1j | |||
ZXJ0dW0uY29tMC4GCCsGAQUFBzAChiJodHRwOi8vcmVwb3NpdG9yeS5jZXJ0dW0u | |||
cGwvY2EuY2VyMDkGA1UdIAQyMDAwLgYEVR0gADAmMCQGCCsGAQUFBwIBFhhodHRw | |||
Oi8vd3d3LmNlcnR1bS5wbC9DUFMwDQYJKoZIhvcNAQELBQADggEBAI3m/UBmo0yc | |||
p6uh2oTdHDAH5tvHLeyDoVbkHTwmoaUJK+h9Yr6ydZTdCPJ/KEHkgGcCToqPwzXQ | |||
1aknKOrS9KsGhkOujOP5iH3g271CgYACEnWy6BdxqyGVMUZCDYgQOdNv7C9C6kBT | |||
Yr/rynieq6LVLgXqM6vp1peUQl4E7Sztapx6lX0FKgV/CF1mrWHUdqx1lpdzY70a | |||
QVkppV4ig8OLWfqaova9ML9yHRyZhpzyhTwd9yaWLy75ArG1qVDoOPqbCl60BMDO | |||
TjksygtbYvBNWFA0meaaLNKQ1wmB1sCqXs7+0vehukvZ1oaOGR+mBkdCcuBWCgAc | |||
eLmNzJkEN0k= | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,9 @@ | |||
# global codeception file to run tests from all apps | |||
include: | |||
- common | |||
- frontend | |||
- backend | |||
paths: | |||
log: console/runtime/logs | |||
settings: | |||
colors: true |
@@ -0,0 +1,99 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WebController.php | |||
* Create By 2017/2/23 14:31 $ | |||
*/ | |||
namespace common\Controller; | |||
use admin\util\AdminUtil; | |||
use Yii; | |||
use yii\web\Controller; | |||
use yii\web\Response; | |||
class AdminController extends Controller | |||
{ | |||
public $service; | |||
/** | |||
* Des:获取get传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _get($key, $val = '') | |||
{ | |||
return Yii::$app->request->get($key, $val); | |||
} | |||
/** | |||
* Des:获取post传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _post($key, $val = '') | |||
{ | |||
return trim(Yii::$app->request->post($key, $val)); | |||
} | |||
/** | |||
* Des:获取所有传参的参数值 | |||
* Name: _request | |||
* @param $key | |||
* @param $val | |||
* @return mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _request($key, $val = '') | |||
{ | |||
return trim(Yii::$app->request->getQueryParam($key, $val)); | |||
} | |||
/** | |||
* Des:访问方法前的参数 | |||
* Name: beforeaction | |||
* @param \yii\base\Action $action | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function beforeaction($action) | |||
{ | |||
/**获取路由地址**/ | |||
$actionName = $action->controller->id . '/' . $action->id; | |||
$unLoginConfig = AdminUtil::getUnLoginConfig(); | |||
if (in_array($actionName, $unLoginConfig) == false) { | |||
//校验用户登录信息 | |||
$checkLogin = AdminUtil::checkLogin(); | |||
if ($checkLogin['flag'] == false) { | |||
Yii::$app->response->format = Response::FORMAT_JSON; | |||
Yii::$app->response->data = $checkLogin; | |||
return false; | |||
} | |||
//校验用户权限 | |||
$authAction = AdminUtil::checkAuthAction($actionName); | |||
if($authAction['flag'] == false) { | |||
Yii::$app->response->format = Response::FORMAT_JSON; | |||
Yii::$app->response->data = $authAction; | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
} |
@@ -0,0 +1,95 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WebController.php | |||
* Create By 2017/2/23 14:31 $ | |||
*/ | |||
namespace common\Controller; | |||
use common\util\Util; | |||
use fx\util\FxUtil; | |||
use Yii; | |||
use yii\web\Controller; | |||
class FxWebController extends Controller | |||
{ | |||
public $service; | |||
/** | |||
* Des:获取get传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _get($key, $val = '') | |||
{ | |||
return Yii::$app->request->get($key, $val); | |||
} | |||
/** | |||
* Des:获取post传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _post($key, $val = '') | |||
{ | |||
return Yii::$app->request->post($key, $val); | |||
} | |||
/** | |||
* Des:获取所有传参的参数值 | |||
* Name: _request | |||
* @param $key | |||
* @param $val | |||
* @return mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _request($key, $val = '') | |||
{ | |||
return Yii::$app->request->getQueryParam($key, $val); | |||
} | |||
/** | |||
* Des:访问方法前的参数 | |||
* Name: beforeaction | |||
* @param \yii\base\Action $action | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function beforeaction($action) | |||
{ | |||
/**获取路由地址**/ | |||
$actionName = $action->controller->id . '/' . $action->id; | |||
$unLoginConfig = FxUtil::getUnLoginConfig(); | |||
$unCheckPhone = require APP_PATH.'/config/unCheckPhone.php'; | |||
//获取非强制登录接口配置信息 | |||
$checkPhone = true; | |||
if(in_array($actionName, $unCheckPhone)) { | |||
$checkPhone = false; | |||
} | |||
if (in_array($actionName, $unLoginConfig) == false) { | |||
$checkLogin = FxUtil::checkLogin($checkPhone); | |||
if ($checkLogin['flag'] == false) { | |||
Yii::$app->response->format = 'json'; | |||
Yii::$app->response->data = $checkLogin; | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WebController.php | |||
* Create By 2017/2/23 14:31 $ | |||
*/ | |||
namespace common\Controller; | |||
use shop\util\ShopUtil; | |||
use Yii; | |||
use yii\web\Controller; | |||
class ShopWebController extends Controller | |||
{ | |||
public $service; | |||
/** | |||
* Des:获取get传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _get($key, $val = '') | |||
{ | |||
return Yii::$app->request->get($key, $val); | |||
} | |||
/** | |||
* Des:获取post传值的参数 | |||
* Name: _get | |||
* @param $key | |||
* @param $val | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _post($key, $val = '') | |||
{ | |||
return Yii::$app->request->post($key, $val); | |||
} | |||
/** | |||
* Des:获取所有传参的参数值 | |||
* Name: _request | |||
* @param $key | |||
* @param $val | |||
* @return mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function _request($key, $val = '') | |||
{ | |||
return Yii::$app->request->getQueryParam($key, $val); | |||
} | |||
} |
@@ -0,0 +1,3 @@ | |||
main-local.php | |||
params-local.php | |||
test-local.php |
@@ -0,0 +1,52 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm payConfig.php | |||
* Create By 2017/3/3 18:21 $ | |||
*/ | |||
return [ | |||
//南京运游通 | |||
'2016102100728544' => [ | |||
'app_id' => "2016102100728544",//应用ID,您的APPID。 | |||
//商户私钥,您的原始格式RSA私钥 | |||
'merchant_private_key' => "MIICXQIBAAKBgQC3Vh2FJi4Yfm7/MrohS3lPyL/jVEMlobvhmekohNid4cQPxzQg4PGFoOqitEcVDjJkDgd3Hs1K12g6cUnNBM0A5FLY46t3UJ5pnV1FxCMTst1vGGElzgnw7jNO/68AL/PUKpqE7kVYHOpBTwX2Ml0hauX/pRUOjTIPGS0VNvSIqwIDAQABAoGAfeNS59+8nTML8o4Zgs05YpB9OpLcfJWe1h2CHUGDIH4qy47Ee6MaFODW3JwfhxS1g0Ci3ae33aElv6OUwoN+Y+nJ0Gi83iV+wA6VOkF2lw9mj6YzAYgSrSSQj2MFm0zXd2IFMhm8cHIQs/IaA5ajUaHz+oPvsedaCEpMlayhHeECQQDdyfXjPTnY0nIKokvswpJj4P9sZpZh1ANOjpZ/pXrIhQm1IV9m9YjIvr1lcLcdSX/oFc9DWUu9nKbJqsmgc4UxAkEA0528I3uzTBcvuxFZbm0F6eSrFLX47RDNWB1YcqD6FWzGl+vMFxkMf0dQ8qsNntp1EZ7WGI1QKjwCtozcBMgkmwJACXcuHFWnm15X6aZFkUQ4lTSsEgdK0cAHqBmjyKzaUaaD5IwZEz7VaKPjV2n5FrHlWJVdtCUie2QtJhw44LUtcQJBAIt2PcKIyI5SDZPUiELdOPN/TzyT/NyHoTz8Aglxi79I88y1isiCKplLL87t6kkRoeud6W0+3GEpMYSLaokAOhcCQQCaMtuM7IMmlOtC6EIRniQzZjGsLhMTRqYtFD3mA3GiIcuShv5+i/qbrFRApJu70TQqPEnIjsqVxwCKVNmROU/8", | |||
'return_url' => "http://alipay/return_url.php", //同步跳转 | |||
'charset' => "UTF-8",//编码格式 | |||
'timeout' => '2m',//未支付超时时间 | |||
'gatewayUrl' => "http://openapi.alipay.com/gateway.do",//支付宝网关 | |||
//支付宝公钥 | |||
'alipay_public_key' => "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIgHnOn7LLILlKETd6BFRJ0GqgS2Y3mn1wMQmyh9zEyWlz5p1zrahRahbXAfCfSqshSNfqOmAQzSHRVjCqjsAw1jyqrXaPdKBmr90DIpIxmIyKXv4GGAkPyJ/6FTFY99uhpiq0qadD/uSzQsefWo0aTvP/65zi3eof7TcZ32oWpwIDAQAB" | |||
], | |||
//蜘蛛分销支付宝 | |||
'2017030306030595' => [ | |||
'app_id' => "2017030306030595",//应用ID,您的APPID。 | |||
//商户私钥,您的原始格式RSA私钥 | |||
'merchant_private_key' => "MIICXgIBAAKBgQDvgdcxY04CAINcdWsDcs5HE0qhaj7PtfOvtlDktihVuguXstQaz29c7nuMPrpabS24q7s0EPCIql3qE/JWHQ3wAy0+rmvrJyS1SygYeiVhWX0QfJEmsVcg5HBXd+cmHanYAjfQrOAg3hw43JWgtogC6EwJPdiBRq1G4hUF9iXQJQIDAQABAoGBAIUXP7+gET8njdeZIAhgiaQRYk1kPtcpouqngzg0ySEqKzr3Esp7LsUTePAsA14wgVG3jGWYbDFlip6Cyw1zQ8RirMv8VpzmH1Y8crqAJhxXcapJxW4ZawI+WVvLfQtsAs+BYKZ3gUejqkFVFDsD8t0TdJ69atYk5LolQfizxKcBAkEA99Ag9MJwKVk6noVSJI1Abyq0c0nsAXDMMW210VdusKhfij9wYwTqEtHE2G0HLRab6AdLUVPDW6FvyG6Kx1rVxQJBAPdrdzd8V6fvWu5BonMdIxyVIKQZBK47pKSlEWKtwRAWmskIgLxMVq/yZQ/qO8MguYZoS7HE3jMQdVWKbw09FuECQQDD4Y0bS1JTLMfMI8ARSmHDPXNTqfvWC64r5/eO2NiS5RRX99tDOdA4Pf2lwVCp0DQ+TP249Ef4dvwf51jlSaStAkAm/qf+dbl2/VFuhaetzuTOx24qjsrfDwVm8aEo1Uu9VmK01oM7qihreJ+W/4rFuS2kUmHDtcxzbd+gSL4x7vPhAkEA8/YHEIto1jBJiOUzBObPrPkzypgaOJAUS8fM1GmulRLxAdfujsdZdKmAmq+d421ONeL/D4HMKGzxTVwYXi2H+Q==", | |||
'return_url' => "http://alipay/return_url.php", //同步跳转 | |||
'charset' => "UTF-8",//编码格式 | |||
'timeout' => '2m',//未支付超时时间 | |||
'gatewayUrl' => "http://openapi.alipay.com/gateway.do",//支付宝网关 | |||
//支付宝公钥 | |||
'alipay_public_key' => 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDvgdcxY04CAINcdWsDcs5HE0qhaj7PtfOvtlDktihVuguXstQaz29c7nuMPrpabS24q7s0EPCIql3qE/JWHQ3wAy0+rmvrJyS1SygYeiVhWX0QfJEmsVcg5HBXd+cmHanYAjfQrOAg3hw43JWgtogC6EwJPdiBRq1G4hUF9iXQJQIDAQAB' | |||
], | |||
//千岛湖支付宝 | |||
'2017032106317613' => [ | |||
'app_id' => "2017032106317613",//应用ID,您的APPID。 | |||
//商户私钥,您的原始格式RSA私钥 | |||
'merchant_private_key' => "MIICXAIBAAKBgQDfCHWdhKOcaTWM9WDanO/3Txy00r6yzkrl9qcE9Z1NhC5HpfEvvT5leUv+7ekpNJfFIj4/N8Z3wjVeE/ydxmmeVYJZOG25rLyLrRZJH1SI6nAISkD05cMa/hiXGgojJkkKhNGt+yH2XfjZl/m5k/Xs5yk123EkVJ0nbzODwJ8o2wIDAQABAoGBAL0CG0JxLIIZuvMI45qAUvAfkDFBQ7CeGGUIAQS37SXK9blsTJfrZVxzTc7t6aEs282JNn02lC/bWoSupW9DvS6G4S48bKzcIFGnIkI48Yj2nmguWUy70cM73QjmLnCHTh9+5CJtsT5kmU3+wKhIypQ2A2jHBEWXr2ltjpnSmjIpAkEA+ZDeVCsqGgB8OzMWYroc7yzwzOx3T4OCjj4tdTmSf6KWtx9UVMZTdDauSaxkanhLsF3wlAQG7xGq8Zwyn4MpvwJBAOTIeXp3UFVfsbFXLXegA25UKnHG2BnCwnGhk1kyRXITyaFF8zicO1PP9Sn1chC9MWgGHWa/J33LdZJyyAEPb+UCQGwKf3XIyg0/sIigcUyEbgpNVmIg7PYLZPXXjS52oimHZeAZPBUHVxG0qndSnpZJRdswj/pEVAwjhfHbQT81NVkCQGfH7Rs5vo5Lz45zzmNCievlcC+WlPbym0PymKXQoSIDieaHlbJrZJo7bqou9iRTvnLCu1mdguuUfOwG92VLvGUCQCFyXsmKMswsxkB8LEuE452UpaLxtQJWki3axgG7FvssF7V7aYr+GwgPXRH6lcHSJqPeAlxdwC2bG1FxTTeJFds=", | |||
'return_url' => "http://alipay/return_url.php", //同步跳转 | |||
'charset' => "UTF-8",//编码格式 | |||
'timeout' => '2m',//未支付超时时间 | |||
'gatewayUrl' => "http://openapi.alipay.com/gateway.do",//支付宝网关 | |||
//支付宝公钥 | |||
'alipay_public_key' => 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB' | |||
] | |||
]; |
@@ -0,0 +1,3 @@ | |||
<?php | |||
Yii::setAlias('@common', dirname(dirname(__DIR__)) . '/common'); | |||
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); |
@@ -0,0 +1,26 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 娄梦宁 | |||
* PhpStorm checkParams.php | |||
* Create By 2017/3/1 9:08 $ | |||
*/ | |||
return array( | |||
'email' => "/^[a-zA-Z0-9_+\\.\\-]{2,}\@(([0-9a-zA-Z\\-]+)[.])+[a-zA-Z]{2,4}$/",//邮箱 | |||
'mobile' => "/^[1][0-9]{10}$/",//手机号码 | |||
'codeMsg' => "/^[a-zA-z0-9]{4}$/",//图形验证码和邮箱验证码 | |||
'memo' => "/^[A-Za-z0-9_\x{4e00}-\x{9fa5}]{1,20}$/u",//备注 | |||
'intVal' => "/^[1-9][0-9]{0,10}$/",//数据库验证id | |||
'id_card'=>"/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/", //身份证验证 | |||
'date'=> "/^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$/", //验证年-月-日 | |||
'fx_user_name' => "/^[A-Za-z0-9_\x{4e00}-\x{9fa5}]{1,100}$/u",//备注 | |||
'money' => '/^\+?(?!0+(\.00?)?$)\d+(\.\d\d?)?$/',//金额正则 | |||
); |
@@ -0,0 +1,7 @@ | |||
<?php | |||
return [ | |||
'charset' => 'utf-8', | |||
'language' => 'zh-CN', | |||
'timeZone' => 'Asia/Shanghai', | |||
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', | |||
]; |
@@ -0,0 +1,7 @@ | |||
<?php | |||
return [ | |||
'adminEmail' => 'admin@example.com', | |||
'supportEmail' => 'support@example.com', | |||
'user.passwordResetTokenExpire' => 3600, | |||
'system' => 1 | |||
]; |
@@ -0,0 +1,25 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/4/5 9:47 $ | |||
*/ | |||
return [ | |||
'fx_authLoginUrl' => '/fx/?r=weChat/we-chat/set-login',//FX 本站点的第三方授权接收地址 | |||
'fx_authLoginRedirectUrl' => '/fx/?r=weChat/we-chat/auth-login',//fx 本站点的第三方授权中间跳转地址 | |||
'shop_authLoginUrl' => '/shop/?r=weChat/we-chat/set-login',//shop 本站点的第三方授权接收地址 | |||
'shop_authLoginRedirectUrl' => '/shop/?r=weChat/we-chat/auth-login',//shop 本站点的第三方授权中间跳转地址 | |||
'authorizeUrl' => 'https://open.weixin.qq.com/connect/oauth2/authorize?',//微信提供的授权登录路径 | |||
'authTokenUrl' => 'https://api.weixin.qq.com/sns/oauth2/access_token?',//微信token获取地址 | |||
'bind_fx_user' => [34, 264, 1, 258, 263, 267, 460, 736, 671, 658, 486, 596], | |||
"wx_home"=>'/web/zzcx/index.html#/main/home'//微信首页地址 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name'=>'小黑鱼出行',//网站头 | |||
'entryAuthWeChat' => 'wx34e2f2b38cfb15a1',//授权登录微信APPID | |||
'aliPay' => '2017030306030595',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://fx.zhizhuchuxing.com/fx/?r=weChat/we-chat/login-redirect',//第三方提供的微信授权登录路径 | |||
'host_name'=> 'http://fx.zhizhuchuxing.cn',//网站域名 | |||
'notify_url' => 'http://nwx.zhizhuchuxing.cn/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://sandbox.zhizhuchuxing.cn',//管理后台地址 | |||
'adm_host1' => 'http://sandbox1.zhizhuchuxing.cn',//管理后台1地址 | |||
'adm_user' => 'newfx',//cs接口使用 用户名 | |||
'adm_user_key' => 'newfx_key',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 581,//cs接口使用 用户ID | |||
'adm_source_id' => '1285',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '13795379620',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://nwx.zhizhuchuxing.cn',//下单 | |||
'wxWeChat' => 'wxbe6da4af3e529e0c',//微信公众号的APPID | |||
'wx_get_token'=> 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '昆山集散中心',//网站头 | |||
'entryAuthWeChat' => 'wx81ac156a5c166881',//授权登录微信APPID | |||
'aliPay' => '',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://hz.zhizhuchuxing.com/zzcx/user/login/auth-login?_a='. microtime(true),//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://hz.zhizhuchuxing.cn',//网站域名 | |||
'notify_url' => 'http://hz.zhizhuchuxing.cn/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://sandbox.zhizhuchuxing.cn',//管理后台地址 | |||
'adm_host1' => 'http://sandbox1.zhizhuchuxing.cn',//管理后台1地址 | |||
'adm_user' => 'admin_034',//cs接口使用 用户名 | |||
'adm_user_key' => 'admin_034',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 772,//cs接口使用 用户ID | |||
'adm_source_id' => '1660',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://hz.zhizhuchuxing.cn',//下单 | |||
'wxWeChat' => 'wx81ac156a5c166881',//微信公众号的APPID | |||
'wx_get_token'=> 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '昆山集散中心',//网站头 | |||
'entryAuthWeChat' => 'wx0376620fe134cef0',//授权登录微信APPID | |||
'aliPay' => '',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://hz.zhizhuchuxing.com/zzcx/user/login/auth-login?_a='. microtime(true),//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://hzfx.zhizhuchuxing.com',//网站域名 | |||
'notify_url' => 'http://hz.zhizhuchuxing.com/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'admin_036',//cs接口使用 用户名 | |||
'adm_user_key' => 'admin_036',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 798,//cs接口使用 用户ID | |||
'adm_source_id' => '1734',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://hz.zhizhuchuxing.com',//下单 | |||
'wxWeChat' => 'wx0376620fe134cef0',//微信公众号的APPID | |||
'wx_get_token'=> 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '昆山集散中心',//网站头 | |||
'entryAuthWeChat' => 'wx81ac156a5c166881',//授权登录微信APPID | |||
'aliPay' => '',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://ks.zhizhuchuxing.com/zzcx/user/login/auth-login?_a='. microtime(true),//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://ks.zhizhuchuxing.cn',//网站域名 | |||
'notify_url' => 'http://ks.zhizhuchuxing.cn/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://sandbox.zhizhuchuxing.cn',//管理后台地址 | |||
'adm_host1' => 'http://sandbox1.zhizhuchuxing.cn',//管理后台1地址 | |||
'adm_user' => 'admin_034',//cs接口使用 用户名 | |||
'adm_user_key' => 'admin_034',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 772,//cs接口使用 用户ID | |||
'adm_source_id' => '1660',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://ks.zhizhuchuxing.cn',//下单 | |||
'wxWeChat' => 'wx81ac156a5c166881',//微信公众号的APPID | |||
'wx_get_token'=> 'http://ks.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '昆山集散中心',//网站头 | |||
'entryAuthWeChat' => 'wx81ac156a5c166881',//授权登录微信APPID | |||
'aliPay' => '',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://ks.zhizhuchuxing.com/zzcx/user/login/auth-login?_a='. microtime(true),//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://ksfx.zhizhuchuxing.com',//网站域名 | |||
'notify_url' => 'http://ks.zhizhuchuxing.com/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'admin_034',//cs接口使用 用户名 | |||
'adm_user_key' => 'admin_034',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 772,//cs接口使用 用户ID | |||
'adm_source_id' => '1660',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://ks.zhizhuchuxing.com',//下单 | |||
'wxWeChat' => 'wx81ac156a5c166881',//微信公众号的APPID | |||
'wx_get_token'=> 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '快行漫游',//网站头 | |||
'entryAuthWeChat' => 'wxf5d1e7e3317bb073',//授权登录微信APPID | |||
'aliPay' => '',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://kx.zhizhuchuxing.com/zzcx/user/login/auth-login?_a=' . microtime(true),//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://kxfx.zhizhuchuxing.com',//网站域名 | |||
'notify_url' => 'http://kx.zhizhuchuxing.com/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'admin_037',//cs接口使用 用户名 | |||
'adm_user_key' => 'admin_037',//cs接口使用 用户秘钥 | |||
'adm_user_id' => 813,//cs接口使用 用户ID | |||
'adm_source_id' => '1769',//渠道来源编号 | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://kx.zhizhuchuxing.com',//下单 | |||
'wxWeChat' => 'wxf5d1e7e3317bb073',//微信公众号的APPID | |||
'wx_get_token' => 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min" => 10,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,37 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name' => '小黑鱼出行',//网站头 | |||
'entryAuthWeChat' => 'wx34e2f2b38cfb15a1',//授权登录微信APPID | |||
'aliPay' => '2017030306030595',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://fx.zhizhuchuxing.com/fx/?r=weChat/we-chat/login-redirect',//第三方提供的微信授权登录路径 | |||
'host_name' => 'http://fx.zhizhuchuxing.com',//网站域名 | |||
'notify_url' => 'http://wx.zhizhuchuxing.com/zzcx/order/order/notify',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'newfx', | |||
'adm_user_key' => 'newfx_key', | |||
'adm_user_id' => 581, | |||
'adm_source_id' => '1285', | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '18874559393',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => '',//分销PC端展示用户ID | |||
'zzcx_host' => 'http://wx.zhizhuchuxing.com',//下单 | |||
'wxWeChat' => 'wxbe6da4af3e529e0c',//微信公众号的APPID | |||
'wx_get_token'=> 'http://wx.zhizhuchuxing.com', | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,36 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name'=>'蜘蛛出行',//网站头 | |||
'entryAuthWeChat' => 'wxf945d8fb99f6250d',//授权登录微信APPID | |||
'aliPay' => '2017032106317613',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://qdhfx.zhizhuchuxing.com/fx/?r=weChat/we-chat/login-redirect',//第三方提供的微信授权登录路径 | |||
'host_name'=> 'http://qdhfx.zhizhuchuxing.cn',//网站域名 | |||
'notify_url' => '/fx/wechat/notify/',//支付回调地址 | |||
'adm_host' => 'http://sandbox.zhizhuchuxing.cn',//管理后台地址 | |||
'adm_host1' => 'http://sandbox1.zhizhuchuxing.cn',//管理后台1地址 | |||
'adm_user' => 'hzqdh', | |||
'adm_user_key' => 'hzqdh_key', | |||
'adm_user_id' => 450, | |||
'adm_source_id' => '1311', | |||
'show_recom' => [],//LBS定位的菜单栏ID | |||
'kefu_tel' => '400-105-1078',//客服电话 | |||
'YunYinPhone' => '',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => 4,//分销PC端展示用户ID | |||
'zzcx_host' => 'http://nwx.zhizhuchuxing.cn',//下单 | |||
'wxWeChat' => '',//微信公众号的APPID, | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,36 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name'=>'蜘蛛出行',//网站头 | |||
'entryAuthWeChat' => 'wxf945d8fb99f6250d',//授权登录微信APPID | |||
'aliPay' => '2017032106317613',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://qdhfx.zhizhuchuxing.com/fx/?r=weChat/we-chat/login-redirect',//第三方提供的微信授权登录路径 | |||
'host_name'=> 'http://qdhfx.zhizhuchuxing.com',//网站域名 | |||
'notify_url' => '/fx/wechat/notify/',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'hzqdh', | |||
'adm_user_key' => 'hzqdh_key', | |||
'adm_user_id' => 450, | |||
'adm_source_id' => '1311', | |||
'show_recom' => [],//LBS定位的菜单栏ID | |||
'kefu_tel' => '400-105-1078',//客服电话 | |||
'YunYinPhone' => '13625816476',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => 4,//分销PC端展示用户ID | |||
'zzcx_host' => 'http://fx.zhizhuchuxing.com',//下单 | |||
'wxWeChat' => '',//微信公众号的APPID, | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,34 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm siteConfig.php | |||
* Create By 2017/3/4 17:47 $ | |||
*/ | |||
return [ | |||
'web_name'=>'运游通',//网站头 | |||
'entryAuthWeChat' => 'wxae738c8d5654e01d',//授权登录微信APPID | |||
'aliPay' => '2016102100728544',//阿里支付 | |||
'weChatAuthLoginUrl' => 'http://yybs.njyunyoutong.com/module/wxInterface/authLogin?ma='.rand(1000,9000),//第三方提供的微信授权登录路径 | |||
'host_name'=> 'http://fxtest.njyunyoutong.com/',//网站域名 | |||
'notify_url' => '/fx/wechat/notify/',//支付回调地址 | |||
'adm_host' => 'http://cs.zhizhuchuxing.com',//管理后台地址 | |||
'adm_host1' => 'http://cs1.zhizhuchuxing.com',//管理后台1地址 | |||
'adm_user' => 'newfx', | |||
'adm_user_key' => 'newfx_key', | |||
'adm_user_id' => 581, | |||
'adm_source_id' => '1285', | |||
'show_recom' => [25],//LBS定位的菜单栏ID | |||
'kefu_tel' => '021-33280519',//客服电话 | |||
'YunYinPhone' => '',//运营通知电话 | |||
'recharge_amount' => 1,//分销商户充值最低金额 | |||
'pc_uid' => 4,//分销PC端展示用户ID, | |||
"apply_commission_min"=>50,//最低可提取佣金 | |||
]; |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEZTCCA86gAwIBAgIDHYb3MA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD | |||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE | |||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w | |||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MDQwNjEyNTAyNVoX | |||
DTI2MDQwNDEyNTAyNVowgZUxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv | |||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL | |||
EwVNTVBheTEqMCgGA1UEAxQh6JyY6Jub6KGM572R57uc56eR5oqA5pyJ6ZmQ5YWs | |||
5Y+4MREwDwYDVQQEEwgxMTc3NDYwNDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC | |||
AQoCggEBAMJqPHEeUQvWZQWl5W/QvI/MR97jCY6iArnfPPkLBgWY6lEh7cGFn5Fq | |||
C2DsTHxuUC/7si9Sq5QHA2K8VaLk8qYDj2CurT0yRFVAVss/NYfPerZ6nHLbEB4p | |||
dYg6jUvQVWe7n5hJScq+89MNGUOpgF4uCCD/HyUDpRT8MFRQ+yGDTpuCjqZwexgM | |||
e0jNTKwvCXVwLcgR9LFknSiJCxDHAqauqd4r+ZAjDU4CZ/JWdeyLuRUqwxz4kECE | |||
S9iC79mhyo/KwoUupsZKp8RKacrhHybqMjgyZNFsVueLHjcDpYkMgrpUQU6QBJv6 | |||
pLqOPejSQg99ddJNBTJJwwffU2mrDG0CAwEAAaOCAUYwggFCMAkGA1UdEwQCMAAw | |||
LAYJYIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNhdGUiMB0G | |||
A1UdDgQWBBTIibbUnV9kTejncwyzXb81/xqj9TCBvwYDVR0jBIG3MIG0gBQ+BSb2 | |||
ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgT | |||
CUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQx | |||
DDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJ | |||
ARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAW | |||
BgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAHelavW3WB | |||
2qBtcG0uEVPLYlWKMvYpO79QUaWPYWh9bywA9d2zqoM8LfWgkOJtmetNdiqh3RVf | |||
/DrKWsLalluaLIMEHuX2chnvtT7vIO4ILijgP/4MZ9k8Jpmi3tKUfFpJVA7E4MXa | |||
7vM5gl21FRuqB96m24tynWHjmgshc4Kk2g== | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCajxxHlEL1mUF | |||
peVv0LyPzEfe4wmOogK53zz5CwYFmOpRIe3BhZ+Ragtg7Ex8blAv+7IvUquUBwNi | |||
vFWi5PKmA49grq09MkRVQFbLPzWHz3q2epxy2xAeKXWIOo1L0FVnu5+YSUnKvvPT | |||
DRlDqYBeLggg/x8lA6UU/DBUUPshg06bgo6mcHsYDHtIzUysLwl1cC3IEfSxZJ0o | |||
iQsQxwKmrqneK/mQIw1OAmfyVnXsi7kVKsMc+JBAhEvYgu/ZocqPysKFLqbGSqfE | |||
SmnK4R8m6jI4MmTRbFbnix43A6WJDIK6VEFOkASb+qS6jj3o0kIPfXXSTQUyScMH | |||
31NpqwxtAgMBAAECggEALemSzo//SdFe2B+eeHKOJVNz4aIyXpnKFQUwTAwbZvT+ | |||
2RwvHtWkol2txDzprzUKANrq8JwQYwvo88dQXgC9gRE0Kfv2c45Mbumb1bHevWz1 | |||
KOT5z3IGc2kNFZfmSHIxySaZAQjFwXio8j2UqtL7usIaL1iwjTg4IyWPcEoTlI0Y | |||
reRXlZY5z+VpaDFQubFytF+5zlb7ck/lPa8B6IJXZTBBQC6zBhuxXPky8uAjiza1 | |||
1C0EHcIIwA+jkVxRbV4e8e6VV4OPnjgok8rN0GPEPlJNo/Gs73vSCRNOYgz5QwTB | |||
7JgRc4eFEXLaX7ntZxhkrOjK1kJQ8hLxYQLvygA0zQKBgQD8+PmHg59Y4c6MkYYk | |||
Gxn8SK6QCtNns72uFi3DJAN9j7x3ZSb4PcjDao0e9BeOt2wKuX+kOyXtSbKA33o/ | |||
izeevp9UF2eNhGWgGaU7kMAgylS/V/iIN4A4UuzOyPEYSa9LYLMeHwh+OtH6skqZ | |||
ZjRPaLyJYrhP8Ecqp1B7rmu4rwKBgQDEvdwvvpmiEbui91g2l9P1E/ik3f+VfOTR | |||
5qKtYHYtYdkZAmg+7B6V5f8BCjx7NScS9di8J5KEOuDAc/MXD+o9jDxlxsSmAXB4 | |||
n6fqko/wHmG+Q6FXmFamO3mdj+ziKt6ykoNQWS3lzZ4KLHNC1lDwMsd6VmMMr3Ys | |||
iGH4nYYbowKBgDc7kRfCaDc6ziMo3tXhSPIpWFvA0VmSB/cLhqBVq6FtkaOr5S9M | |||
JhpsmDVK7B3P9Hn++Fx+QZCmh5/Vq1ZWaiVxz03H8mcWoi2ri8UOnLRMGObSKURs | |||
gcVKbcPUYbeA1xIpIdKQygTtiM0owlrt0rwHzSpd8Ioblx47+7mVYpWnAoGBAKgu | |||
QMZToZNoo0S5OiBZA6iyLNAKsgxA2n4QMSoSlpNO3L3DUAfR4odzN9zUukT8d+1+ | |||
WYrmLRp6FlyOAdTKFwwMEClUlA/wlQuYN3uPVBoIbretqoNtx0yM9PZa7T2dNgfi | |||
tPv/b/vNHHdH7jPJbyEV123d4QgcCeIhp9ZWGikPAoGBAMUbx9snnBwswUae+Dv2 | |||
NkH02dv7oPQnPWKbk8b1s/LQEuisYO+34Aofx1ik5MmAZBN/3x8Cn7/i0eOKEUnd | |||
TRsJuiiSFLYdNISDUBQ4R263uSewow9kagrk/lwQgZ/6pJSXQH9G1ycNeZxmR3dq | |||
XevCR+GjHIwTFaYo4XOBYoNw | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEcTCCA9qgAwIBAgIDbv1AMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD | |||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE | |||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w | |||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MTIxNTAyNTEzMVoX | |||
DTI2MTIxMzAyNTEzMVowgaExCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv | |||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL | |||
EwVNTVBheTE2MDQGA1UEAxQt5p2t5bee5Y2D5bKb5rmW5peF5ri46ZuG5pWj5Lit | |||
5b+D5pyJ6ZmQ5YWs5Y+4MREwDwYDVQQEEwgxNzMzNjA0ODCCASIwDQYJKoZIhvcN | |||
AQEBBQADggEPADCCAQoCggEBAODZhsyu7SJwyB4dTG8VFMGcGQHhUxQVB+yu2QOj | |||
MLJp53IujiIhAjTRqG9Equek/R+h6oCnmeTjD6xXC9notguntPYeXSPHMjETFy/F | |||
HJlqIm30+jRXIA0ReI/Wieql5P9sDrTswt+Y0pNDmAonGLdKU4FshZWBjlDdmOiJ | |||
Ggs1a6UEP7QDW/IYEwUD2eorQbY9DlRf1OFqhHsHbbQbdm3S08wDaklf3prnnqVv | |||
TbvbW5t5YK44IBzJPyhguFMHclTbRy+E6MZZb28cwYXlp6aWe50IDgFW042IatW3 | |||
joKuWsVOZRZlOvXmjl60ouXuDXA65WRYbrXRKeL/mZ78410CAwEAAaOCAUYwggFC | |||
MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2Vy | |||
dGlmaWNhdGUiMB0GA1UdDgQWBBSuCl5BeaCKOfkvmFS++3+56NZN3DCBvwYDVR0j | |||
BIG3MIG0gBQ+BSb2ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMC | |||
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | |||
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | |||
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1Ud | |||
DwEB/wQEAwIGwDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUF | |||
AAOBgQDBdRAOavYhQEaMyVtISWfTNxW5HIH5gguTSwH9w7nGTlZf5C6OGUL3OZEG | |||
3fQ+ve2FxiNAUAqTiG8BsiY7higf5fD2kTaupwPZ9b5jKIHkBVq+Q/TkO57JnlWA | |||
Xuya8V0laO7T/FBL7hZqHPUH/ffJYq4GtluwrJ7I/5k0GOLDxw== | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDg2YbMru0icMge | |||
HUxvFRTBnBkB4VMUFQfsrtkDozCyaedyLo4iIQI00ahvRKrnpP0foeqAp5nk4w+s | |||
VwvZ6LYLp7T2Hl0jxzIxExcvxRyZaiJt9Po0VyANEXiP1onqpeT/bA607MLfmNKT | |||
Q5gKJxi3SlOBbIWVgY5Q3ZjoiRoLNWulBD+0A1vyGBMFA9nqK0G2PQ5UX9ThaoR7 | |||
B220G3Zt0tPMA2pJX96a556lb02721ubeWCuOCAcyT8oYLhTB3JU20cvhOjGWW9v | |||
HMGF5aemlnudCA4BVtONiGrVt46CrlrFTmUWZTr15o5etKLl7g1wOuVkWG610Sni | |||
/5me/ONdAgMBAAECggEBAMFD1+zZMnSW8juIPWmBejzMOmZ2UZ2CUjRrOZc5zqKc | |||
CtcHEx5ctvPFffxdznSbSQLGfrUk2k91p8Qfcc1UjB1Kgm3GPZKCJi8uVJC34VQw | |||
ePWASwtwE9mHudQQuKza+RFexOlYVEwypFT2FZosbr8lAM/PAqc2G6iAQG0nYx5b | |||
qD9JG0dWM8weEHdWVUrqPjKxBbmAAw9s/eBK/EdNiBV/bbaV5R5D0vCmZNIEwHuM | |||
9NuYTpX6gyNFK7bWfhOUaAHq8DVT8RW3+0U8Rs852wgA80IsV4TR/z0qUzYQA90Q | |||
7IRBugOqO7rTPnWdgIfU7Vhy2grfnJgaQy/zi+r58IECgYEA/uCWSGdWJ43bjDMQ | |||
0QvdyjLtz+fVt5NrVfqXwGujyiMGD+cL6Kv26NG8t2p42dPxAbSeTMlhdOPN5nay | |||
8XAYDpn210kqLYjtVIep2QsX3hc55ODnBmUhXAs3gEubCZmdjGEnHNNyupKZhgN9 | |||
+SnaQ2BIvvKJQHOhYNKPyQE+UD0CgYEA4dcUL37g02Zi+ujEvtBDEqosdl6pXpSy | |||
RvDrYJ1rgDuDn74H32VVuNYi4m3sQcvQe01FeWsRAcUy0B7lv4h0g/Q/4wkD4NkH | |||
KBwQOP+Aj3MDQ5+PJDVal1RRZWw+VMKmwY+jqUpwrNHiTDK/tn6KsnTC/S017BF3 | |||
CvtwAst/8aECgYEA94DuTwcSMbzeuymHpgjI6qZEK0WtUuQ0Mjzziia82fji1SR/ | |||
ewUq8vFhOheJnbXjbs2Pf297VQA2nRsdL7mzktJOUsc4zxkNpq1K8XqFReT2El2X | |||
2qzwFSrLTamdt1fWF1Dso2BuI+FidjID7aaHzi+81Lg/MjhXOOegOwgbE90CgYAi | |||
DMR9WLrbBK/dtqSbRFkogkHL4v/UQ8URTxed7H4dyltRBVy4gNXI1XhS/VHGpc0c | |||
Gg1kfhEFXE8J8+6dzxwKHRRYza4pA2/By2FixpsChcuzMWZqhiTPdiYDjatkKijs | |||
PBTn3FJarBZbeLdQ84lD2LjhZSShIAz7uecsdLQooQKBgQCE0NibkVvSsZ4LoZEi | |||
jWV78S6qXU1g0ANsKNF3dOoaXo3p8DknpS/oJ1/OA78IlKB/WQPOWsPpXQsOXkZx | |||
qcdNgJnV8j3DvOr+Tm8rzl3HKCucQef7IfSbW1aJD+TX6rFVMeHydY6lSB8oeJLY | |||
nRpxVJWSOOjXAIIu9t9nExQQgw== | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEbDCCA9WgAwIBAgIEAJaVazANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC | |||
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | |||
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | |||
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzAyMDgxMTIwMDZa | |||
Fw0yNzAyMDYxMTIwMDZaMIGbMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk | |||
b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE | |||
CxMFTU1QYXkxMDAuBgNVBAMUJ+WNl+S6rOi/kOa4uOmAmue9kee7nOenkeaKgOac | |||
iemZkOWFrOWPuDERMA8GA1UEBBMIMTk5NTIwNjUwggEiMA0GCSqGSIb3DQEBAQUA | |||
A4IBDwAwggEKAoIBAQDPwnYEO8Qy9b74W9bgwuYFphegYsL1Hyb7K7c4nSW7bhwQ | |||
8yThF2V2XAzVNFlV3n30K1zr3x7Bh5HDsIHVNO1/HiNX53P+5hX7hndqxY0KzzZx | |||
N/onn7Ttm8T9IIhiFqmEj72VNoi90xcsmVLrrSLstjkFTlnt++r/hG0gOz4dVi+y | |||
8uHO5qMV3moxQr+Xbd/B9EJTk74ec9ix3oO5usBAxd8FIFfCJXnQm9DQDQ0j4/pE | |||
7zsk1X9hq0RO3YMLzmM2yFV3iFEje5hcXd08raLS5m/elviW7wyEFfEE4njCztbb | |||
zgLR8FTWSieOmZ7fMiPNnp+V8aMRNIPxaEU/f6JdAgMBAAGjggFGMIIBQjAJBgNV | |||
HRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRpZmlj | |||
YXRlIjAdBgNVHQ4EFgQUs+N0We1skjwMxRjMPPMy8EaLqycwgb8GA1UdIwSBtzCB | |||
tIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNOMRIw | |||
EAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdU | |||
ZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAdBgkq | |||
hkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8BAf8E | |||
BAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEA | |||
wQ3mmhwF6GU6uzy5aTZwQATYDl06xCeXLy2DlGONii+xJ3Yj3ZVFS5voKAKhapXp | |||
qt+b+Gm8zIZq/lFofVxTbeyDxg2yyZsBQ9ibbAWK61qAY0rYPMYTSc5YbAs5SLsH | |||
fPDpuIv1Fu2vXGTmc9Q7SoT4gXLqj7kUBVN84KnVsSc= | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDPwnYEO8Qy9b74 | |||
W9bgwuYFphegYsL1Hyb7K7c4nSW7bhwQ8yThF2V2XAzVNFlV3n30K1zr3x7Bh5HD | |||
sIHVNO1/HiNX53P+5hX7hndqxY0KzzZxN/onn7Ttm8T9IIhiFqmEj72VNoi90xcs | |||
mVLrrSLstjkFTlnt++r/hG0gOz4dVi+y8uHO5qMV3moxQr+Xbd/B9EJTk74ec9ix | |||
3oO5usBAxd8FIFfCJXnQm9DQDQ0j4/pE7zsk1X9hq0RO3YMLzmM2yFV3iFEje5hc | |||
Xd08raLS5m/elviW7wyEFfEE4njCztbbzgLR8FTWSieOmZ7fMiPNnp+V8aMRNIPx | |||
aEU/f6JdAgMBAAECggEAF3CXJA8iKaW0MA0chys2DHkavUunN0SWf0wFVevU7/qS | |||
TA9Cn+ql1d64y+0mDxwVFdE2oJ4BuE/1UCC/5TAdg3QBBM/mNGH9JO2c130GVqve | |||
NpPcM1A/d3dVmEFtYbOw2HXnK8iFUPVZ7fw2cMSN5isA7+pRFxqO/tkP/szwSxrU | |||
KMlPP0SPr/sKUEAX0n7LZEd/6SYNfYmMgrcsgUKywXWpk3A7RUvFr+JJXBfwO9ku | |||
m93itjpVGUp9qFi+igM2kEpTIpnmCPRmQGMrrbLNWVUVpOrd83FVBhD87yS8X/Pt | |||
OBUchLXIs+oGTXYpbDdYBcl6YbSglzg7pp1eYByTuQKBgQDnPrCMWTI6DhOdtpvo | |||
V32xbND8bH7bnEHlW41yOlS0zbFFo70roqnPtgvJdPMbl8KczpT+6wLdEZHFw8KD | |||
oOVajqixjSr2iZH8ST8m15vYjljUe5/ylnamC10G3ZgvnBuuQRLCR4r1bFla4cDs | |||
7JeOtRZHLCzG+V/OaSzv9+kC1wKBgQDmACcwQUrqo5GpQf617CFHo6GR6V4xiB0+ | |||
mQLHY93Wrdrzf+5mcaQjkm1c7hByEviiDFIdD8E1IEPoquAKDiFPcVHc8QuxDyE9 | |||
vDyxhH1/5MWXt20x9j8v/w7QQEyWZ7X1BC4/cFlp4V0Xelm84Ba7JECZ8pAVpCmk | |||
m2CfQGxR6wKBgQDgCUZ20zvsLxMmK3MlSQ6HxQs8Y8kL73mQQoDpeEX03YuwEpEG | |||
I5QtnwwQY/Pcec2cqjCEQSAHGiyG08AyUsGiWLBrRH+pV2NOb5B1i1J8Hn1Fb3hp | |||
SQkumbfJHQuCpNXUn0sTWsjwOcbgW/PUFuxG4H7y+YNwSs5dZlyZKTBhBQKBgB/8 | |||
QXbqfZqn6KfbL6rpDa/Cx8Nc6uaEgVylNse30a/7OYnHbsX8Y9E2mdLkoJDcposS | |||
n5C/EiVrOUZwDPwY/vTnU3UgaHnVGtBVDzO4syNIE1qH/b2G+z6Xf93iM0RvY9SR | |||
IkVcQHMDDkknkLc9iqu33OwL2ZHI5KmpmgRLl0TFAoGBAKM0ItpOQzZXZbIJ5qVv | |||
SRCs6DoaOMnnNFzazJiygS04jD0hvENgO4yXc0DBbNLaLncK7CIo8W2hJk7Mvedi | |||
+e1Kuho/0RcdL+h7gIvgFbGcsDFxe4we+BAyMv8D9JpZ8YQRKVsyvVlYWGGG3K3m | |||
4zHqOVp/wQL8G+UghjUmc2+N | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEbzCCA9igAwIBAgIEAKwMkTANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC | |||
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | |||
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | |||
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzAyMjQwMzEwMDla | |||
Fw0yNzAyMjIwMzEwMDlaMIGeMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk | |||
b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE | |||
CxMFTU1QYXkxMzAxBgNVBAMUKuS4iua1t+icmOibm+ihjOWbvemZheaXheihjOek | |||
vuaciemZkOWFrOWPuDERMA8GA1UEBBMIMjEwMjM1MjEwggEiMA0GCSqGSIb3DQEB | |||
AQUAA4IBDwAwggEKAoIBAQCv6lbfzD1Mt7z28mMVd99MUjzOgSQicVJAoAw75oob | |||
k64LZseAV8FooGg8d8zbeq0luLQ72KekrdZgACAPkJFDrsz3OPFjCPl0KY9jhTt8 | |||
61NDSlPtlxXRgX/greDqPhXWSbEFGcMo2kBHvftQl3QG8xeDHDNCVS2cTj+w57AN | |||
OU6R2xAXIbC3FIn6jxQTKuxSZ4E98j0cYtf3nVzMgB229lVeYQJ1CUr+Hs+33cPg | |||
NBsKgBUR6XuzF7lslBX0mHmS5RsnXvSA6sIMBi2cDbLL/j3q8AZ9LGF/aZfrJIOl | |||
TI/yjlL2aXrqtWBNd9eIRKOm64ATJL2/WrgJkf4vHlwnAgMBAAGjggFGMIIBQjAJ | |||
BgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRp | |||
ZmljYXRlIjAdBgNVHQ4EFgQUqMOz6uToZyHqv4ZGILzXWGvG7F0wgb8GA1UdIwSB | |||
tzCBtIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNO | |||
MRIwEAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQK | |||
EwdUZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAd | |||
BgkqhkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8B | |||
Af8EBAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQAD | |||
gYEAVxAPmLGLprv8XtFr2T/1Ib3gTpFjcvYyIsHWp3NTWfOih/HPFEaxd4KCfwR8 | |||
nY9btBuMxjyMcEMDfgDXWczMtC0GyfAHfv2HbfpJ0SJ8kFa6Mq41BCusYwWaUv9Q | |||
hetuxhC1oIlyVzayA87aYXouuQjZO6bFOeAICJeVZAopu1o= | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCv6lbfzD1Mt7z2 | |||
8mMVd99MUjzOgSQicVJAoAw75oobk64LZseAV8FooGg8d8zbeq0luLQ72KekrdZg | |||
ACAPkJFDrsz3OPFjCPl0KY9jhTt861NDSlPtlxXRgX/greDqPhXWSbEFGcMo2kBH | |||
vftQl3QG8xeDHDNCVS2cTj+w57ANOU6R2xAXIbC3FIn6jxQTKuxSZ4E98j0cYtf3 | |||
nVzMgB229lVeYQJ1CUr+Hs+33cPgNBsKgBUR6XuzF7lslBX0mHmS5RsnXvSA6sIM | |||
Bi2cDbLL/j3q8AZ9LGF/aZfrJIOlTI/yjlL2aXrqtWBNd9eIRKOm64ATJL2/WrgJ | |||
kf4vHlwnAgMBAAECggEASLUTaPZSU7YRXQO7njDoUvQee792fuHVfC5qQAu+Az3b | |||
jozRYiNjJeo+itd9DS28CL45iA6442CSHSWQGr7Gu3Gw93FKm4MnDzLqN9jmSHA+ | |||
/q3m2Gk8tFXQ070qG8bDYckdaB1Iw0bJkJ1eFOY0J3crvZ3XNdBcxKC2xFhONHhO | |||
o6i6VloubOCNk1ZNUieGgp1xt6nfXn4qt3tcD51gPwWYVoPGceKZUiNOhTlRTORc | |||
4X/lyMccXQei8M2C0XEUzMvsULdLB73lPGK6WMEnzWFNsAcBMGaBPiJrJV2m+iHV | |||
LWGazPR+kjmy4J9OuofdOZUzonxS4Cozmj2MXEOVKQKBgQDYYIavuf1zzIyYaPXw | |||
i4baef0wkalsDYtvFD9llAQcRs/PgGIj2U9zlPzedqhfKa8HK7yEYFqnLWfSWsYS | |||
zPhW/u/dusaOLKmQuTVtmPNKAf+HkNJ62/PQVs6FnP/53Oy+AzvCxsKdrh1XVmma | |||
5gL73qzouKGJMqDi/O2TLAS37QKBgQDQIQXp/SvA7XOcNUWy6qHmLifLr8HAbh8k | |||
G10ZvG0TBc8bYaNMhueoeEupl44AVOTWa7875H/9n5emzGRhu07pIFYybTacwdvj | |||
JsFM1lt0m3KZpWe75HCHqer8m5OwQofXnObzvOxJVxeOiI1s669zRwt/NYpdoPNL | |||
8tbrK3m54wKBgQCReMv0hunUmbgIm8CFuXivmAZWSggKwkx1ILrCszHURPNgAWN5 | |||
0JcvEQK1Gjd2y1KGUqxKn3EzJj6/2RGEAFQSQRHJE9J8MaDK0QoPph4jKpa+cOph | |||
eVFBR6tPf09FkHeGBCyAdhrP4giN+GXFo1BsP7gmOkM4N1adZQjgwl5lvQKBgQCV | |||
h7RFCVSfFrph91AtHC/XPT/wMkUEqNmMynAYJm1DJoBGzt5RA/d57XuGy9EE4flL | |||
KDxLnn5qTHfbKavRH46xJT9omViMRSdiypxERRmN7IToaJLfxl8myOiANpJkJ1iL | |||
iznO0eP9SSouiGL7Z1U1gEx9R40yeYly/nR0n1akOwKBgA1boMebTv47D/9tky6R | |||
R4kdfrNzkzHuV6mVxp7adgXqkRVY2uTEF5zU4JnZixXdjAX3f/9IjapOt/LxpK7z | |||
2oCHdgdeJXCQJbwsnl59HclEoVqq7gBEzpqIqo/l5Rv1ta0/ZjRHI9J5L8mmUAYy | |||
mXaOWBrrcTPyww4qvCv8m7rI | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,19 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV | |||
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy | |||
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 | |||
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx | |||
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B | |||
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f | |||
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A | |||
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC | |||
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ | |||
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm | |||
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw | |||
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj | |||
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF | |||
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA | |||
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y | |||
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh | |||
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,20 @@ | |||
欢迎使用微信支付! | |||
微信支付API共四份(证书pkcs12格式、证书pem格式、证书密钥pem格式、CA证书),为接口中强制要求时需携带的证书文件。 | |||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。 | |||
不同开发语言下的证书格式不同,以下为说明指引: | |||
证书pkcs12格式(apiclient_cert.p12) | |||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份 | |||
部分安全性要求较高的API需要使用该证书来确认您的调用身份 | |||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户ID(如:10010000) | |||
证书pem格式(apiclient_cert.pem) | |||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制 | |||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供 | |||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem | |||
证书密钥pem格式(apiclient_key.pem) | |||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式 | |||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供 | |||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem | |||
CA证书(rootca.pem) | |||
微信支付api服务器上也部署了证明微信支付身份的服务器证书,您在使用api进行调用时也需要验证所调用服务器及域名的真实性 | |||
该文件为签署微信支付证书的权威机构的根证书,可以用来验证微信支付服务器证书的真实性 | |||
某些环境和工具已经内置了若干权威机构的根证书,无需引用该证书也可以正常进行验证,这里提供给您在未内置所必须根证书的环境中载入使用 |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEczCCA9ygAwIBAgIEAfU6HjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC | |||
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | |||
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | |||
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xODA1MjEwMjM3MTZa | |||
Fw0yODA1MTgwMjM3MTZaMIGiMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk | |||
b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE | |||
CxMFTU1QYXkxNjA0BgNVBAMULeaYhuWxseaWh+WVhuaXheaXhea4uOmbhuaVo+S4 | |||
reW/g+aciemZkOWFrOWPuDESMBAGA1UEBBMJMTAwMzUzMDA0MIIBIjANBgkqhkiG | |||
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5yLNsqgq8Au4TgvP1U227rbMmarO84SRYr83 | |||
INGUx1+5m06Goc/Vhhe98j7Jh5SCqZ4c5yLNAqxk22lgO9bdaaYFU12LacNla8hg | |||
a/eIUFh1UGXvLBBwfIzSpR0Nj5CzJPCCon21I7km2gqtqGAbIz0qELfmgSwQEuu+ | |||
f6XKp1Dqs5axQ8Cq8YuRZ1Q7nobCckeMHpk22PPS/D92VBuHrFxpDcELr58vRxAu | |||
iLflKP+6sJvaQD5+xXeBY/Vz4SpFnFkVuejYTAaIjFX5KyWDIVUf3/cMyMdrS+4e | |||
khePRE4FP3AvoShUiUAb8Ym2/1202+RzsIYseZBXdPEshWNG6wIDAQABo4IBRjCC | |||
AUIwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdIkNFUy1DQSBHZW5lcmF0ZSBD | |||
ZXJ0aWZpY2F0ZSIwHQYDVR0OBBYEFERVFmAA70bqm52Yw05ySW5n6YijMIG/BgNV | |||
HSMEgbcwgbSAFD4FJvYiYrQVW4jNZH6w1GKn5YZ0oYGQpIGNMIGKMQswCQYDVQQG | |||
EwJDTjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4G | |||
A1UEChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENB | |||
MR8wHQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50ggkAu1SXK7wA6FcwDgYD | |||
VR0PAQH/BAQDAgbAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEB | |||
BQUAA4GBAEWMBa8sGubX8dkM5nMO5ONcnU39R0wamvcKx+SG8PcRTBpIGOyJUtQK | |||
uWDpleqRsdoXKUsO6nerlPTYKHZii+NONRzEmGrOgIxJwk/POtbFkxthW1hui62Z | |||
uZqtDXV5nZw6T91MTo8C6+KRp74SjNAaTqvazNVW9TdPukDoh9Db | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDnIs2yqCrwC7hO | |||
C8/VTbbutsyZqs7zhJFivzcg0ZTHX7mbToahz9WGF73yPsmHlIKpnhznIs0CrGTb | |||
aWA71t1ppgVTXYtpw2VryGBr94hQWHVQZe8sEHB8jNKlHQ2PkLMk8IKifbUjuSba | |||
Cq2oYBsjPSoQt+aBLBAS675/pcqnUOqzlrFDwKrxi5FnVDuehsJyR4wemTbY89L8 | |||
P3ZUG4esXGkNwQuvny9HEC6It+Uo/7qwm9pAPn7Fd4Fj9XPhKkWcWRW56NhMBoiM | |||
VfkrJYMhVR/f9wzIx2tL7h6SF49ETgU/cC+hKFSJQBvxibb/XbTb5HOwhix5kFd0 | |||
8SyFY0brAgMBAAECggEACKiGGhYwnZNi0RGiNHRX0PNqEKuUWwzxQUi2cPVI5HsS | |||
gd3cLz2Q2xgSlnuBoyGOD3qLzKDCG0KH+Kwm3bb7zlRYyLmtWkXmi7YS3piEM7ZM | |||
lrlqzzTCcff4gBTpiCI8g7q6ugmJepAaA3r47GDFQ3msFLo+2UHkTEEmfrOgNso/ | |||
9oG9f8CUFMrTE+2lez3pUf60cMJaNqKsOzh3hc0JlQCBnvQ+7S7kI1C8gcPumfGV | |||
oVhLAW/261q1qH+Ff4rPF+k2P2MC9Om3Pb2Rx4gIH8c+vnVFoBrkBPpfnBmfInCv | |||
zJaKiMvwx75QR1EhdnXREiCC69c8u5zgMA/+91zE2QKBgQD27gmpBXU8Kfp6M1vT | |||
J/wmJgpSN/MyOh2b1dWFHEC0k1CuxP2YTXpEPfgm8y5dYiY4LwFFufhuYLNWrAKA | |||
KTjiskgCVkdDhupOsOCF5/TD2A0njvTkFJSFX5sbCB4eohrajCBMxxyJHWPTC3JD | |||
WDCAMgUssvh8ceS4VFsfUhI4fQKBgQDvoEAt8LRaTXfegInU7Dqs/eytzv/NqvHc | |||
23hb+EqsguCzWpvWgYzz+1eoOP9t7dRx1E2xBS6QhEvvJ5xnCs+jfbDqcz7mN9le | |||
Tn79UI68mEjaoOIIcWhhFoP2dHgcryYbcoVDYIOMeJKPAu8D6SefqFoBnAm3qGbs | |||
gdt/PfsBhwKBgGzXGUz2Cem9+xjYAHZ/XmYWSGBbJwgRk7F3vIjSnja55EtUqw7x | |||
v53KztGkSOCCfaQwG9h3E2jbmNDwOp3xDZDm0lStYPYDxs1uq1h6mGmmlo3ENm8+ | |||
HwT20jBFELmh7EI+l5IgBZTubmy8092ZRq+K3LsKG/sGXLFfBVc13rAlAoGBANHH | |||
eyg818dOlqgl44SSInQcAL3QwEUvaHovcNkjL0yDb2/U3SUXWWynF4BgFc4JLblR | |||
YYqdvLwr9cYy6UuUPV8lxGIb7m7hadyT37yob61PrEgqHHfDwNtuOKzkHdsOws+4 | |||
nE32CnRJghTNPq4vyc6ONe2+ywsL1L8smBp3Cm21AoGBAJ5kjtvGnvolh+75Np06 | |||
50sMkY4qQ5IqA5w7qL0tv6EbAHUau+novsmMtWPGO+H/VqslN52IjBszMsa+MSV3 | |||
hW6EQ+oO7PPhLc7b1GfZks8MnXsjKpONxO29A8ipLpHs8P1HoC5sb0SSLPnEUk4f | |||
IvOhWwmLdg4rVF3nKYqembj/ | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,26 @@ | |||
-----BEGIN CERTIFICATE----- | |||
MIIEcDCCA9mgAwIBAgIEAkLd8TANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC | |||
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV | |||
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf | |||
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xODEwMDgwOTM1MjZa | |||
Fw0yODEwMDUwOTM1MjZaMIGfMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk | |||
b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE | |||
CxMFTU1QYXkxMzAxBgNVBAMUKuiIn+Wxsee+pOWym+aWsOWMuuaXhea4uOacjeWK | |||
oeaciemZkOWFrOWPuDESMBAGA1UEBBMJMTAyNDgwMjg0MIIBIjANBgkqhkiG9w0B | |||
AQEFAAOCAQ8AMIIBCgKCAQEAujYnlGjsULKiRw47NmInm/D+0ojY+XI7GfUtIVAS | |||
ruiOZgVVO/fmZw5M91jkKLxlfpkS5JOlu0SqGldWRUm6YC49k60hUesAxbUayuTZ | |||
Som5qYQx0PH4TU7OOoYBZVXfYJ5rnl9Sx7V3xusoCDbZZNE8rkI59j5/Jz7ukaMA | |||
m3m4seyyGi+np2RonMfV2El0YO4kUF5kLe/fgUF4aXAe9rCTk/CMb+toUQ2OqA3S | |||
qiqItLUJ+VWBNe1Z63iwj1XptX/6Jk7sGkwxVWi4d5Nq1GtbF3s8Z74laZERbxRn | |||
IsXg4cjF7GIEu8i3469dH3YWULPNfskV8jSIskhMt280UQIDAQABo4IBRjCCAUIw | |||
CQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdIkNFUy1DQSBHZW5lcmF0ZSBDZXJ0 | |||
aWZpY2F0ZSIwHQYDVR0OBBYEFO3xZCH7fZoUxMpgB5luX5oY1OEHMIG/BgNVHSME | |||
gbcwgbSAFD4FJvYiYrQVW4jNZH6w1GKn5YZ0oYGQpIGNMIGKMQswCQYDVQQGEwJD | |||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE | |||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w | |||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50ggkAu1SXK7wA6FcwDgYDVR0P | |||
AQH/BAQDAgbAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUA | |||
A4GBAMBj/bTCUnZvNGuTi+5WyAQ6Vs880Y4/aFSWMQjp80bFBdg3y6GZoS/KBaXi | |||
/0Y71PeN8QzWBFHETifWFcOmBEJdfQa/joRILDwL1uaM/YCQo9OKvtgFEbeG3prP | |||
8zOLaSPkaSalWVB97t12/oF73RkZLfnvcNbg/tw6OoQM4yo5 | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC6NieUaOxQsqJH | |||
Djs2Yieb8P7SiNj5cjsZ9S0hUBKu6I5mBVU79+ZnDkz3WOQovGV+mRLkk6W7RKoa | |||
V1ZFSbpgLj2TrSFR6wDFtRrK5NlKibmphDHQ8fhNTs46hgFlVd9gnmueX1LHtXfG | |||
6ygINtlk0TyuQjn2Pn8nPu6RowCbebix7LIaL6enZGicx9XYSXRg7iRQXmQt79+B | |||
QXhpcB72sJOT8Ixv62hRDY6oDdKqKoi0tQn5VYE17VnreLCPVem1f/omTuwaTDFV | |||
aLh3k2rUa1sXezxnviVpkRFvFGcixeDhyMXsYgS7yLfjr10fdhZQs81+yRXyNIiy | |||
SEy3bzRRAgMBAAECggEBAKBDA4WDV/+L/oZRBT0k9RoNLANeq/7kBWGt1Y2aMLpA | |||
hG3hoR3fmXiQokUvSA6XNnLio5P+TuEBk7Tf/evcLH+izHRQySCLtTpzR//fPfQc | |||
3KG8mHNQDXfbnzpXItRoN7wcHFtNhx1CXTfiI64OJsPSIPuJHAGGgEDytLi7JUao | |||
37Uq42/TmA1dNhlvgE6TIEO6cmAKBR2nw2IBSUM7CZW7s3cUCOJWug6K1JyEl9Nl | |||
NCcdJdfcRQrhkYHnIxbDh7OdlQCVJ0Zk/AsmYhmibw3jo2MlHj4/Mfa6FMil7GSF | |||
yd5VZ2f5eZjRzEWbGyIty7NG1cHCo9tKEIxemRbf/sECgYEA5Y28jCpsWmLZSKVe | |||
VLpjn75mHgopzxc6dQChi/1BdJppC4NttNi/iuK+wmxIRWl7FkxwAZ2ADKHR6XLg | |||
dTRFysEKXaB6YHuoYljxuwRGnfiw/pPfMTe8/vRhExMAe1sKsfWlljHdU/s/MkeJ | |||
qJqyg9dpST0hlvbRIcPnQGg6Pi0CgYEAz6ofOaiQfLzwoWXSbkyO20Q90QiDiDft | |||
hxHp/4mE3EhST1rIz4mFT8OBBIQhik/JELcXdbyI1pmPVmKWk0U/Szz7ViCEW0aR | |||
7ubQNwTcvvyTaeZQiCZEW63B58ySCYr5u9IgAF/wuOAAihjM8Xn1KZIiJ2kRAQim | |||
k0pRjjMryTUCgYEAmZsEhg6FPt5SY2g0/SFUNLqlfohyfZ8fgNeRQimPuUTx8cBa | |||
kt9PHNKpr1Ph8ICq2rr/YDVSUCGgY0R5qjP2V7xhAVG3UgStIlI+P1SXJHIbjd7J | |||
RRf1Ie3JX4ghlGnReE/WI/DuF5pSKYTxOp95wPtN+rIrXed+/ccnYVPdVWkCgYBf | |||
7MSpvKypghlhZIh0vNaMgJRRd65SgQsuhl7h1GNT4fBriZMTEwJKmxOAw4w+uKY3 | |||
G2wxzZokDyEAFWBavPUEyzGKUlDxXMLSaTorAAr8Ce4KUAJJMewHsVbNvViEIfdE | |||
BEcWBTtMGuUE5Xnd3akav88ZB1Z8dMOFbCIKHqcONQKBgGUJ7vWiPIRDtAIyqFX2 | |||
D+kWi2zuvObU4xb1wRTCkJWgOIC02FVwAQ1OyDx/qFQydCu+NsQPnCFGTGyITN/w | |||
R2VFLda9y0QIRxR8ms2VaJNrONJUq5OwM3TmNy2TxFdHs0rCa88/mS79IDymRYCx | |||
1YKTz5HxOhNxRT1tXqntPwrt | |||
-----END PRIVATE KEY----- |
@@ -0,0 +1,105 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm payConfig.php | |||
* Create By 2017/3/2 10:43 $ | |||
*/ | |||
return [ | |||
//运游通配置 | |||
'wxae738c8d5654e01d' => [ | |||
'appid' => 'wxae738c8d5654e01d',//微信开放平台审核通过的应用APPID | |||
'appsecret' => '5751c2e6f4cfbd07140bb09d3c16171c',//secret | |||
'appName' => '运游通',//名称 | |||
'mch_id' => '1439003102',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'oufcisdo3kld50dofdk545645dfloir3',//秘钥 | |||
'token' => 'yunyoutong_wx_20170213', | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1439003102/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1439003102/apiclient_key.pem',//证书密钥pem格式 | |||
], | |||
//蜘蛛分销微信配置 | |||
'wx34e2f2b38cfb15a1' => [ | |||
'appid' => 'wx34e2f2b38cfb15a1',//微信开放平台审核通过的应用APPID | |||
'appsecret' => 'eb60e17d2c86fd1c075abf1979edaedc',//secret | |||
'appName' => '蜘蛛分销',//名称 | |||
'mch_id' => '1443331502',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'oufcisdo3kld50dofdk545645dfloir8',//秘钥 | |||
'token' => 'zhizhufenxiao20170306', | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1443331502/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1443331502/apiclient_key.pem',//证书密钥pem格式 | |||
], | |||
//千岛湖分销微信配置 | |||
'wxf945d8fb99f6250d' => [ | |||
//web版微信支付 | |||
'appid' => 'wxf945d8fb99f6250d',//微信开放平台审核通过的应用APPID | |||
'appsecret' => '9b18ba811a15eb336314a58cf4c3f650',//secret | |||
'appName' => '千岛湖',//名称 | |||
'mch_id' => '1424400302',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'oufcisdo3kld50dofdk545645dfloire',//秘钥 | |||
'token' => 'qdh_wx_20170103', | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1424400302/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1424400302/apiclient_key.pem'//证书密钥pem格式 | |||
], | |||
//蜘蛛出行微信配置 | |||
'wxbe6da4af3e529e0c' => [ | |||
//web版微信支付 | |||
'appid' => 'wxbe6da4af3e529e0c',//微信开放平台审核通过的应用APPID | |||
'appName' => '蜘蛛出行',//名称 | |||
'mch_id' => '1329733601',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'a6654d342eedd8e293692a3e211a5e53',//秘钥 | |||
'token' => 'zzcx_wx_20160425', | |||
'appsecret' => '7c1b14020e87e9e213696e870da0e549',//secret | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1329733601/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1329733601/apiclient_key.pem'//证书密钥pem格式 | |||
], | |||
//昆山微信配置 | |||
'wx81ac156a5c166881' => [ | |||
//web版微信支付 | |||
'appid' => 'wx81ac156a5c166881',//微信开放平台审核通过的应用APPID | |||
'appName' => '昆旅集散中心',//名称 | |||
'mch_id' => '1503844711',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'sEr2ymgpy6VHijrj3bCAmhKiFXiXny4P',//秘钥 | |||
'token'=> 'zzcx_wx_20160425', | |||
'appsecret' => 'f0c874a1f9cfed8c5a4a2ac024f4acf8',//secret | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1503844711/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1503844711/apiclient_key.pem'//证书密钥pem格式 | |||
], | |||
//舟山微信配置 | |||
'wx0376620fe134cef0' => [ | |||
//web版微信支付 | |||
'appid' => 'wx0376620fe134cef0',//微信开放平台审核通过的应用APPID | |||
'appName' => '舟山群岛旅游服务中心',//名称 | |||
'mch_id' => '1515696111',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'k3HVaO77fIBajgjdf69pRhXnkPCHxsHb',//秘钥 | |||
'token'=> 'kslv_wx_2018058', | |||
'appsecret' => 'df92d376e296d85e676be45035aba285',//secret | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1515696111/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1515696111/apiclient_key.pem'//证书密钥pem格式 | |||
], | |||
//快行微信配置 | |||
'wxf5d1e7e3317bb073' => [ | |||
//web版微信支付 | |||
'appid' => 'wxf5d1e7e3317bb073',//微信开放平台审核通过的应用APPID | |||
'appName' => '快行漫游',//名称 | |||
'mch_id' => '1229862102',//微信支付分配的商户号 | |||
'device_info' => 'WEB',//终端设备号(门店号或收银设备ID),默认请传"WEB" | |||
'key' => 'qaH3kBO22G32DBD5B12Dgg4GNg4N1Jxk',//秘钥 | |||
'token'=> 'KXMYDYJ', | |||
'appsecret' => 'cec585fe804ede285f07a2f0093f2109',//secret | |||
'SSLCERT_PATH' => __DIR__ . '/cert/1229862102/apiclient_cert.pem',//证书pem格式 | |||
'SSLKEY_PATH' => __DIR__ . '/cert/1229862102/apiclient_key.pem'//证书密钥pem格式 | |||
] | |||
]; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 运游通 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'type' => 'news',//类型 图文 | |||
'id' => 'AuXDjP791-NMcyJajUxBL0jmNmYMjTJ6fTQTEQV8Gh8', | |||
'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
'unsubscribe' => array(//用户取消关注 | |||
'function' => 'unsubscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
); |
@@ -0,0 +1,40 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 运游通 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '您的问题已经光速飞向客服小通,请耐心等待我们的回复,谢谢~', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:025-85477639', | |||
); |
@@ -0,0 +1,51 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 运游通 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://wx.zhizhuchuxing.com/web/zzcx/travel_book.html?version=3.0&fx_uid=0" | |||
}, | |||
{ | |||
"name":"我的行程", | |||
"type":"view", | |||
"url":"http://wx.zhizhuchuxing.com/web/zzcx/trip_list.html?version=1.0&fx_uid=0" | |||
}, | |||
{ | |||
"name":"更多服务", | |||
"sub_button":[ | |||
{ | |||
"type":"view", | |||
"name":"用户中心", | |||
"url":"http://wx.zhizhuchuxing.com/web/zzcx/my_center.html?version=3.0&fx_uid=0" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"目的地", | |||
"url":"http://wx.zhizhuchuxing.com/web/zzcx/end_area_list.html?version=3.0&fx_uid=0" | |||
}, | |||
{ | |||
"type":"click", | |||
"name":"联系客服", | |||
"key":"MSG_LIANXIKEFU" | |||
}] | |||
}] | |||
}'; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'text' => '亲,感谢您对千岛湖旅游集散中心的支持,点击预订即可订购产品,如有问题请第一时间联系我们!官方电话400-105-1078', | |||
// 'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
// 'unsubscribe' => array(//用户取消关注 | |||
// 'function' => 'unsubscribe'//该推送消息出发时 | |||
// ), | |||
// 'contact_customer' => '亲,我们的电话是025-85477639,随时等候您的来电,非工作时间如客服电话无人接听,欢迎您在公众号留言,我们将在上班后第一时间与您联系。', | |||
); |
@@ -0,0 +1,60 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '亲,感谢您对千岛湖旅游集散中心的支持,点击预订即可订购产品,如有问题请第一时间联系我们!官方电话400-105-1078', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:021-52218088', | |||
'test' => array( | |||
'text' => '蜘蛛分销测试fx.zhizhuchuxing.cn | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
千岛湖分销分销测试qdhfx.zhizhuchuxing.cn | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
', | |||
) | |||
); |
@@ -0,0 +1,32 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://qdhfx.zhizhuchuxing.com/web/fx/reserve_prod.html?m=2" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"二维码", | |||
"url":"http://qdhfx.zhizhuchuxing.com/web/fx/eticket.html?m=2" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"个人中心", | |||
"url":"http://qdhfx.zhizhuchuxing.com/web/fx/my_commission.html?m=2" | |||
}] | |||
}'; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'text' => '亲,感谢您对蜘蛛分销的支持,点击预订即可帮助客户订购产品,有问题请第一时间联系我们!', | |||
// 'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
// 'unsubscribe' => array(//用户取消关注 | |||
// 'function' => 'unsubscribe'//该推送消息出发时 | |||
// ), | |||
// 'contact_customer' => '亲,我们的电话是025-85477639,随时等候您的来电,非工作时间如客服电话无人接听,欢迎您在公众号留言,我们将在上班后第一时间与您联系。', | |||
); |
@@ -0,0 +1,60 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '您的问题已经光速飞向客服,请耐心等待我们的回复,谢谢~', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:021-52218088', | |||
'test' => array( | |||
'text' => '蜘蛛分销测试fx.zhizhuchuxing.cn | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
千岛湖分销分销测试qdhfx.zhizhuchuxing.cn | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
', | |||
) | |||
); |
@@ -0,0 +1,32 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/reserve_prod.html?m=2" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"二维码", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/eticket.html?m=2" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"个人中心", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/my_commission.html?m=2" | |||
}] | |||
}'; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'text' => '亲,感谢您对蜘蛛分销的支持,点击预订即可帮助客户订购产品,有问题请第一时间联系我们!', | |||
// 'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
// 'unsubscribe' => array(//用户取消关注 | |||
// 'function' => 'unsubscribe'//该推送消息出发时 | |||
// ), | |||
// 'contact_customer' => '亲,我们的电话是025-85477639,随时等候您的来电,非工作时间如客服电话无人接听,欢迎您在公众号留言,我们将在上班后第一时间与您联系。', | |||
); |
@@ -0,0 +1,60 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '您的问题已经光速飞向客服,请耐心等待我们的回复,谢谢~', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:021-52218088', | |||
'test' => array( | |||
'text' => '蜘蛛分销测试fx.zhizhuchuxing.cn | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
千岛湖分销分销测试qdhfx.zhizhuchuxing.cn | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
', | |||
) | |||
); |
@@ -0,0 +1,32 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/reserve_prod.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"二维码", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/eticket.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"个人中心", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/my_commission.html?m=3.3" | |||
}] | |||
}'; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'text' => '亲,感谢您对蜘蛛分销的支持,点击预订即可帮助客户订购产品,有问题请第一时间联系我们!', | |||
// 'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
// 'unsubscribe' => array(//用户取消关注 | |||
// 'function' => 'unsubscribe'//该推送消息出发时 | |||
// ), | |||
// 'contact_customer' => '亲,我们的电话是025-85477639,随时等候您的来电,非工作时间如客服电话无人接听,欢迎您在公众号留言,我们将在上班后第一时间与您联系。', | |||
); |
@@ -0,0 +1,60 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '您的问题已经光速飞向客服,请耐心等待我们的回复,谢谢~', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:021-52218088', | |||
'test' => array( | |||
'text' => '蜘蛛分销测试fx.zhizhuchuxing.cn | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
千岛湖分销分销测试qdhfx.zhizhuchuxing.cn | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
', | |||
) | |||
); |
@@ -0,0 +1,32 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/reserve_prod.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"二维码", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/eticket.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"个人中心", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/my_commission.html?m=3.3" | |||
}] | |||
}'; |
@@ -0,0 +1,30 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'subscribe' => array(//用户关注 | |||
'text' => '亲,感谢您对蜘蛛分销的支持,点击预订即可帮助客户订购产品,有问题请第一时间联系我们!', | |||
// 'function' => 'subscribe'//该推送消息出发时 会调用 addUser方法 方法存在于 WxDoFunction.php文件中 | |||
), | |||
// 'unsubscribe' => array(//用户取消关注 | |||
// 'function' => 'unsubscribe'//该推送消息出发时 | |||
// ), | |||
// 'contact_customer' => '亲,我们的电话是025-85477639,随时等候您的来电,非工作时间如客服电话无人接听,欢迎您在公众号留言,我们将在上班后第一时间与您联系。', | |||
); |
@@ -0,0 +1,60 @@ | |||
<?php | |||
/** | |||
* 微信消息推送配置文件 请注意编码格式 一定要使用utf8 | |||
* 参数说明: | |||
* type 推送消息类型 分为:news:图文 video:视频 img:图片 voice:语音 这四类以数组来配置 文字类型则直接配字符串就行 | |||
* id 素材ID 对应微信公众平台的素材 如要知道各个素材请访问 xxx.xxx.xx/module/wxInterface/getMedia?type=xxx | |||
*title 标题 只有视频才需要 | |||
*des 简介 只有视频才需要 | |||
*function 执行方法 当推送该消息时就会执行 WxDoFunction.php 中的该方法 如欢迎语时就会触发添加用户 addUser | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm WxText.config.php | |||
* Create By 2017/1/4 15:09 $ | |||
*/ | |||
return array( | |||
'default' => '您的问题已经光速飞向客服,请耐心等待我们的回复,谢谢~', | |||
'视频' => array(//小视频 | |||
'type' => 'video',//类型 视频 | |||
'id' => 'FGV6tMS6FSixJwrxoMgyABc3P_bfmnEt8qUV3-J_M1s',//media_id | |||
'title' => '小视频',//标题 | |||
'des' => '笑笑小视频'//简介 | |||
), | |||
'音乐' => array( | |||
'type' => 'voice', | |||
'id' => 'FGV6tMS6FSixJwrxoMgyAAitkX-PSTZ5LWDyPdlJuGg' | |||
), | |||
'图片' => array( | |||
'type' => 'img', | |||
'id' => 'W1Po9FbHCDVcAZS-XYBWuJxBKRG2FbvqetpfRVw9E98' | |||
), | |||
'客服' => '客服热线:021-52218088', | |||
'test' => array( | |||
'text' => '蜘蛛分销测试fx.zhizhuchuxing.cn | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://fx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
千岛湖分销分销测试qdhfx.zhizhuchuxing.cn | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/reserve_prod.html">出行预订</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/eticket.html"> 二维码 </a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/fx/my_commission.html"> 我的佣金</a> | |||
<a href="http://qdhfx.zhizhuchuxing.cn/web/shop/reserve_prod.html"> C端出行预订</a> | |||
', | |||
) | |||
); |
@@ -0,0 +1,32 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm wxMenu.config.php | |||
* Create By 2017/1/4 16:40 $ | |||
*/ | |||
return '{ | |||
"button":[ | |||
{ | |||
"name":"出行预订", | |||
"type":"view", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/reserve_prod.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"二维码", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/eticket.html?m=3.3" | |||
}, | |||
{ | |||
"type":"view", | |||
"name":"个人中心", | |||
"url":"http://fx.zhizhuchuxing.com/web/fx/my_commission.html?m=3.3" | |||
}] | |||
}'; |
@@ -0,0 +1,104 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "base_category". | |||
* | |||
* @property integer $category_id | |||
* @property string $category_name | |||
* @property integer $parent_id | |||
* @property integer $delete_flag | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property string $update_user | |||
*/ | |||
class BaseCategory extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'base_category'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['category_name'], 'required'], | |||
[['parent_id', 'delete_flag'], 'integer'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['category_name'], 'string', 'max' => 255], | |||
[['update_user'], 'string', 'max' => 50], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'category_id' => 'Category ID', | |||
'category_name' => 'Category Name', | |||
'parent_id' => 'Parent ID', | |||
'delete_flag' => 'Delete Flag', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'update_user' => 'Update User', | |||
]; | |||
} | |||
/** | |||
* Function Description:获取基础数组信息 | |||
* Function Name: getTypeArr | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getTypeArr(){ | |||
$result=$this::find()->select(['category_id','category_name']) | |||
->from(self::tableName()) | |||
->where(['=','delete_flag',0]) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des:获取 | |||
* Name: getAllList | |||
* @return array|\yii\db\ActiveRecord[] | |||
* @author 倪宗锋 | |||
*/ | |||
public function getAllList() | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des:获取页面展示的订单类型 | |||
* Name: getShowList | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getShowList() | |||
{ | |||
$result = self::find()->select(['category_id as order_type_id','category_name as order_type_des']) | |||
->from(self::tableName()) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
} |
@@ -0,0 +1,305 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
use yii\db\Exception; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "bus_ticket". | |||
* | |||
* @property integer $ticket_id | |||
* @property integer $start_area_id | |||
* @property string $start_area_name | |||
* @property integer $end_area_id | |||
* @property string $end_area_name | |||
* @property integer $start_res_id | |||
* @property string $start_res_name | |||
* @property integer $end_res_id | |||
* @property string $end_res_name | |||
* @property integer $line_id | |||
* @property integer $line_type | |||
* @property string $prod_price | |||
* @property string $line_name | |||
*/ | |||
class BusTicket extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'bus_ticket'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['ticket_id'], 'required'], | |||
[['ticket_id', 'start_area_id', 'end_area_id', 'start_res_id', 'end_res_id', 'line_id', 'line_type'], 'integer'], | |||
[['prod_price', 'start_res_longitude', 'start_res_latitude', 'end_res_longitude', 'end_res_latitude'], 'number'], | |||
[['start_area_name', 'end_area_name', 'start_res_name', 'end_res_name'], 'string', 'max' => 50], | |||
[['line_name'], 'string', 'max' => 255], | |||
[['ticket_id'], 'unique'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'ticket_id' => 'Ticket ID', | |||
'start_area_id' => 'Start Area ID', | |||
'start_area_name' => 'Start Area Name', | |||
'end_area_id' => 'End Area ID', | |||
'end_area_name' => 'End Area Name', | |||
'start_res_id' => 'Start Res ID', | |||
'start_res_name' => 'Start Res Name', | |||
'end_res_id' => 'End Res ID', | |||
'end_res_name' => 'End Res Name', | |||
'line_id' => 'Line ID', | |||
'line_type' => 'Line Type', | |||
'prod_price' => 'Prod Price', | |||
'line_name' => 'Line Name', | |||
'start_LONGITUDE' => 'start_LONGITUDE', | |||
'start_LATITUDE' => 'start_LATITUDE', | |||
'end_LONGITUDE' => 'end_LONGITUDE', | |||
'end_LATITUDE' => 'end_LATITUDE' | |||
]; | |||
} | |||
public function insertBus($ticket_arr) | |||
{ | |||
foreach ($ticket_arr as $val) { | |||
$this->isNewRecord = true; | |||
$this->setAttributes($val); | |||
$this->save(); | |||
} | |||
} | |||
/** | |||
* Function Description:新增可售票种的操作 | |||
* Function Name: istBusTicket | |||
* @param $ticket_arr | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function istBusTicket($ticket_arr) | |||
{ | |||
$prod_category_1 = new ProdCategory(); | |||
$prod_main_1 = new ProdMain(); | |||
foreach ($ticket_arr as $val) { | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
//***************************************插入bus_ticket表************************************************** | |||
$this->isNewRecord = true; | |||
$this->setAttributes($val); | |||
$res = $this->save(); | |||
if ($res === false) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
//***************************************插入prod_category表************************************************** | |||
$tmp_pro_name = $val['line_name'] . "({$val['start_res_name']}-{$val['end_res_name']})"; | |||
$value = [ | |||
'category_id' => '1', | |||
'pro_cate_name' => $tmp_pro_name, | |||
'bus_ticket_id' => $val['ticket_id'], | |||
'bus_line_type' => $val['line_type'], | |||
'create_time' => date('Y-m-d H:i:s'), | |||
'show_price' => $val['prod_price'], | |||
'commission' => 5, | |||
]; | |||
$prod_category = clone $prod_category_1; | |||
$prod_category->attributes = $value; | |||
$prod_res = $prod_category->insert(); | |||
if ($prod_res === false) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
//***************************************插入prod_main表************************************************** | |||
$value_adult = [ | |||
'prod_cate_id' => $prod_category->pro_cate_id, | |||
'prod_price' => $val['prod_price'], | |||
'bus_id' => $val['ticket_id'], | |||
'prod_name' => '成人票', | |||
'create_time' => date('Y-m-d H:i:s') | |||
]; | |||
$prod_main = clone $prod_main_1; | |||
$prod_main->attributes = $value_adult; | |||
$prod_main_res = $prod_main->insert(); | |||
if ($prod_main_res === false) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
$value_child = [ | |||
'prod_cate_id' => $prod_category->pro_cate_id, | |||
'prod_price' => $val['prod_price'], | |||
'bus_id' => $val['ticket_id'], | |||
'prod_name' => '儿童票', | |||
'create_time' => date('Y-m-d H:i:s') | |||
]; | |||
$prod_main_2 = clone $prod_main_1; | |||
$prod_main_2->attributes = $value_child; | |||
$prod_main_res_2 = $prod_main_2->insert(); | |||
if ($prod_main_res_2 === false) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
$transaction->commit(); | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
} | |||
} | |||
return true; | |||
} | |||
/** | |||
* Function Description:cs系统取消的票种处理 | |||
* Function Name: delBusTicket | |||
* @param $ticket_arr | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function delBusTicket($ticket_arr) | |||
{ | |||
$prod_category = new ProdCategory(); | |||
$prod_main = new ProdMain(); | |||
foreach ($ticket_arr as $val) { | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
//物理删除bus_ticket表 | |||
$this->deleteAll(['ticket_id' => $val['ticket_id']]); | |||
//***************************************改变prod_category表状态位************************************************** | |||
$count = $prod_category::updateAll(['delete_flag' => 1], ['=', 'bus_ticket_id', $val['ticket_id']]); | |||
if (!$count) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
//***************************************改变prod_main表状态位************************************************** | |||
$count = $prod_main::updateAll(['delete_flag' => 1], ['=', 'bus_id', $val['ticket_id']]); | |||
if (!$count) { | |||
$transaction->rollBack(); | |||
continue; | |||
} | |||
$transaction->commit(); | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des:激活已售卖的产品 | |||
* Name: assocBusTicket | |||
* @param $ticket_arr | |||
* @return bool | |||
* @throws \yii\db\Exception | |||
* @author 倪宗锋 | |||
*/ | |||
public function assocBusTicket($ticket_arr) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
$prod_category = new ProdCategory(); | |||
foreach ($ticket_arr as $val) { | |||
//***************************************修改bus_ticket表现有记录************************************************** | |||
self::updateAll($val, ['=', 'ticket_id', $val['ticket_id']]); | |||
//***************************************改变prod_category表状态位************************************************** | |||
$prod_category::updateAll(['delete_flag' => 0], ['=', 'bus_ticket_id', $val['ticket_id']]);//不论是否成功 | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} | |||
/** | |||
* Function Description:查返程票种id对应的产品id | |||
* Function Name: getBackTicketId | |||
* @param $ticket_id | |||
* | |||
* @return mixed | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getBackTicketId($ticket_id) | |||
{ | |||
$result = self::find()->select(['c.pro_cate_id']) | |||
->from(self::tableName() . ' as a') | |||
->innerJoin('bus_ticket b', 'a.end_res_name=b.start_res_name and a.start_res_name=b.end_res_name') | |||
->innerJoin('prod_category c', 'a.ticket_id=c.bus_ticket_id') | |||
->where(['b.ticket_id' => $ticket_id]) | |||
->orderBy('a.ticket_id desc,c.pro_cate_id desc') | |||
->asArray() | |||
->one(); | |||
return $result['pro_cate_id']; | |||
} | |||
/* | |||
* 获取当前数据库所存票种信息 | |||
*/ | |||
public function getBusArr() | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->indexBy('ticket_id') | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des: | |||
* Name: getTicketAndLineByIDs | |||
* @param $ticketIds array | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getTicketAndLineByIDs($ticketIds) | |||
{ | |||
$where = [ | |||
'and', | |||
['in', 'ticket_id', $ticketIds], | |||
['=', 'b.delete_flag', 0] | |||
]; | |||
$result = self::find()->select(['a.start_res_name', 'a.start_res_id', new Expression("GROUP_CONCAT(CONCAT(ticket_id,'|',a.end_res_id,'|',a.end_res_name,'|',b.pro_cate_id) separator '||') FxTicket")]) | |||
->from(self::tableName() . ' as a') | |||
->innerJoin(ProdCategory::tableName() . ' b', 'a.ticket_id = b.bus_ticket_id') | |||
->where($where) | |||
->groupBy('a.start_res_id') | |||
->indexBy('start_res_id') | |||
->asArray() | |||
->all(); | |||
if (empty($result)) { | |||
return []; | |||
} | |||
foreach ($result as $key => $val) {//拼接成以起始站为中心的数组 | |||
$result[$key]['end_station_list'] = []; | |||
$ticketArr = explode('||', $val['FxTicket']); | |||
foreach ($ticketArr as $val1) { | |||
$theArr = explode('|', $val1); | |||
if (count($theArr) == 4) { | |||
$theArr1['ticket_id'] = $theArr[0]; | |||
$theArr1['end_res_id'] = $theArr[1]; | |||
$theArr1['end_res_name'] = $theArr[2]; | |||
$theArr1['pro_cate_id'] = $theArr[3]; | |||
$result[$key]['end_station_list'][$theArr[0]] = $theArr1; | |||
} | |||
} | |||
unset($result[$key]['FxTicket']); | |||
} | |||
return $result; | |||
} | |||
} |
@@ -0,0 +1,121 @@ | |||
<?php | |||
namespace common\models; | |||
use admin\util\AdminUtil; | |||
use Yii; | |||
/** | |||
* This is the model class for table "cms_category". | |||
* | |||
* @property integer $cms_category_id | |||
* @property string $category_name | |||
* @property integer $show_sort | |||
* @property integer $delete_flag | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property string $update_user | |||
*/ | |||
class CmsCategory extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'cms_category'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['category_name'], 'required'], | |||
[['show_sort', 'delete_flag'], 'integer'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['category_name', 'update_user'], 'string', 'max' => 50], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'cms_category_id' => 'Cms Category ID', | |||
'category_name' => 'Category Name', | |||
'show_sort' => 'Show Sort', | |||
'delete_flag' => 'Delete Flag', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'update_user' => 'Update User', | |||
]; | |||
} | |||
/** | |||
* Function Description:cms添加产品信息 | |||
* Function Name: addCmsProd | |||
* @param $param | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function addCmsProd($param){ | |||
$transaction=Yii::$app->db->beginTransaction(); | |||
if($param['cms_category_id']==0){ | |||
//新增栏目 | |||
$connection=Yii::$app->db; | |||
$istCount=$connection->createCommand()->insert('cms_category', [ | |||
'update_user' => AdminUtil::$uid, | |||
'show_sort' => 6, | |||
'category_name'=>$param['cms_category_name'], | |||
'create_time'=>date('Y-m-d H:i:s') | |||
])->execute(); | |||
if($istCount!=1){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
}; | |||
$values=[ | |||
'cms_cate_id'=>$param['cms_category_id']==0 ? $connection->getLastInsertID() : $param['cms_category_id'], | |||
'prod_cate_id'=>$param['prod_cate_id'], | |||
'create_time'=>date('Y-m-d H:i:s'), | |||
'show_sort'=>1 | |||
]; | |||
$cms_category_prod=new CmsCategoryProd(); | |||
$cms_category_prod->attributes=$values; | |||
$res=$cms_category_prod->insert(); | |||
if(!$res){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} | |||
/** | |||
* Function Description:大类型查询 | |||
* Function Name: getCategoryArr | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getCategoryArr(){ | |||
$system = Yii::$app->params['system']; | |||
$where = [ | |||
'and', | |||
['=', 'system', $system], | |||
['=', 'delete_flag', 0] | |||
]; | |||
$result=self::find()->select(['cms_category_id','category_name']) | |||
->from(self::tableName()) | |||
->where($where) | |||
->orderBy('show_sort desc') | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
} |
@@ -0,0 +1,157 @@ | |||
<?php | |||
namespace common\models; | |||
use admin\util\AdminUtil; | |||
use Yii; | |||
use yii\base\Exception; | |||
/** | |||
* This is the model class for table "cms_category_prod". | |||
* | |||
* @property integer $id | |||
* @property integer $prod_cate_id | |||
* @property integer $cms_cate_id | |||
* @property integer $show_sort | |||
* @property integer $delete_flag | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property string $update_user | |||
*/ | |||
class CmsCategoryProd extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'cms_category_prod'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['prod_cate_id', 'cms_cate_id', 'show_sort', 'delete_flag'], 'integer'], | |||
[['cms_cate_id'], 'required'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['update_user'], 'string', 'max' => 50], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'prod_cate_id' => 'Prod Cate ID', | |||
'cms_cate_id' => 'Cms Cate ID', | |||
'show_sort' => 'Show Sort', | |||
'delete_flag' => 'Delete Flag', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'update_user' => 'Update User', | |||
]; | |||
} | |||
/** | |||
* Function Description:修改产品与左侧菜单绑定关系 | |||
* Function Name: uptCmsAdmin | |||
* @param $param | |||
* | |||
* @return bool|int | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function uptCmsAdmin($param){ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
if($param['cms_category_id']==-1){ | |||
//产品下架 | |||
$res=$this->deleteAll(['=','prod_cate_id',$param['pro_cate_id']]); | |||
if($res===false){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
}elseif($param['cms_category_id']==0){ | |||
//新增左侧菜单 | |||
$connection=Yii::$app->db; | |||
$istCount=$connection->createCommand()->insert('cms_category', [ | |||
'category_name'=>$param['cms_category_name'], | |||
'create_time'=>date('Y-m-s H:i:s'), | |||
'show_sort'=>6, | |||
'update_user'=>1 | |||
])->execute(); | |||
if($istCount!=1){ | |||
$transaction->rollBack(); | |||
return false; | |||
}; | |||
$id=Yii::$app->db->getLastInsertID(); | |||
$istCount=$connection->createCommand()->insert('cms_category_prod', [ | |||
'update_user' => AdminUtil::$uid, | |||
'show_sort' => 1000, | |||
'cms_cate_id'=>$id, | |||
'create_time'=>date('Y-m-d H:i:s'), | |||
'prod_cate_id'=>(int)$param['pro_cate_id'], | |||
])->execute(); | |||
if($istCount!=1){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
// $cms_category=new CmsCategory(); | |||
// $value=[ | |||
// 'category_name'=>$param['cms_category_name'], | |||
// 'create_time'=>date('Y-m-s H:i:s'), | |||
// 'show_sort'=>6, | |||
// 'update_user'=>1 | |||
// ]; | |||
// $cms_category->attributes=$value; | |||
// $res=$cms_category->insert(); | |||
// if(!$res){ | |||
// $transaction->rollBack(); | |||
// return false; | |||
// } | |||
}else{ | |||
//修改产品所属菜单 | |||
$prod_cate_id=self::find()->select(['count(1) as cnt'])->from(self::tableName())->where(['prod_cate_id'=>$param['pro_cate_id']])->asArray()->one(); | |||
if($prod_cate_id['cnt']!=0){//有则修改 | |||
$count = self::updateAll(['cms_cate_id'=>$param['cms_category_id'],'update_user'=>AdminUtil::$uid], ['and',['=','prod_cate_id',$param['pro_cate_id']],['=','delete_flag',0]]); | |||
if($count===false){ | |||
return false; | |||
}; | |||
}else{//没有则新增 | |||
$connection=Yii::$app->db; | |||
$istCount=$connection->createCommand()->insert('cms_category_prod', [ | |||
'update_user' => AdminUtil::$uid, | |||
'show_sort' => 1000, | |||
'cms_cate_id'=>(int)$param['cms_category_id'], | |||
'create_time'=>date('Y-m-d H:i:s'), | |||
'prod_cate_id'=>(int)$param['pro_cate_id'], | |||
])->execute(); | |||
if($istCount!=1){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
// $values=[ | |||
// 'prod_cate_id'=>(int)$param['pro_cate_id'], | |||
// 'cms_cate_id'=>(int)$param['cms_category_id'], | |||
// 'show_sort'=>1000, | |||
// 'create_time'=>date('Y-m-d H:i:s'), | |||
// 'update_user'=>AdminUtil::$uid | |||
// ]; | |||
// $this->attributes=$values; | |||
// $res=$this->insert(); | |||
// if(!$res){ | |||
// throw new Exception('添加出错'); | |||
// return false; | |||
// } | |||
} | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} | |||
} |
@@ -0,0 +1,190 @@ | |||
<?php | |||
namespace common\models; | |||
use admin\util\AdminUtil; | |||
use fx\util\FxUtil; | |||
use Yii; | |||
use yii\base\Exception; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "fx_commission_apply". | |||
* | |||
* @property integer $id | |||
* @property integer $fx_uid | |||
* @property string $apply_money | |||
* @property integer $status | |||
* @property string $remit_time | |||
* @property string $auth_time | |||
* @property string $auth_memo | |||
* @property integer $auth_uid | |||
* @property integer $remit_uid | |||
* @property integer $delete_flag | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property string $update_user | |||
*/ | |||
class FxCommissionApply extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_commission_apply'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['fx_uid'], 'required'], | |||
[['fx_uid', 'status', 'auth_uid', 'remit_uid', 'delete_flag'], 'integer'], | |||
[['apply_money'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['remit_time', 'auth_time', 'update_user'], 'string', 'max' => 50], | |||
[['auth_memo'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'fx_uid' => 'Fx Uid', | |||
'apply_money' => 'Apply Money', | |||
'status' => 'Status', | |||
'remit_time' => 'Remit Time', | |||
'auth_time' => 'Auth Time', | |||
'auth_memo' => 'Auth Memo', | |||
'auth_uid' => 'Auth Uid', | |||
'remit_uid' => 'Remit Uid', | |||
'delete_flag' => 'Delete Flag', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'update_user' => 'Update User', | |||
]; | |||
} | |||
/** | |||
* Function Description:提现明细 | |||
* Function Name: getCommissionApplyList | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getCommissionApplyList(){ | |||
$fx_uid=FxUtil::$uid; | |||
$result=self::find()->select(['apply_money','status','date_format(create_time,"%m-%d %H:%i:%s") as create_date',"if(`status`=1,'未审核','已审核') as status_desc"]) | |||
->from(self::tableName()) | |||
->where(['and',['=','fx_uid',$fx_uid],['=','delete_flag',0]]) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:提交提现申请,申请表记录 | |||
* Function Name: InsertApplyCommission | |||
* @param $apply_commission | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function InsertApplyCommission($apply_commission){ | |||
$values=[ | |||
'status'=>1, | |||
'apply_money'=>$apply_commission, | |||
'fx_uid'=>FxUtil::$uid, | |||
'create_time'=>date('Y-m-d H:i:s'), | |||
]; | |||
$transaction=Yii::$app->db->beginTransaction(); | |||
try{ | |||
$this->attributes=$values; | |||
$res=$this->insert(); | |||
if(!$res){ | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
}catch (Exception $e){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Function Description:后台提现列表 | |||
* Function Name: ApplyList | |||
* @param $param | |||
* | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function ApplyList($param){ | |||
$where=['and',['=','a.delete_flag',0]]; | |||
if ($param['apply_user_name'] != '') { | |||
$where[] = ['like', 'b.nickname', $param['apply_user_name']]; | |||
} | |||
if ($param['apply_user_phone'] != '') { | |||
$where[] = ['like', 'b.phone', $param['apply_user_phone']]; | |||
} | |||
if ($param['start_time'] != '') { | |||
$where[] = ['>=', 'a.create_time', $param['start_time']]; | |||
} | |||
if ($param['end_time'] != '') { | |||
$where[] = ['<', 'a.create_time', date('Y-m-d',strtotime("{$param['end_time']} +1 day"))]; | |||
} | |||
if ($param['apply_status'] != '') { | |||
$where[] = ['=', 'a.status', $param['apply_status']]; | |||
} | |||
$select=[ | |||
'b.nickname as apply_user_name', | |||
'b.phone as apply_user_phone', | |||
'a.apply_money', | |||
'b.openid open_id', | |||
'b.wx_openid', | |||
'(select "微信") as apply_style_des', | |||
'a.status as apply_status_id', | |||
new Expression("CASE a.status | |||
WHEN 1 THEN '待处理' | |||
WHEN 2 THEN '已审核' | |||
ELSE '' | |||
END | |||
as apply_status_des | |||
"), | |||
'a.create_time apply_create_time', | |||
'a.id as apply_id' | |||
]; | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$result=self::find()->select($select) | |||
->from(self::tableName().' as a') | |||
->leftJoin('fx_user as b','a.fx_uid=b.uid') | |||
->where($where) | |||
->orderBy('a.create_time desc') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
$count=self::find()->select('count(1) as count')->from(self::tableName().' as a')->leftJoin('fx_user as b','a.fx_uid=b.uid')->where($where)->asArray()->one(); | |||
$count=$count['count'] ; | |||
return ['list'=>$result,'count'=>$count]; | |||
} | |||
/* | |||
* 提现通过,状态变更 | |||
*/ | |||
public function applyChange($apply_id){ | |||
$count = self::updateAll(['status'=>2,'update_user'=>AdminUtil::$uid,'auth_time'=>date('Y-m-d H:i:s')], ['and', ['=', 'status', 1], ['=', 'id', $apply_id]]); | |||
return $count; | |||
} | |||
} |
@@ -0,0 +1,159 @@ | |||
<?php | |||
namespace common\models; | |||
use common\util\Util; | |||
use Yii; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "fx_commission_info". | |||
* | |||
* @property integer $id | |||
* @property integer $fx_uid | |||
* @property string $total_money | |||
* @property integer $order_id | |||
* @property integer $status | |||
* @property integer $delete_flag | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property string $update_user | |||
*/ | |||
class FxCommissionInfo extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_commission_info'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['fx_uid', 'total_money', 'order_id'], 'required'], | |||
[['fx_uid', 'order_id', 'status', 'delete_flag'], 'integer'], | |||
[['total_money'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['update_user'], 'string', 'max' => 50], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'fx_uid' => 'Fx Uid', | |||
'total_money' => 'Total Money', | |||
'order_id' => 'Order ID', | |||
'status' => 'Status', | |||
'delete_flag' => 'Delete Flag', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'update_user' => 'Update User', | |||
]; | |||
} | |||
public function finishCommission() | |||
{ | |||
$cnt = 0; | |||
$count = 0; | |||
//1.找出今天-完成日期大于3天的订单号,且佣金待结算 | |||
$LogOrder = self::find()->select(['GROUP_CONCAT(a.order_id) as order_arr']) | |||
->from('order_main as a') | |||
->leftJoin('fx_commission_info as b', 'a.order_id=b.order_id') | |||
->where(['and', ['=', 'order_status', 3], ['>', 'DATEDIFF(current_date,end_date)', 2], ['=', 'a.delete_flag', 0], ['=', 'b.`status`', 1]]) | |||
->asArray() | |||
->all(); | |||
$uptOrder = explode(',', $LogOrder[0]['order_arr']); | |||
if (empty($uptOrder['0']) == false) { | |||
//2.佣金表待结算变已结算 | |||
$count = self::updateAll(['status' => 2], ['and', ['=', 'status', 1], ['in', 'order_id', $uptOrder]]); | |||
//3.不同用户的账户表分别更新 | |||
//查出需要更新的分销账户及佣金金额 | |||
$fx_user = self::find()->select(['fx_uid', 'SUM(total_money) as money']) | |||
->from(self::tableName()) | |||
->where(['and', ['in', 'order_id', $uptOrder], ['=', 'delete_flag', 0]]) | |||
->groupBy('fx_uid') | |||
->asArray() | |||
->all(); | |||
if (count($fx_user) != 0) { | |||
$fx_user_account = new FxUserAccount(); | |||
foreach ($fx_user as $val) { | |||
$available_commission = $val['money']; | |||
$fx_uid = $val['fx_uid']; | |||
$array = ['available_commission' => new Expression("available_commission +$available_commission"), 'total_commission' => new Expression("total_commission +$available_commission")]; | |||
$cnt += $fx_user_account::updateAll($array, ['and', ['=', 'fx_uid', $fx_uid]]); | |||
} | |||
} | |||
foreach ($uptOrder as $val) { | |||
Util::interfaceZzcx(['type' => 3, 'order_id' => $val], '/zzcx/interfaces/order/send-wx-msg', 1); | |||
} | |||
Util::addOrderLog(0, 0, implode('-', $uptOrder), '佣金结算', 7); | |||
} | |||
return ['order_list' => $LogOrder[0]['order_arr'], 'count' => $count, 'cnt' => $cnt]; | |||
} | |||
/** | |||
* Function Description:佣金明细 | |||
* Function Name: getInfoAdmin | |||
* @param $order_id | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getInfoAdmin($order_id) | |||
{ | |||
$result = self::find() | |||
->from('order_info a') | |||
->innerJoin('order_main c', 'a.order_id = c.order_id') | |||
->leftJoin('prod_main b', 'a.prod_id=b.prod_id') | |||
->select(['b.prod_name', 'a.unit_price prod_single_price', 'a.count prod_count', 'a.commission' // update fuhc add b.commission on 2017-05-26 | |||
// '(select TRUNCATE(total_money/c.prod_cnt,0)*a.count from fx_commission_info where order_id =a.order_id ) as commission' | |||
]) | |||
->where(['and', ['=', 'a.order_id', $order_id], ['!=', 'a.count', 0]]) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des:根据订单ID获取佣金详细 | |||
* Name: getInfoByOrderId | |||
* @param $oder_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInfoByOrderId($oder_id) | |||
{ | |||
$orderInfo = self::find() | |||
->from(static::tableName()) | |||
->where(['=', 'order_id', $oder_id]) | |||
->asArray() | |||
->one(); | |||
return $orderInfo; | |||
} | |||
/** | |||
* Des:修改单状态 | |||
* Name: editStatus | |||
* @param $oder_id | |||
* @param $status | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function editStatus($oder_id, $status) | |||
{ | |||
$flag = self::updateAll(['status' => $status], ['=', 'order_id', $oder_id]); | |||
return $flag; | |||
} | |||
} |
@@ -0,0 +1,428 @@ | |||
<?php | |||
namespace common\models; | |||
use common\util\Util; | |||
use fx\util\FxUtil; | |||
use Yii; | |||
use yii\db\ActiveRecord; | |||
use yii\db\Exception; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "fx_user". | |||
* | |||
* @property integer $uid | |||
* @property string $user_name | |||
* @property string $openid | |||
* @property string $phone | |||
* @property string $nickname | |||
* @property string $headimgurl | |||
* @property integer $sex | |||
* @property string $country | |||
* @property string $province | |||
* @property string $city | |||
* @property integer $status | |||
* @property string $reg_time | |||
* @property integer $delete_flag | |||
* @property string $wx_openid | |||
* @property integer $main_user_id | |||
*/ | |||
class FxUser extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_user'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['openid'], 'required'], | |||
[['sex', 'status', 'delete_flag', 'main_user_id', 'change_price_power'], 'integer'], | |||
[['reg_time'], 'safe'], | |||
[['user_name'], 'string', 'max' => 100], | |||
[['openid', 'wx_openid'], 'string', 'max' => 120], | |||
[['phone'], 'string', 'max' => 11], | |||
[['nickname'], 'string', 'max' => 100], | |||
[['headimgurl', 'country', 'province', 'city', 'user_area'], 'string', 'max' => 255], | |||
[['openid'], 'unique'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'uid' => 'Uid', | |||
'user_name' => 'User Name', | |||
'openid' => 'Openid', | |||
'phone' => 'Phone', | |||
'nickname' => 'Nickname', | |||
'headimgurl' => 'Headimgurl', | |||
'sex' => 'Sex', | |||
'country' => 'Country', | |||
'province' => 'Province', | |||
'city' => 'City', | |||
'status' => 'Status', | |||
'reg_time' => 'Reg Time', | |||
'delete_flag' => 'Delete Flag', | |||
'wx_openid' => 'Wx Openid', | |||
'main_user_id' => 'Main User ID', | |||
'change_price_power' => 'change_price_power', | |||
'user_area' => 'user_area' | |||
]; | |||
} | |||
/** | |||
* Function Description:验证是否已注册手机号 | |||
* Function Name: checkPhone | |||
* | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function checkPhone() | |||
{ | |||
$cookies = Yii::$app->request->cookies; | |||
$user_id = $cookies->getValue('user_id'); | |||
$phone = self::find()->select('phone') | |||
->where(['uid' => $user_id]) | |||
->one(); | |||
return $phone; | |||
} | |||
/** | |||
* Function Description:注册手机号 | |||
* Function Name: registerPhone | |||
* @param $phone | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function registerPhone($phone) | |||
{ | |||
$values = [ | |||
'phone' => $phone | |||
]; | |||
$base_one = self::findOne(['uid' => FxUtil::$uid, 'delete_flag' => 0]); | |||
$req = "/^.*[0-9a-zA-Z_\x{4e00}-\x{9fa5}].*$/u"; | |||
if (Util::checkPattern('', $base_one->nickname, $req) == false) {//如果用户名是空则用户名设置为手机号 | |||
$values['nickname'] = $phone; | |||
} | |||
$base_one->attributes = $values; | |||
$res = $base_one->update(); | |||
if ($res === false) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des:根据openid获取用户ID | |||
* Name: getUidByOpenid | |||
* @param $openid | |||
* @return mixed|string | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInfoByOpenid($openid) | |||
{ | |||
$getUserInfo = self::find()->select(['uid', 'phone', 'status']) | |||
->where(array('openid' => $openid)) | |||
->asArray(true) | |||
->one(); | |||
if ($getUserInfo == null) { | |||
return ''; | |||
} | |||
return $getUserInfo; | |||
} | |||
/** | |||
* Des:添加用户信息 | |||
* Name: addUserFromWeChat | |||
* @param $params | |||
* @return bool | |||
* @throws \Exception | |||
* @throws bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function addUserFromWeChat($params) | |||
{ | |||
$this->setAttributes($params); | |||
$return = $this->insert(true); | |||
return $return; | |||
} | |||
/** | |||
* Des:获取用户信息 | |||
* Name: getUserInfoByUid | |||
* @param $uid | |||
* @return array|null|string|ActiveRecord | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUserInfoByUid($uid) | |||
{ | |||
$userInfo = self::find() | |||
->where(array('uid' => $uid)) | |||
->asArray(true) | |||
->one(); | |||
if ($userInfo == null) { | |||
return ''; | |||
} | |||
return $userInfo; | |||
} | |||
/** | |||
* Function Description:获取分销商列表 | |||
* Function Name: getUserList | |||
* @param $param | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getUserList($param) | |||
{ | |||
$where = ['and', ['!=', 'phone', '']]; | |||
if (empty($param['wechat_name']) == false) { | |||
$where[] = ['like', 'nickname', $param['wechat_name']]; | |||
} | |||
if (empty($param['fx_phone']) == false) { | |||
$where[] = ['like', 'phone', $param['fx_phone']]; | |||
} | |||
if (empty($param['start_reg_time']) == false) { | |||
$where[] = ['>=', 'reg_time', $param['start_reg_time']]; | |||
} | |||
if (empty($param['end_reg_time']) == false) { | |||
$where[] = ['<', 'reg_time', date('Y-m-d', strtotime("{$param['end_reg_time']} +1 day"))]; | |||
} | |||
if (empty($param['main_user_id']) == false) { | |||
$where[] = ['=', 'a.main_user_id', $param['main_user_id']]; | |||
} | |||
if (empty($param['user_area']) == false) { | |||
$where[] = ['=', 'a.user_area', $param['user_area']]; | |||
} | |||
//果运营主体非1或空,则读取自身对应的订单数据,如果运营主体为空,或者运营主体是1则读取订单运营主体是0或1的订单 | |||
$cookies = $_COOKIE; | |||
if (empty($cookies['user_main_corp']) == false && $cookies['user_main_corp'] != 1 && in_array(YII_ENV,['pro','dev'])) { | |||
$where[] = ['=', 'e.main_corp_id', $cookies['user_main_corp']]; | |||
} | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$select = [ | |||
'a.uid as fx_uid', | |||
new Expression('FORMAT(b.remaining_sum,0) as remaining_sum'), | |||
'a.nickname as wechat_name', | |||
"ifnull(a.user_name,'') user_name", | |||
'a.phone as fx_phone', | |||
'a.reg_time', | |||
'b.status as fx_status_id', | |||
"if(b.status=1,'已启用','未启用') as fx_status", | |||
'ifnull(b.total_commission,0) as total_commission', | |||
'ifnull(b.closed_commission,0) as closed_commission', | |||
'ifnull(b.available_commission,0) available_commission', | |||
'change_price_power' => new Expression("SUBSTR(change_price_power FROM 1 FOR 1)"),//巴士自由行的改价权限 | |||
'change_price_power_hotel' => new Expression("SUBSTR(change_price_power FROM 2 FOR 1)"),//酒店的改价权限 | |||
'main_user_name' => new Expression("ifnull((SELECT user_name from main_corp_user WHERE id= a.main_user_id),'')"), | |||
'main_corp_name' => new Expression("ifnull((SELECT main_corp_name from main_corp_user WHERE id= a.main_user_id),'')"), | |||
'user_area' => new Expression("ifnull((SELECT GROUP_CONCAT(area_name SEPARATOR '</br>') from fx_user_area WHERE FIND_IN_SET(area_id,a.user_area)),'')") | |||
]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' as a') | |||
->innerJoin('fx_user_account as b', ' b.fx_uid=a.uid') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id = e.id') | |||
->where($where) | |||
->orderBy('a.reg_time desc') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
$result1 = self::find()->select('count(1) as count') | |||
->from(self::tableName() . ' as a') | |||
->innerJoin('fx_user_account as b', ' b.fx_uid=a.uid') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id = e.id') | |||
->asArray() | |||
->where($where) | |||
->one(); | |||
$result1 = $result1['count']; | |||
return ['list' => $result, | |||
'count' => $result1 | |||
]; | |||
} | |||
/* | |||
* 分销商审核列表 | |||
*/ | |||
public function CheckFxUser($param) | |||
{ | |||
$where = ['and', ['=', 'a.delete_flag', '0']]; | |||
if ($param['wechat_name'] != '') { | |||
$where[] = ['like', 'a.nickname', $param['wechat_name']]; | |||
} | |||
if ($param['fx_phone'] != '') { | |||
$where[] = ['like', 'a.phone', $param['fx_phone']]; | |||
} | |||
if ($param['start_reg_time'] != '') { | |||
$where[] = ['>=', 'a.reg_time', $param['start_reg_time']]; | |||
} | |||
if ($param['end_reg_time'] != '') { | |||
$where[] = ['<', 'a.reg_time', date('Y-m-d', strtotime("{$param['end_reg_time']} +1 day"))]; | |||
} | |||
if ($param['status'] != '') { | |||
$where[] = ['=', 'a.status', $param['status']]; | |||
} | |||
if (empty($param['main_user_id']) == false) { | |||
$where[] = ['=', 'a.main_user_id', $param['main_user_id']]; | |||
} | |||
if (empty($param['user_area']) == false) { | |||
$where[] = ['=', 'a.user_area', $param['user_area']]; | |||
} | |||
//果运营主体非1或空,则读取自身对应的订单数据,如果运营主体为空,或者运营主体是1则读取订单运营主体是0或1的订单 | |||
$cookies = $_COOKIE; | |||
if (empty($cookies['user_main_corp']) == false && !in_array($cookies['user_main_corp'], [1, 34])) { | |||
$where[] = ['=', 'e.main_corp_id', $cookies['user_main_corp']]; | |||
} | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$select = [ | |||
'a.nickname', | |||
"ifnull(a.user_name,'') user_name", | |||
'a.phone', | |||
'a.reg_time', | |||
"if(a.status = 1,'审核未通过',if(a.status=2,'审核通过','待审核')) as status_type", | |||
'a.uid as fx_uid', | |||
'a.status', | |||
'main_user_name' => new Expression("ifnull((SELECT user_name from main_corp_user WHERE id= a.main_user_id),'')"), | |||
'main_corp_name' => new Expression("ifnull((SELECT main_corp_name from main_corp_user WHERE id= a.main_user_id),'')") | |||
]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' a') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id = e.id') | |||
->where($where) | |||
->orderBy('a.reg_time desc') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
$result1 = self::find()->select('count(1) as count') | |||
->from(self::tableName() . ' a') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id = e.id') | |||
->asArray() | |||
->where($where) | |||
->one(); | |||
$result1 = $result1['count']; | |||
return ['list' => $result, | |||
'count' => $result1 | |||
]; | |||
} | |||
/* | |||
* 分销商审核通过 | |||
*/ | |||
public function ThroughFxUser($fx_uid, $status) | |||
{ | |||
$count = self::updateAll(['status' => $status], ['=', 'uid', $fx_uid]); | |||
return $count; | |||
} | |||
/** | |||
* Des:修改用户名 | |||
* Name: updateUserName | |||
* @param $fx_uid | |||
* @param $user_name | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function updateUserName($fx_uid, $user_name) | |||
{ | |||
$count = self::updateAll(['user_name' => $user_name], ['=', 'uid', $fx_uid]); | |||
return $count; | |||
} | |||
/** | |||
* Des:绑定运维负责人 | |||
* Name: updateUserName | |||
* @param $fx_uid | |||
* @param $main_user_id | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function bindMainCorp($fx_uid, $main_user_id) | |||
{ | |||
$count = self::updateAll(['main_user_id' => $main_user_id], ['=', 'uid', $fx_uid]); | |||
return $count; | |||
} | |||
/** | |||
* Des:获取用户详细 | |||
* Name: getUserInfo | |||
* @param $fx_uid | |||
* @return array|null|ActiveRecord | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUserInfo($fx_uid) | |||
{ | |||
$select = [ | |||
'a.uid', | |||
'a.nickname', | |||
'a.phone', | |||
'a.main_user_id', | |||
'b.id', | |||
'b.user_name', | |||
'b.main_corp_id', | |||
'b.main_corp_name', | |||
'a.user_area' | |||
]; | |||
$info = self::find()->select($select) | |||
->from(static::tableName() . ' a') | |||
->leftJoin(MainCorpUser::tableName() . ' b', 'a.main_user_id = b.id') | |||
->where(['=', 'a.uid', $fx_uid]) | |||
->asArray() | |||
->one(); | |||
return $info; | |||
} | |||
/** | |||
* Function Description:修改用户改价权限 | |||
* Function Name: uptChangePricePower | |||
* @param $fx_uid | |||
* @param $change_price_power | |||
* @param $type | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function uptChangePricePower($fx_uid, $change_price_power, $type) | |||
{ | |||
// print_r([$type,$change_price_power,$change_price_power]);die; | |||
try { | |||
self::updateAll(['change_price_power' => new Expression("INSERT(change_price_power,$type,1,$change_price_power)")], ['=', 'uid', $fx_uid]); | |||
return true; | |||
} catch (Exception $e) { | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des:修改用户名 | |||
* Name: updateUserName | |||
* @param $fx_uid | |||
* @param $userArea | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function updateUserArea($fx_uid, $userArea) | |||
{ | |||
$count = self::updateAll(['user_area' => $userArea], ['=', 'uid', $fx_uid]); | |||
return $count; | |||
} | |||
} |
@@ -0,0 +1,226 @@ | |||
<?php | |||
namespace common\models; | |||
use fx\util\FxUtil; | |||
use Yii; | |||
use yii\base\Exception; | |||
/** | |||
* This is the model class for table "fx_user_account". | |||
* | |||
* @property integer $id | |||
* @property integer $fx_uid | |||
* @property string $available_commission | |||
* @property string $closed_commission | |||
* @property string $total_commission | |||
* @property string $apply_commission | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property integer $status | |||
* @property integer $delete_flag | |||
*/ | |||
class FxUserAccount extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_user_account'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['fx_uid'], 'required'], | |||
[['fx_uid', 'status', 'delete_flag'], 'integer'], | |||
[['available_commission', 'closed_commission', 'total_commission', 'apply_commission', 'remaining_sum'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'fx_uid' => 'Fx Uid', | |||
'available_commission' => 'Available Commission', | |||
'closed_commission' => 'Closed Commission', | |||
'total_commission' => 'Total Commission', | |||
'apply_commission' => 'Apply Commission', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'status' => 'Status', | |||
'delete_flag' => 'Delete Flag', | |||
]; | |||
} | |||
/** | |||
* Function Description:获取账户信息 | |||
* Function Name: getMyCommission | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getMyCommission($fx_uid = '') | |||
{ | |||
if (empty($fx_uid)) { | |||
$fx_uid = FxUtil::$uid; | |||
} | |||
$select = [ | |||
'a.headimgurl', | |||
'a.phone', | |||
'a.nickname', | |||
'b.status as accountStatus', | |||
'ifnull(b.available_commission,0) available_commission', | |||
'ifnull(b.total_commission,0) total_commission', | |||
'ifnull(b.apply_commission,0) apply_commission', | |||
'FORMAT(ifnull(b.remaining_sum,0),0) remaining_sum_s', | |||
'b.remaining_sum', | |||
'wx_openid' | |||
]; | |||
$result = self::find()->select($select) | |||
->from('fx_user as a') | |||
->leftJoin(self::tableName() . ' as b', 'a.uid=b.fx_uid') | |||
->where(['=', 'a.uid', $fx_uid]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
public function ApplyCommission($available_commission, $new_apply_commission) | |||
{ | |||
$values = [ | |||
'available_commission' => $available_commission, | |||
'apply_commission' => $new_apply_commission | |||
]; | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$base_one = self::findOne(['fx_uid' => FxUtil::$uid, 'delete_flag' => 0, 'status' => 1]); | |||
$base_one->attributes = $values; | |||
$res = $base_one->update(); | |||
if (!$res) { | |||
throw new Exception('修改出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
# 回滚事务 | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Function Description:分销商注册手机号后开账户 | |||
* Function Name: InsertNewUser | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function InsertNewUser() | |||
{ | |||
$values = [ | |||
'fx_uid' => FxUtil::$uid, | |||
'create_time' => date('Y-m-d H:i:s') | |||
]; | |||
$this->attributes = $values; | |||
$res = $this->insert(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/* | |||
* 提现后用户账户变化 | |||
*/ | |||
public function changeAccount($apply_id) | |||
{ | |||
$fx_info = FxCommissionApply::find()->select(['fx_uid', 'apply_money']) | |||
->from('fx_commission_apply') | |||
->where(['id' => $apply_id]) | |||
->asArray() | |||
->one(); | |||
$money = (int)$fx_info['apply_money']; | |||
$fx_uid = $fx_info['fx_uid']; | |||
$sql = "UPDATE fx_user_account | |||
set apply_commission=apply_commission -$money, | |||
closed_commission=closed_commission+$money | |||
where fx_uid=$fx_uid | |||
"; | |||
$res = $this->getDb()->createCommand($sql)->execute(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des:修改分销账户状态 | |||
* Name: changeStatus | |||
* @param $param | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function changeStatus($param) | |||
{ | |||
if ($param['fx_status_id'] == 2) { | |||
$status = 1; | |||
} else { | |||
$status = 2; | |||
} | |||
$count = self::updateAll(['status' => $status], ['=', 'fx_uid', $param['fx_uid']]); | |||
return $count; | |||
} | |||
/** | |||
* Des:扣除用户余额 | |||
* Name: changeStatus | |||
* @param $fx_uid | |||
* @param $money | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function deductAmount($fx_uid, $money) | |||
{ | |||
$sql = "UPDATE fx_user_account | |||
set remaining_sum=remaining_sum - $money | |||
where fx_uid=$fx_uid | |||
"; | |||
$res = $this->getDb()->createCommand($sql)->execute(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des:用户余额充值 | |||
* Name: changeStatus | |||
* @param $fx_uid | |||
* @param $money | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function rechargeAmount($fx_uid, $money) | |||
{ | |||
$sql = "UPDATE fx_user_account | |||
set remaining_sum=remaining_sum + $money | |||
where fx_uid=$fx_uid | |||
"; | |||
$res = $this->getDb()->createCommand($sql)->execute(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
} |
@@ -0,0 +1,107 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: admin | |||
* Date: 2017/5/4 | |||
* Time: 11:47 | |||
*/ | |||
namespace common\models; | |||
use common\util\Util; | |||
use yii\db\ActiveRecord; | |||
use yii\db\Expression; | |||
class FxUserAmountLog extends ActiveRecord | |||
{ | |||
public static function tableName() | |||
{ | |||
return 'fx_user_amount_log'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['log_id', 'fx_uid', 'trade_type'], 'integer'], | |||
[['amount', 'remaining_sum'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['msg'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'log_id' => 'log_id', | |||
'fx_uid' => 'fx_uid', | |||
'amount' => 'amount', | |||
'remaining_sum' => 'remaining_sum', | |||
'trade_type' => 'trade_type', | |||
'create_time' => 'create_time', | |||
'update_time' => 'Update Time', | |||
'msg' => 'msg', | |||
]; | |||
} | |||
/** | |||
* 添加记录 | |||
* @param $fx_uid | |||
* @param $trade_type | |||
* @param $amount | |||
* @param $msg | |||
* @return array | |||
*/ | |||
public function addLog($fx_uid, $trade_type, $amount, $remaining_sum, $msg) | |||
{ | |||
$param = [ | |||
'fx_uid' => $fx_uid, | |||
'amount' => $amount, | |||
'trade_type' => $trade_type, | |||
'remaining_sum' => $remaining_sum, | |||
'create_time' => date('Y-m-d H:i:s'), | |||
'msg' => $msg | |||
]; | |||
$this->attributes = $param; | |||
$insertFlag = $this->insert(); | |||
if (!$insertFlag) { | |||
return Util::returnArrEr('add amount_log fail!'); | |||
} | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
* 获取账户变更记录 | |||
* @param $params | |||
* @return array | |||
*/ | |||
public function getList($params) | |||
{ | |||
$offset = ($params['current_page'] - 1) * $params['page_size']; | |||
$select = [ | |||
new Expression('FORMAT(amount,0) as amount'), | |||
'trade_type', | |||
new Expression('FORMAT(remaining_sum,0) as remaining_sum'), | |||
'create_time', | |||
new Expression("if(trade_type=1,'充值',if(trade_type=2,'支出','退款')) as type_name") | |||
]; | |||
$where = ['=', 'fx_uid', $params['fx_uid']]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName()) | |||
->where($where) | |||
->orderBy('create_time DESC') | |||
->offset($offset) | |||
->limit($params['page_size']) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
} |
@@ -0,0 +1,180 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: admin | |||
* Date: 2017/5/4 | |||
* Time: 10:43 | |||
*/ | |||
namespace common\models; | |||
use common\util\Util; | |||
use yii\db\ActiveRecord; | |||
use yii\db\Expression; | |||
class FxUserAmountOrder extends ActiveRecord | |||
{ | |||
public static function tableName() | |||
{ | |||
return 'fx_user_amount_order'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['id', 'fx_uid', 'status', 'pay_type'], 'integer'], | |||
[['amount'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['recharge_order'], 'string', 'max' => 100], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'fx_uid' => 'fx_uid', | |||
'amount' => 'amount', | |||
'status' => 'status', | |||
'create_time' => 'create_time', | |||
'update_time' => 'Update Time', | |||
'recharge_order' => 'recharge_order', | |||
'pay_type' => 'pay_type' | |||
]; | |||
} | |||
/** | |||
* 添加新记录 | |||
* @param $fx_uid | |||
* @param $amount | |||
* @param $payType | |||
* @return array | |||
*/ | |||
public function addAmountOrder($fx_uid, $amount, $payType = 1) | |||
{ | |||
$params = [ | |||
'recharge_order' => 'FXA' . round(microtime(true) * 1000, 0), | |||
'fx_uid' => $fx_uid, | |||
'amount' => $amount, | |||
'pay_type' => $payType, | |||
'create_time' => date('Y-m-d H:i:s') | |||
]; | |||
$this->attributes = $params; | |||
$insertFlag = $this->insert(); | |||
if (!$insertFlag) { | |||
return Util::returnArrEr('add amount_order fail!'); | |||
} | |||
return Util::returnArrSu('', ['recharge_order' => $params['recharge_order']]); | |||
} | |||
/** | |||
* 获取列表 | |||
* @param $params | |||
* @param $type | |||
* @return array | |||
*/ | |||
public function getList($params, $type = 0) | |||
{ | |||
$where = [ | |||
'and', | |||
['=', 'fx_uid', $params['fx_uid']], | |||
['=', 'status', 2] | |||
]; | |||
if ($type == 1) { | |||
$select = ["count(1) cnt"]; | |||
$getResult = self::find()->select($select) | |||
->where($where) | |||
->orderBy('create_time DESC') | |||
->asArray() | |||
->one(); | |||
$result = $getResult['cnt']; | |||
} else { | |||
$select = [ | |||
'id', | |||
new Expression('FORMAT(amount,0) as amount'), | |||
'create_time', | |||
'recharge_order', | |||
"if(pay_type=1,'微信','支付宝') as pay_type", | |||
'fx_uid', | |||
'status' | |||
]; | |||
$offset = ($params['current_page'] - 1) * $params['page_size']; | |||
$result = self::find()->select($select) | |||
->where($where) | |||
->orderBy('create_time DESC') | |||
->offset($offset) | |||
->limit($params['page_size']) | |||
->asArray() | |||
->all(); | |||
} | |||
return $result; | |||
} | |||
/** | |||
* 获取充值记录单的详情 | |||
* @param $recharge_order | |||
* @return array | |||
*/ | |||
public function getAmountOrderInfo($recharge_order) | |||
{ | |||
$select = [ | |||
'id', | |||
'amount', | |||
'create_time', | |||
'recharge_order', | |||
"if(pay_type=1,'微信','支付宝') as pay_type", | |||
'fx_uid', | |||
'status' | |||
]; | |||
$result = self::find()->select($select) | |||
->where(['=', 'recharge_order', $recharge_order]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* 修改充值单状态 | |||
* @param $recharge_order | |||
* @param $status | |||
* @return int | |||
*/ | |||
public function updateStatus($recharge_order, $status) | |||
{ | |||
$values = [ | |||
'status' => $status | |||
]; | |||
$count = self::updateAll($values, ['and', ['=', 'recharge_order', $recharge_order]]); | |||
return $count; | |||
} | |||
/** | |||
* 获取未支付订单 | |||
* @return array | |||
*/ | |||
public function getUnPayOrder() | |||
{ | |||
$select = [ | |||
'id', | |||
'amount', | |||
'create_time', | |||
'recharge_order', | |||
"pay_type", | |||
'fx_uid', | |||
'status' | |||
]; | |||
$result = self::find()->select($select) | |||
->where(['=', 'status', 1]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "fx_user_area". | |||
* | |||
* @property integer $area_id | |||
* @property string $area_name | |||
*/ | |||
class FxUserArea extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_user_area'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['area_name'], 'required'], | |||
[['area_name'], 'string', 'max' => 100], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'area_id' => 'Area ID', | |||
'area_name' => 'Area Name', | |||
]; | |||
} | |||
/** | |||
* Des:获取用户所属区域列表 | |||
* Name: getUserAreaList | |||
* @param string $user_area | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUserAreaList($user_area = '') | |||
{ | |||
$select = [ | |||
'is_bind' => empty($user_area) ? new Expression("0") : new Expression("if(area_id in ($user_area),1,0)"), | |||
'area_id', | |||
'area_name' | |||
]; | |||
$getList = self::find()->select($select) | |||
->asArray() | |||
->all(); | |||
return $getList; | |||
} | |||
} |
@@ -0,0 +1,106 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "fx_user_qrcode". | |||
* | |||
* @property integer $id | |||
* @property integer $fx_uid | |||
* @property integer $qr_id | |||
*/ | |||
class FxUserQrcode extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_user_qrcode'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['fx_uid', 'qr_id'], 'integer'], | |||
[['qr_id'], 'unique'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'fx_uid' => 'Fx Uid', | |||
'qr_id' => 'Qr ID', | |||
]; | |||
} | |||
/** | |||
* Des:根据qrId获取详细 | |||
* Name: getInfoByQrId | |||
* @param $qrCodeId | |||
* @return array|null|\yii\db\ActiveRecord | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInfoByQrId($qrCodeId) | |||
{ | |||
$where = ['=', 'qr_id', $qrCodeId]; | |||
$select = ['fx_uid', 'qr_id']; | |||
$getInfo = self::find()->select($select) | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
return $getInfo; | |||
} | |||
/** | |||
* Des:添加新记录 | |||
* Name: addNew | |||
* @param $qrCodeId | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function addNew($qrCodeId) | |||
{ | |||
$params = [ | |||
'qr_id' => $qrCodeId, | |||
'fx_uid' => 0 | |||
]; | |||
$this->setAttributes($params); | |||
$return = $this->insert(false); | |||
return $return; | |||
} | |||
/** | |||
* Des:获取所有列表数据 | |||
* Name: getList | |||
* @return array|\yii\db\ActiveRecord[] | |||
* @author 倪宗锋 | |||
*/ | |||
public function getList() | |||
{ | |||
$select = [ | |||
'a.fx_uid', | |||
'a.qr_id', | |||
'img_url' => new Expression("concat('/web/fx/images/FxQrCode/',a.qr_id,'.jpg')"), | |||
'nickname' => new Expression("if(b.nickname is null,'未设置',concat(b.nickname,' - ',b.phone))") | |||
]; | |||
$getList = self::find()->select($select) | |||
->from(static::tableName().' a') | |||
->leftJoin(FxUser::tableName().' b','a.fx_uid = b.uid') | |||
->asArray() | |||
->all(); | |||
return $getList; | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "log_order". | |||
* | |||
* @property integer $id | |||
* @property string $name | |||
* @property integer $order_id | |||
* @property string $time | |||
* @property integer $uid | |||
* @property integer $u_type | |||
* @property integer $log_type | |||
*/ | |||
class LogOrder extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'log_order'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['order_id', 'uid', 'u_type', 'log_type'], 'integer'], | |||
[['time'], 'safe'], | |||
[['name'], 'string', 'max' => 20], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'name' => 'Name', | |||
'order_id' => 'Order ID', | |||
'time' => 'Time', | |||
'uid' => 'Uid', | |||
'u_type' => 'U Type', | |||
'log_type' => 'Log Type', | |||
]; | |||
} | |||
/** | |||
* Des:获取订单日志列表 | |||
* Name: getOrderLog | |||
* @param $order_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getOrderLog($order_id) | |||
{ | |||
$where = ['=', 'order_id',$order_id]; | |||
$select = [ | |||
'name', | |||
'time', | |||
'log_type' | |||
]; | |||
$getList = self::find()->select($select) | |||
->where($where) | |||
->asArray(true) | |||
->all(); | |||
if (empty($getList)) { | |||
return []; | |||
} | |||
return $getList; | |||
} | |||
} |
@@ -0,0 +1,141 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "log_user_operation". | |||
* | |||
* @property integer $id | |||
* @property string $title | |||
* @property string $memo | |||
* @property integer $uid | |||
* @property integer $user_type | |||
* @property string $user_name | |||
* @property integer $resources_id | |||
* @property integer $resources_type | |||
* @property string $resources_name | |||
* @property string $phpsessid | |||
* @property string $user_agent | |||
* @property string $create_time | |||
*/ | |||
class LogUserOperation extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'log_user_operation'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['title', 'memo', 'user_name'], 'required'], | |||
[['memo'], 'string'], | |||
[['uid', 'user_type', 'resources_id', 'resources_type'], 'integer'], | |||
[['create_time'], 'safe'], | |||
[['title'], 'string', 'max' => 120], | |||
[['user_name', 'resources_name', 'phpsessid', 'user_agent','last_login'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'title' => 'Title', | |||
'memo' => 'Memo', | |||
'uid' => 'Uid', | |||
'user_type' => 'User Type', | |||
'user_name' => 'User Name', | |||
'resources_id' => 'Resources ID', | |||
'resources_type' => 'Resources Type', | |||
'resources_name' => 'Resources Name', | |||
'phpsessid' => 'Phpsessid', | |||
'user_agent' => 'User Agent', | |||
'create_time' => 'Crate Time', | |||
'last_login' => 'last_login' | |||
]; | |||
} | |||
public function getList($param, $type) | |||
{ | |||
//where条件 | |||
$where = ['and']; | |||
if ($param['user_name'] != '') { | |||
$where[] = ['=', 'user_name', $param['user_name']]; | |||
} | |||
if ($param['title'] != '') { | |||
$where[] = ['like', 'title', $param['title']]; | |||
} | |||
if ($param['resource_id'] != '') { | |||
$where[] = ['=', 'resources_id', $param['resource_id']]; | |||
} | |||
if ($param['create_time_start'] != '') { | |||
$where[] = ['>=', 'create_time', $param['create_time_start']]; | |||
} | |||
if ($param['create_time_end'] != '') { | |||
$where[] = ['<', 'create_time', date('Y-m-d', strtotime("{$param['create_time_end']} +1 day"))]; | |||
} | |||
if ($type == 1) {//获取count | |||
$select = ["count(1) cnt"]; | |||
$result = self::find()->select($select) | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
return $result['cnt']; | |||
} else {//获取列表 | |||
//查询字段 | |||
$select = [ | |||
'id', | |||
'title', | |||
'memo' , | |||
'uid' , | |||
'user_type', | |||
'user_name', | |||
'resources_id'=>new Expression("if(resources_id=0,' - ',resources_id)"), | |||
'resources_type', | |||
'resources_name', | |||
'phpsessid', | |||
'user_agent', | |||
'create_time', | |||
'last_login', | |||
new Expression("CASE user_type | |||
WHEN 1 THEN '管理员' | |||
WHEN 2 THEN '分销商' | |||
WHEN 3 THEN '客户' | |||
WHEN 4 THEN 'CS管理员' | |||
ELSE '-' | |||
END | |||
as user_type_name | |||
"), | |||
new Expression("CASE resources_type | |||
WHEN 1 THEN '产品' | |||
WHEN 2 THEN '订单' | |||
ELSE '-' | |||
END | |||
as resources_type_name | |||
") | |||
]; | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$result = self::find()->select($select) | |||
->where($where) | |||
->orderBy('create_time DESC') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "main_corp_user". | |||
* | |||
* @property integer $id | |||
* @property string $user_name | |||
* @property integer $main_corp_id | |||
* @property string $main_corp_name | |||
*/ | |||
class MainCorpUser extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'main_corp_user'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['main_corp_id'], 'integer'], | |||
[['user_name', 'main_corp_name'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'user_name' => 'User Name', | |||
'main_corp_id' => 'Main Corp ID', | |||
'main_corp_name' => 'Main Corp Name', | |||
]; | |||
} | |||
/** | |||
* Des:根据主体获取运营负责人列表 | |||
* Name: getListForUserMianCorp | |||
* @author 倪宗锋 | |||
*/ | |||
public function getListForUserMainCorp() | |||
{ | |||
$where = []; | |||
$cookies = $_COOKIE; | |||
if (empty($cookies['user_main_corp'])== false && $cookies['user_main_corp'] != 1) { | |||
$where = ['=', 'main_corp_id', $cookies['user_main_corp']]; | |||
} | |||
$list = self::find()->where($where)->asArray()->all(); | |||
return $list; | |||
} | |||
} |
@@ -0,0 +1,131 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "order_contacts". | |||
* | |||
* @property integer $id | |||
* @property integer $order_id | |||
* @property string $contacts_name | |||
* @property string $contacts_phone | |||
* @property string $contacts_ID | |||
* @property integer $contacts_type | |||
* @property string $update_time | |||
* @property string $create_time | |||
* @property integer $delete_flag | |||
* @property integer $bus_run_id | |||
*/ | |||
class OrderContacts extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'order_contacts'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['order_id', 'contacts_name'], 'required'], | |||
[['order_id', 'contacts_type', 'delete_flag', 'bus_run_id'], 'integer'], | |||
[['update_time', 'create_time'], 'safe'], | |||
[['contacts_name'], 'string', 'max' => 120], | |||
[['contacts_phone', 'contacts_ID'], 'string', 'max' => 20], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'order_id' => 'Order ID', | |||
'contacts_name' => 'Contacts Name', | |||
'contacts_phone' => 'Contacts Phone', | |||
'contacts_ID' => 'Contacts ID', | |||
'contacts_type' => 'Contacts Type', | |||
'update_time' => 'Update Time', | |||
'create_time' => 'Create Time', | |||
'delete_flag' => 'Delete Flag', | |||
'bus_run_id' => 'Bus Run ID', | |||
]; | |||
} | |||
/** | |||
* Function Description:插入联系人表 | |||
* Function Name: insertContacts | |||
* @param $param_arr | |||
* @param $orderId | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function insertContacts($param_arr, $orderId) | |||
{ | |||
$values = [ | |||
'order_id' => $orderId, | |||
'contacts_name' => $param_arr['contacts_name'], | |||
'contacts_phone' => $param_arr['contacts_phone'], | |||
'contacts_ID' => empty($param_arr['contacts_ID']) ? '' : $param_arr['contacts_ID'], | |||
'bus_run_id' => empty($param_arr['run_id']) ? 0 : $param_arr['run_id'], | |||
'create_time' => date('Y-m-d H:i:s'), | |||
]; | |||
$this->attributes = $values; | |||
$res = $this->insert(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des:获取订单拓展信息 | |||
* Name: getRowByOrderId | |||
* @param $orderId | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getRowByOrderId($orderId) | |||
{ | |||
$where = ['and']; | |||
$where[] = ['=', 'order_id', $orderId]; | |||
$where[] = ['=', 'contacts_type', 1]; | |||
$return = $this->find()->select(['contacts_name', 'contacts_phone', 'contacts_ID', 'contacts_type', 'bus_run_id', 'order_id']) | |||
->from(static::tableName()) | |||
->where($where) | |||
->asArray(true) | |||
->one(); | |||
return $return; | |||
} | |||
/** | |||
* Des:获取保险数量 | |||
* Name: getInsurance | |||
* @param $orderId | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInsuranceCnt($orderId) | |||
{ | |||
$where = ['and']; | |||
$where[] = ['=', 'order_id', $orderId]; | |||
$where[] = ['=', 'contacts_type', 2]; | |||
$return = $this->find()->select(['contacts_name', 'contacts_phone', 'contacts_ID', 'contacts_type', 'bus_run_id', 'order_id']) | |||
->from(static::tableName()) | |||
->where($where) | |||
->asArray(true) | |||
->count(); | |||
return $return; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
<?php | |||
namespace common\models; | |||
use yii\db\ActiveRecord; | |||
use yii\db\Exception; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "order_info". | |||
* | |||
* @property integer $id | |||
* @property integer $order_id | |||
* @property integer $prod_id | |||
* @property integer $count | |||
* @property string $unit_price | |||
* @property string $total price | |||
* @property integer $delete_flag | |||
*/ | |||
class OrderInfo extends ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'order_info'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['order_id', 'prod_id', 'count', 'delete_flag'], 'integer'], | |||
[['unit_price', 'total_price','commission'], 'number'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'order_id' => 'Order ID', | |||
'prod_id' => 'Prod ID', | |||
'count' => 'Count', | |||
'unit_price' => 'Unit Price', | |||
'total_price' => 'Total Price', | |||
'delete_flag' => 'Delete Flag', | |||
]; | |||
} | |||
/** | |||
* Function Description:插入子订单 | |||
* Function Name: insertInfo | |||
* @param $prod_arr | |||
* @param $oderId | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function insertInfo($prod_arr, $oderId) | |||
{ | |||
$sql = "INSERT into order_info(order_id, total_price, count, unit_price, prod_id,commission) | |||
SELECT {$oderId}, prod_price*{$prod_arr['prod_count']} price, | |||
{$prod_arr['prod_count']},prod_price,prod_id,commission | |||
from prod_main | |||
where prod_id ={$prod_arr['prod_id']}"; | |||
$res = $this->getDb()->createCommand($sql)->execute(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Function Description:获取订单佣金 | |||
* Function Name: insertInfo | |||
* @param $orderId int | |||
* @return int | |||
* @author 娄梦宁 | |||
*/ | |||
public function getOrderCommission($orderId) | |||
{ | |||
$select = [ | |||
new Expression("IFNULL(SUM(b.commission*a.count),0) 'commission'"), | |||
'order_id' | |||
]; | |||
try{ | |||
$result =self::find()->select($select) | |||
->from(self::tableName().' as a') | |||
->innerJoin(ProdMain::tableName().' as b','a.prod_id = b.prod_id') | |||
->where(['=','a.order_id',$orderId]) | |||
->asArray() | |||
->one(); | |||
}catch (Exception $e) { | |||
$result['commission'] = 0; | |||
} | |||
return $result['commission']; | |||
} | |||
/** | |||
* Des:获取产品数组 | |||
* Name: getFreeWalkProdArr | |||
* @param $order_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function geProdArr($order_id){ | |||
$select = [ | |||
'prod_id'=> 'b.bus_id', | |||
'prod_name'=> 'b.prod_name', | |||
'prod_num' => 'a.count' | |||
]; | |||
$where = ['=','a.order_id', $order_id]; | |||
$getProdArr = self::find()->select($select) | |||
->from(self::tableName().' a') | |||
->innerJoin(ProdMain::tableName().' b','a.prod_id = b.prod_id') | |||
->where($where) | |||
->asArray(true) | |||
->all(); | |||
return $getProdArr; | |||
} | |||
} |
@@ -0,0 +1,633 @@ | |||
<?php | |||
namespace common\models; | |||
use common\util\Util; | |||
use yii\db\Expression; | |||
use yii\db\ActiveRecord; | |||
/** | |||
* This is the model class for table "order_main". | |||
* | |||
* @property integer $order_id | |||
* @property string $order_name | |||
* @property string $spider_order_id | |||
* @property string $total_money | |||
* @property integer $category_id | |||
* @property integer $prod_cate_id | |||
* @property integer $prod_source | |||
* @property integer $prod_cnt | |||
* @property integer $sh_uid | |||
* @property integer $fx_uid | |||
* @property string $start_time | |||
* @property string $end_time | |||
* @property string $start_date | |||
* @property string $end_date | |||
* @property integer $order_status | |||
* @property string $update_time | |||
* @property string $create_time | |||
* @property integer $delete_flag | |||
* @property integer $system | |||
* @property string $start_area | |||
* @property string $end_area | |||
* @property integer $main_user_id | |||
*/ | |||
class OrderMain extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'order_main'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['total_money','original_price'], 'number'], | |||
[['category_id', 'prod_cate_id', 'prod_source', 'prod_cnt', 'sh_uid', 'fx_uid', 'order_status', 'delete_flag', 'system', 'main_user_id'], 'integer'], | |||
[['start_time', 'end_time', 'start_date', 'end_date', 'update_time', 'create_time'], 'safe'], | |||
[['order_name', 'spider_order_id', 'start_area', 'end_area'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'order_id' => 'Order ID', | |||
'order_name' => 'Order Name', | |||
'spider_order_id' => 'Spider Order ID', | |||
'total_money' => 'Total Money', | |||
'category_id' => 'Category ID', | |||
'prod_cate_id' => 'Prod Cate ID', | |||
'prod_source' => 'Prod Source', | |||
'prod_cnt' => 'Prod Cnt', | |||
'sh_uid' => 'Sh Uid', | |||
'fx_uid' => 'Fx Uid', | |||
'start_time' => 'Start Time', | |||
'end_time' => 'End Time', | |||
'start_date' => 'Start Date', | |||
'end_date' => 'End Date', | |||
'order_status' => 'Order Status', | |||
'update_time' => 'Update Time', | |||
'create_time' => 'Create Time', | |||
'delete_flag' => 'Delete Flag', | |||
'system' => 'System', | |||
'start_area' => 'Start Area', | |||
'end_area' => 'End Area', | |||
'main_user_id' => 'Main User ID', | |||
'original_price' => 'original_price' | |||
]; | |||
} | |||
/** | |||
* Function Description:插入主订单 | |||
* Function Name: insertOrder | |||
* @param $param_arr | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function insertOrder($param_arr) | |||
{ | |||
$values = [ | |||
'total_money' => $param_arr['total_money'], | |||
'prod_cate_id' => (int)$param_arr['pro_cate_id'], | |||
'prod_cnt' => $param_arr['prod_cnt'], | |||
'fx_uid' => $param_arr['fx_uid'], | |||
'start_date' => $param_arr['start_date'], | |||
'start_time' => $param_arr['start_time'], | |||
'sh_uid' => $param_arr['sh_uid'], | |||
'order_status' => 1, | |||
'create_time' => date('Y-m-d H:i:s'), | |||
'end_date' => date('Y-m-d', $param_arr['end_date']), | |||
'category_id' => $param_arr['category_id'] | |||
]; | |||
$this->attributes = $values; | |||
$res = $this->insert(); | |||
if (!$res) { | |||
return false; | |||
} else { | |||
return true; | |||
} | |||
} | |||
/** | |||
* Function Description:查询订单是否支付 | |||
* Function Name: getOrderStatus | |||
* @param $order_id | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getOrderStatus($order_id) | |||
{ | |||
$result = self::find()->select(['order_status']) | |||
->from(self::tableName()) | |||
->where(['and', ['=', 'order_id', $order_id], ['=', 'delete_flag', 0]]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Des:获取订单详情 | |||
* Name: getOrderInfo | |||
* @param $order_id | |||
* @return array|null|\yii\db\ActiveRecord | |||
* @author 倪宗锋 | |||
*/ | |||
public function getOrderInfo($order_id) | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['and', ['=', 'order_id', $order_id], ['=', 'delete_flag', 0]]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:分销订单列表 | |||
* Function Name: FxOrderList | |||
* @param $params array | |||
* @param $fx_uid | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function FxOrderList($fx_uid, $params) | |||
{ | |||
$where = ['and', ['=', 'a.fx_uid', $fx_uid], ['=', 'a.delete_flag', 0]]; | |||
if (!empty($params['is_refund'])) { | |||
$where[] = ['in', 'b.status', explode(',', $params['is_refund'])]; | |||
} | |||
if (!empty($params['status'])) { | |||
$where[] = ['in', 'a.order_status', explode(',', $params['status'])]; | |||
} | |||
$offset = ($params['current_page'] - 1) * $params['page_size']; | |||
$select = [ | |||
'a.order_id',//订单ID | |||
'a.order_status',//订单状态 | |||
'a.create_time',//创建时间 | |||
'a.total_money as order_total_money',//订单金额 | |||
'a.category_id',//订单类型ID | |||
'a.order_name as pro_cate_name',//产品名称 | |||
'a.start_date',//出游时间 | |||
'prod_str' => new Expression("(SELECT GROUP_CONCAT(CONCAT(y.prod_name,',,',x.count) SEPARATOR '||') from order_info x LEFT JOIN prod_main y on x.prod_id = y.prod_id WHERE x.order_id = a.order_id and x.count != 0)"), | |||
'b.status',//佣金状态 | |||
'commission_total_money' => new Expression("ifnull(b.total_money,0)"),//佣金金额 | |||
"if(b.`status`=1,'待结算',if(b.`status`=2,'已结算','已取消')) as status_desc",//佣金结算状态 | |||
'c.room_name',//房型名称 | |||
'a.prod_cnt',//产品数量 | |||
'a.end_date',//结束日期 | |||
'c.total_details',//房型名称 | |||
]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' as a') | |||
->leftJoin('fx_commission_info b', 'a.order_id=b.order_id') | |||
->leftJoin('order_hotel_extra c', 'c.main_order_id = a.order_id') | |||
->where($where) | |||
->orderBy('a.create_time DESC') | |||
->limit($params['page_size']) | |||
->offset($offset) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:获取已完成订单 | |||
* Function Name: getFinishOrder | |||
* @param $date | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getFinishOrder($date) | |||
{ | |||
$result = self::find()->select(['GROUP_CONCAT(order_id) as order_arr']) | |||
->from(self::tableName()) | |||
->where(['and', ['=', 'order_status', 2], ['<', 'end_date', $date], ['=', 'delete_flag', 0]]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:已完成订单状态变更 | |||
* Function Name: uptFinishOrder | |||
* @param $order_arr | |||
* | |||
* @return int | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function uptFinishOrder($order_arr) | |||
{ | |||
$values = [ | |||
'order_status' => 3 | |||
]; | |||
$count = self::updateAll($values, ['in', 'order_id', $order_arr]); | |||
return $count; | |||
} | |||
/** | |||
* Des:修改订单信息 | |||
* Name: upOrder | |||
* @param $value | |||
* @param $orderIds | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function upOrder($value, $orderIds) | |||
{ | |||
$count = self::updateAll($value, ['in', 'order_id', $orderIds]); | |||
return $count; | |||
} | |||
/** | |||
* Function Description:取消超时订单 | |||
* Function Name: cancelOuttimeOrder | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function cancelOuttimeOrder() | |||
{ | |||
$values = [ | |||
'order_status' => 5 | |||
]; | |||
$time = date('Y-m-d H:i:s', strtotime('-15 minute')); | |||
$count = self::updateAll($values, ['and', ['=', 'order_status', 1], ['<', 'create_time', $time]]); | |||
return $count; | |||
} | |||
/** | |||
* Des:管理后台 订单列表 获取订单列表信息 | |||
* Name: getOrderListAdm | |||
* @param $param | |||
* @param int $type | |||
* @return array|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function getOrderListAdm($param, $type = 1) | |||
{ | |||
//where条件 | |||
$where = ['and', ['!=', 'a.order_status', 1], ['!=', 'a.order_status', 5], ['=', 'a.delete_flag', 0]]; | |||
if ($param['order_id'] != '') { | |||
$where[] = ['like', 'a.order_id', $param['order_id']]; | |||
} | |||
if ($param['category_id'] != '') { | |||
$where[] = ['=', 'a.category_id', $param['category_id']]; | |||
} | |||
if ($param['create_time_start'] != '') { | |||
$where[] = ['>=', 'a.create_time', $param['create_time_start']]; | |||
} | |||
if ($param['create_time_end'] != '') { | |||
$where[] = ['<', 'a.create_time', date('Y-m-d', strtotime("{$param['create_time_end']} +1 day"))]; | |||
} | |||
if ($param['start_date_start'] != '') { | |||
$where[] = ['>=', 'a.start_date', $param['start_date_start']]; | |||
} | |||
if ($param['start_date_end'] != '') { | |||
$where[] = ['<', 'a.start_date', date('Y-m-d', strtotime("{$param['start_date_end']} +1 day"))]; | |||
} | |||
if ($param['order_status'] != '') { | |||
$where[] = ['=', 'a.order_status', $param['order_status']]; | |||
} | |||
if ($param['fx_uid'] != '') { | |||
$where[] = ['=', 'a.fx_uid', $param['fx_uid']]; | |||
} | |||
if ($param['pay_type'] != '') { | |||
$where[] = ['=', 'd.pay_type', $param['pay_type']]; | |||
} | |||
if (empty($param['user_area']) == false) { | |||
$where[] = ['=', 'g.user_area', $param['user_area']]; | |||
} | |||
//果运营主体非1或空,则读取自身对应的订单数据,如果运营主体为空,或者运营主体是1则读取订单运营主体是0或1的订单 | |||
$cookies = $_COOKIE; | |||
if (empty($cookies['user_main_corp']) == false && $cookies['user_main_corp'] != 1 && in_array(YII_ENV,['pro','dev'])) { | |||
$where[] = ['=', 'e.main_corp_id', $cookies['user_main_corp']]; | |||
} | |||
//运营负责人 | |||
if (empty($param['main_search']) == false) { | |||
$where[] = ['=', 'a.main_user_id', $param['main_search']]; | |||
} | |||
//联系人 和手机号 | |||
if (empty($param['contacts_name']) == false) { | |||
$where[] = ['like', 'f.contacts_name', $param['contacts_name']]; | |||
} | |||
if (empty($param['contacts_phone']) == false) { | |||
$where[] = ['like', 'f.contacts_phone', $param['contacts_phone']]; | |||
} | |||
if ($type == 1) {//获取count | |||
$select = ["count(1) cnt"]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' a') | |||
->innerJoin('base_category c', ' a.category_id = c.category_id') | |||
->innerJoin('pay_main d', ' a.order_id = d.order_id') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id') | |||
->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1') | |||
->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid') | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
return $result['cnt']; | |||
} else if ($type == 3) { | |||
$select = ["count(1) cnt", "sum(total_money) total_money"]; | |||
$where[] = ['in', 'a.order_status', [2, 3]]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' a') | |||
->innerJoin('base_category c', ' a.category_id = c.category_id') | |||
->innerJoin('pay_main d', ' a.order_id = d.order_id') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id') | |||
->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1') | |||
->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid') | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} else {//获取列表 | |||
//查询字段 | |||
$select = [ | |||
'a.order_id',//订单ID | |||
"a.create_time as create_order_time",//下单时间 | |||
"c.category_name as order_type_des",//订单类型 | |||
"a.order_name as book_product",//产品品类名称 | |||
"( | |||
SELECT GROUP_CONCAT(CONCAT(x.prod_name,'X',x.count) SEPARATOR ' ') | |||
from order_info x | |||
WHERE x.order_id = a.order_id | |||
GROUP BY x.order_id | |||
) as prod_des | |||
",//具体产品及数量 | |||
"CONCAT(a.start_date,' ',IFNULL(a.start_time,'')) as start_time",//出发时间 | |||
"(SELECT contacts_name from order_contacts where a.order_id = order_id and contacts_type=1 ) as contacts_name", | |||
"(SELECT contacts_phone from order_contacts where a.order_id = order_id and contacts_type=1) as contacts_phone", | |||
"(SELECT contacts_ID from order_contacts where a.order_id = order_id and contacts_type=1) as contacts_ID", | |||
new Expression("CASE a.order_status | |||
WHEN 1 THEN '待支付' | |||
WHEN 2 THEN '已支付' | |||
WHEN 3 THEN '已完成' | |||
WHEN 4 THEN '已退款' | |||
WHEN 5 THEN '已取消' | |||
ELSE '' | |||
END | |||
as order_status_des | |||
") | |||
,//订单状态名称 | |||
"a.order_status as order_status_id",//订单状态标识ID | |||
"if(d.pay_type=1,'微信',if(d.pay_type=2,'支付宝','预付款')) as pay_type_des",//支付类型名称 | |||
'order_come' => new Expression("(SELECT CONCAT(nickname,'<br/>',phone) from fx_user where a.fx_uid = uid)"),//订单来源(分销商) | |||
"if(a.order_status in (1,2), | |||
if(a.start_date >= '" . date('Y-m-d') . "',0,1), 1) | |||
as if_can_cancel",//是否可以取消订单 | |||
'a.total_money', | |||
'a.start_area', | |||
'a.end_area', | |||
'a.prod_cnt', | |||
'a.category_id', | |||
'a.end_time', | |||
'system' => new Expression("if(a.system=1,'分销',if(a.system=2,'微信','官网'))"), | |||
'user_area_name' => new Expression("(select area_name from fx_user_area where area_id = g.user_area)"), | |||
'a.remark', | |||
"commission_amount" => new Expression("(SELECT SUM(total_money) from fx_commission_info WHERE order_id = a.order_id)") | |||
]; | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' a') | |||
->innerJoin('base_category c', ' a.category_id = c.category_id') | |||
->innerJoin('pay_main d', ' a.order_id = d.order_id') | |||
->leftJoin(MainCorpUser::tableName() . ' e', 'a.main_user_id=e.id') | |||
->leftJoin(OrderContacts::tableName() . ' f', 'a.order_id=f.order_id and f.contacts_type=1') | |||
->leftJoin(FxUser::tableName() . ' g', 'a.fx_uid=g.uid') | |||
->where($where) | |||
->orderBy('a.create_time DESC') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
} | |||
/* | |||
* 订单列表 | |||
*/ | |||
public function AdminCommissionList($param) | |||
{ | |||
//where条件 | |||
$where = ['and', ['!=', 'a.order_status', 1], ['!=', 'a.order_status', 5], ['=', 'a.delete_flag', 0], ['=', 'a.fx_uid', $param['fx_uid']]]; | |||
if ($param['order_id'] != '') { | |||
$where[] = ['like', 'a.order_id', $param['order_id']]; | |||
} | |||
if ($param['order_type_id'] != '') { | |||
$where[] = ['=', 'a.category_id', $param['order_type_id']]; | |||
} | |||
if ($param['create_order_start_date'] != '') { | |||
$where[] = ['>=', 'a.create_time', $param['create_order_start_date']]; | |||
} | |||
if ($param['create_order_end_date'] != '') { | |||
$where[] = ['<', 'a.create_time', date('y-m-d', strtotime("{$param['create_order_end_date']} +1 day"))]; | |||
} | |||
if ($param['order_status_id'] != '') { | |||
$where[] = ['=', 'a.order_status', $param['order_status_id']]; | |||
} | |||
if ($param['settlement_start_date'] != '') { | |||
$where[] = ['>=', 'a.end_date', date('Y-m-d', strtotime("{$param['settlement_start_date']} -3 day"))]; | |||
} | |||
if ($param['settlement_end_date'] != '') { | |||
$where[] = ['<', 'a.end_date', date('Y-m-d', strtotime("{$param['settlement_end_date']} -2 day"))]; | |||
} | |||
$select = [ | |||
'a.order_id', | |||
'a.category_id as order_type_id', | |||
new Expression("CASE a.category_id | |||
WHEN 1 THEN '车票' | |||
WHEN 2 THEN '门票' | |||
WHEN 3 THEN '酒店' | |||
ELSE '' | |||
END | |||
as order_type_des | |||
") | |||
, | |||
'a.create_time as create_order_date', | |||
'a.total_money as order_price', | |||
'a.order_status as order_status_id', | |||
new Expression("CASE a.order_status | |||
WHEN 2 THEN '已支付' | |||
WHEN 3 THEN '已完成' | |||
WHEN 4 THEN '已退款' | |||
ELSE '' | |||
END | |||
as order_status_des | |||
") | |||
, | |||
'date_add(a.end_date,INTERVAL 3 DAY) as settlement_order_date', | |||
'b.total_money as all_commission_money' | |||
]; | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' as a') | |||
->leftJoin('fx_commission_info as b', 'a.order_id=b.order_id') | |||
->where($where) | |||
->orderBy('a.create_time DESC') | |||
->offset($offset) | |||
->limit($param['page_size']) | |||
->asArray() | |||
->all(); | |||
$count = self::find()->select('count(1) as count')->from(self::tableName() . ' as a')->where($where)->asArray()->one(); | |||
$count = $count['count']; | |||
return ['list' => $result, 'count' => $count]; | |||
} | |||
/** | |||
* Des:获取订单退款信息 | |||
* Name: getOrderRefund | |||
* @param $order_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getOrderRefund($order_id) | |||
{ | |||
$select = [ | |||
'IFNULL(a.spider_order_id,a.order_id) as order_id', | |||
'b.pro_cate_name', | |||
'a.spider_order_id', | |||
'a.start_date', | |||
'a.start_time', | |||
'a.category_id' | |||
]; | |||
$result = self::find() | |||
->select($select) | |||
->from(OrderMain::tableName() . ' a') | |||
->innerJoin(ProdCategory::tableName() . ' b', 'a.prod_cate_id = b.pro_cate_id') | |||
->where(['=', 'a.order_id', $order_id]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Des:判断某个产品是否存在订单 | |||
* Name: existOrder | |||
* @param $param | |||
* @return bool | |||
* @author 付泓程 | |||
*/ | |||
public function existOrder($param) | |||
{ | |||
$prod_cate_id = $param['prod_cate_id']; | |||
$start_date = $param['start_date']; | |||
$run_time = $param['start_time']; | |||
$small24 = $param['small24']; //是否小于0 -即提前X天。 | |||
$select = ['count(order_id) as count']; | |||
// $sql = "select count(order_id) as count from order_main where prod_cate_id = {$prod_cate_id} and start_date={$start_date} and order_status = 3 and delete_flag=0"; | |||
$where = ['and', ['=', 'a.prod_cate_id', $prod_cate_id], ['=', 'a.start_date', $start_date], ['=', 'a.order_status', 2], ['=', 'a.delete_flag', 0]]; | |||
if (!$small24) { | |||
$where[] = ['>=', 'a.start_time', $run_time]; | |||
} | |||
$result = self::find() | |||
->select($select) | |||
->from(OrderMain::tableName() . ' a') | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
$count = $result['count']; | |||
if ($count > 0) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
/** | |||
* des 获取订单支付详细信息 | |||
* @param $orderId | |||
* @return array | |||
*/ | |||
public function getOrderPayInfo($orderId) | |||
{ | |||
$select = [ | |||
'a.order_id', | |||
'b.pro_cate_name', | |||
new Expression("concat(a.start_date,' ',a.start_time) as 'run_time'"), | |||
'a.category_id', | |||
new Expression("(select category_name from base_category WHERE category_id = a.category_id) as category_name"), | |||
'a.prod_cnt', | |||
'a.create_time', | |||
'a.order_status', | |||
'a.total_money', | |||
'c.contacts_name', | |||
'c.contacts_phone' | |||
]; | |||
$result = self::find() | |||
->select($select) | |||
->from(OrderMain::tableName() . ' a') | |||
->innerJoin(ProdCategory::tableName() . ' b', 'a.prod_cate_id = b.pro_cate_id') | |||
->innerJoin(OrderContacts::tableName() . ' c', 'a.order_id = c.order_id and c.contacts_type=1 ') | |||
->where(['=', 'a.order_id', $orderId]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Des:订单初始化运营负责人 | |||
* Name: bindMainCorp | |||
* @param $fx_uid | |||
* @param $main_user_id | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function bindMainCorp($fx_uid, $main_user_id) | |||
{ | |||
$count = self::updateAll(['main_user_id' => $main_user_id], ['=', 'fx_uid', $fx_uid]); | |||
return $count; | |||
} | |||
/** | |||
* Des:获取酒店订单数据 | |||
* Name: getHotelOrderInfo | |||
* @param $order_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getHotelOrderInfo($order_id) | |||
{ | |||
$select = [ | |||
'a.order_id', | |||
'c.hotel_id', | |||
'c.room_id', | |||
'a.prod_cnt', | |||
'a.start_date', | |||
'a.end_date', | |||
'a.total_money', | |||
'b.contacts_name', | |||
'b.contacts_phone', | |||
'c.total_details', | |||
'a.system' | |||
]; | |||
$where = ['=','a.order_id', $order_id]; | |||
$getInfo = self::find()->select($select) | |||
->from(self::tableName().' a') | |||
->innerJoin(OrderContacts::tableName().' b','a.order_id = b.order_id and b.contacts_type=1') | |||
->innerJoin('order_hotel_extra c','a.order_id = c.main_order_id') | |||
->where($where) | |||
->asArray() | |||
->one(); | |||
return $getInfo; | |||
} | |||
} |
@@ -0,0 +1,77 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "pay_main". | |||
* | |||
* @property integer $id | |||
* @property string $pay_id | |||
* @property integer $pay_type | |||
* @property string $amount_money | |||
* @property string $pay_time | |||
* @property integer $pay_user | |||
* @property integer $order_id | |||
* @property string $create_time | |||
* @property integer $delete_flag | |||
*/ | |||
class PayMain extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'pay_main'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['order_id'], 'required'], | |||
[['pay_type', 'order_id','pay_user', 'delete_flag'], 'integer'], | |||
[['amount_money','order_money'], 'number'], | |||
[['pay_time', 'create_time', 'pay_order_id'], 'safe'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'pay_type' => 'Pay Type', | |||
'amount_money' => 'Amount Money', | |||
'pay_time' => 'Pay Time', | |||
'pay_user' => 'Pay User', | |||
'order_id' => 'Order ID', | |||
'delete_flag' => 'Delete Flag', | |||
'pay_order_id' => 'pay_roder_id', | |||
'order_money' => 'order_money' | |||
]; | |||
} | |||
/** | |||
* Des:获取支付信息 | |||
* Name: getPayInfo | |||
* @param $oder_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getPayInfo($oder_id) | |||
{ | |||
$return = $this->find() | |||
->from(static::tableName()) | |||
->where(['=','order_id', $oder_id]) | |||
->asArray(true) | |||
->one(); | |||
return $return; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "pay_refush". | |||
* | |||
* @property integer $id | |||
* @property integer $order_id | |||
* @property integer $pay_roder_id | |||
* @property integer $pay_type | |||
* @property string $amount_money | |||
* @property integer $fx_uid | |||
* @property integer $sh_uid | |||
* @property integer $status | |||
* @property string $create_time | |||
* @property string $refund_time | |||
* @property integer $delete_flag | |||
*/ | |||
class PayRefush extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'pay_refush'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['order_id', 'pay_type', 'fx_uid', 'sh_uid'], 'required'], | |||
[['order_id', 'pay_type', 'fx_uid', 'sh_uid', 'status', 'delete_flag'], 'integer'], | |||
[['amount_money', 'refush_money'], 'number'], | |||
[['create_time', 'refund_time', 'pay_order_id'], 'safe'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'ID', | |||
'order_id' => 'Order ID', | |||
'pay_order_id' => 'pay_order_id', | |||
'pay_type' => 'Pay Type', | |||
'amount_money' => 'Amount Money', | |||
'refush_money' => 'refush_money', | |||
'fx_uid' => 'Fx Uid', | |||
'sh_uid' => 'Sh Uid', | |||
'status' => 'Status', | |||
'create_time' => 'Create Time', | |||
'refund_time' => 'Refund Time', | |||
'delete_flag' => 'Delete Flag', | |||
]; | |||
} | |||
/** | |||
* Des:根据订单ID获取退款信息 | |||
* Name: getInfoByOrderId | |||
* @param $orderId | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInfoByOrderId($orderId) | |||
{ | |||
$return = $this->find() | |||
->from(static::tableName()) | |||
->where(['=', 'order_id', $orderId]) | |||
->asArray(true) | |||
->one(); | |||
return $return; | |||
} | |||
/** | |||
* Des:根据ID获取退款信息 | |||
* Name: getInfoByOrderId | |||
* @param $id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInfoById($id) | |||
{ | |||
$return = $this->find() | |||
->from(static::tableName()) | |||
->where(['=', 'id', $id]) | |||
->asArray(true) | |||
->one(); | |||
return $return; | |||
} | |||
/** | |||
* Des:获取所有未退款的退款申请记录 | |||
* Name: getAllUnPay | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUnPayIds() | |||
{ | |||
$return = $this->find()->select(['id']) | |||
->from(static::tableName()) | |||
->where(['=', 'status', 1]) | |||
->asArray(true) | |||
->all(); | |||
return $return; | |||
} | |||
/** | |||
* Des:修改退款状态 | |||
* Name: updateStatus | |||
* @param $id | |||
* @param $status | |||
* @return int | |||
* @author 倪宗锋 | |||
*/ | |||
public function updateStatus($id, $status) | |||
{ | |||
$flag = self::updateAll(['status' => $status, 'refund_time' => date('Y-m-d H:i:s')], ['=', 'id', $id]); | |||
return $flag; | |||
} | |||
} |
@@ -0,0 +1,802 @@ | |||
<?php | |||
namespace common\models; | |||
use common\util\Util; | |||
use Yii; | |||
use yii\base\Exception; | |||
use yii\db\Expression; | |||
/** | |||
* This is the model class for table "prod_category". | |||
* | |||
* @property integer $pro_cate_id | |||
* @property string $pro_cate_name | |||
* @property integer $category_id | |||
* @property string $show_price | |||
* @property string $show_img | |||
* @property integer $sales_count | |||
* @property string $memo | |||
* @property string $commission | |||
* @property integer $create_user_id | |||
* @property integer $is_recom | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property integer $delete_flag | |||
* @property string $update_user | |||
* @property string $address | |||
* @property integer $bus_ticket_id | |||
* @property integer $bus_line_type | |||
*/ | |||
class ProdCategory extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'prod_category'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['pro_cate_name', 'category_id'], 'required'], | |||
[['category_id', 'sales_count', 'create_user_id', 'is_recom', 'delete_flag', 'bus_ticket_id', 'bus_line_type'], 'integer'], | |||
[['show_price', 'commission', 'original_price'], 'number'], | |||
[['create_time', 'update_time', 'sign'], 'safe'], | |||
[['pro_cate_name', 'address'], 'string', 'max' => 100], | |||
[['show_img', 'sign', 'prod_des'], 'string', 'max' => 255], | |||
[['memo',], 'string', 'max' => 65536], | |||
[['update_user', 'close_sale_time'], 'string', 'max' => 50], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'pro_cate_id' => 'Pro Cate ID', | |||
'pro_cate_name' => 'Pro Cate Name', | |||
'category_id' => 'Category ID', | |||
'show_price' => 'Show Price', | |||
'show_img' => 'Show Img', | |||
'sign' => 'sign', | |||
'prod_des' => 'prod_des', | |||
'sales_count' => 'Sales Count', | |||
'memo' => 'Memo', | |||
'commission' => 'Commission', | |||
'create_user_id' => 'Create User ID', | |||
'is_recom' => 'Is Recom', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'delete_flag' => 'Delete Flag', | |||
'update_user' => 'Update User', | |||
'address' => 'Address', | |||
'bus_ticket_id' => 'Bus Ticket ID', | |||
'bus_line_type' => 'Bus Line Type', | |||
]; | |||
} | |||
/** | |||
* Function Description:热销商品推荐10个 | |||
* Function Name: GetHotProd | |||
* @param string $searchStr | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function GetHotProd($searchStr = '') | |||
{ | |||
$where = [ | |||
'and', | |||
['<>', 'show_img', ''], | |||
['=', 'a.delete_flag', 0], | |||
['=', 'b.delete_flag', 0], | |||
['=', 'b.system', 1] | |||
]; | |||
if ($searchStr != '') { | |||
$where[] = ['like', 'pro_cate_name', $searchStr]; | |||
} | |||
$result = self::find()->select(['pro_cate_id', 'sales_count', "IFNULL(prod_des, '') prod_des", 'pro_cate_name', 'if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id', 'show_price', "concat(show_img,'.','min.jpg') as show_img"]) | |||
->from(self::tableName() . ' a') | |||
->innerJoin('cms_category_prod b', 'a.pro_cate_id=b.prod_cate_id') | |||
->where($where) | |||
->orderBy(['sales_count' => SORT_DESC, 'pro_cate_id' => SORT_DESC]) | |||
->limit(10) | |||
->asArray() | |||
->all(); | |||
foreach($result as &$v){ | |||
$v['show_price'] = $this->dealFloat($v['show_price']); | |||
} | |||
return $result; | |||
} | |||
/** | |||
* Function Description:推荐产品列表 | |||
* Function Name: GetRecommendProd | |||
* @param string $where | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function GetRecommendProd($where = '') | |||
{ | |||
if ($where == '') { | |||
$result = self::find()->select(['pro_cate_id', 'sales_count', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id', 'show_price', "concat(show_img,'.','min.jpg') as show_img"]) | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod b', 'a.pro_cate_id=b.prod_cate_id and b.delete_flag=0') | |||
->where(['and', ['=', 'is_recom', 1], ['!=', 'show_img', ''], ['=', 'a.delete_flag', 0], ['=', 'b.system', 1]]) | |||
->orderBy(['pro_cate_id' => SORT_DESC]) | |||
->asArray() | |||
->all(); | |||
} else { | |||
$result = self::find()->select(['pro_cate_id', 'sales_count', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id', 'show_price', "concat(show_img,'.','min.jpg') as show_img"]) | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod b', 'a.pro_cate_id=b.prod_cate_id and b.delete_flag=0') | |||
->where(['and', ['=', 'is_recom', 1], ['!=', 'show_img', ''], ['=', 'a.delete_flag', 0], ['=', 'b.system', 1]]) | |||
->andWhere(['like', 'pro_cate_name', $where]) | |||
->orderBy(['pro_cate_id' => SORT_DESC]) | |||
->asArray() | |||
->all(); | |||
} | |||
foreach($result as &$v){ | |||
$v['show_price'] = $this->dealFloat($v['show_price']); | |||
} | |||
return $result; | |||
} | |||
/** | |||
* Function Description:首页列表查询产品 | |||
* Function Name: GetListProd | |||
* @param $prod_id | |||
* @param string $where | |||
* | |||
* @return array|\yii\db\ActiveRecord[] | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function GetListProd($prod_id, $where = '') | |||
{ | |||
if ($where == '') { | |||
$result = self::find()->select(['pro_cate_id', 'sales_count', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id', 'show_price', "concat(show_img,'.','min.jpg') as show_img"]) | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod b', 'a.pro_cate_id=b.prod_cate_id and b.delete_flag=0') | |||
->where(['and', ['=', 'b.cms_cate_id', $prod_id], ['<>', 'a.show_img', ''], ['=', 'a.delete_flag', 0]]) | |||
->orderBy(['show_sort' => SORT_ASC, 'a.pro_cate_id' => SORT_DESC]) | |||
->asArray() | |||
->all(); | |||
} else { | |||
$result = self::find()->select(['pro_cate_id', 'sales_count', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id', 'show_price', "concat(show_img,'.','min.jpg') as show_img"]) | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod b', 'a.pro_cate_id=b.prod_cate_id and b.delete_flag=0') | |||
->where(['and', ['=', 'b.cms_cate_id', $prod_id], ['<>', 'a.show_img', ''], ['=', 'a.delete_flag', 0]]) | |||
->andWhere(['like', 'pro_cate_name', $where]) | |||
->orderBy(['show_sort' => SORT_ASC, 'a.pro_cate_id' => SORT_DESC]) | |||
->asArray() | |||
->all(); | |||
} | |||
foreach($result as &$v){ | |||
$v['show_price'] = $this->dealFloat($v['show_price']); | |||
} | |||
return $result; | |||
} | |||
/** | |||
* Function Description:非巴士产品获取详情 | |||
* Function Name: getProdDetail | |||
* @param $pro_cate_id | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getProdDetail($pro_cate_id) | |||
{ | |||
$result = self::find()->select(['pro_cate_id', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'category_id', 'show_img', 'memo booking_notice', 'sign', 'show_price', 'close_sale_time', | |||
"(select category_name from cms_category where cms_category_id =(select cms_cate_id from cms_category_prod where prod_cate_id=$pro_cate_id limit 1)) as category_name"]) | |||
->from(self::tableName()) | |||
->where(['and', ['=', 'pro_cate_id', $pro_cate_id], ['=', 'delete_flag', 0]]) | |||
->asArray() | |||
->one(); | |||
$result['show_price'] = $this->dealFloat($result['show_price']); | |||
return $result; | |||
} | |||
/** | |||
* Des:获取产品详细信息 | |||
* Name: getProdInfo | |||
* @param $pro_cate_id | |||
* @return array|null|\yii\db\ActiveRecord | |||
* @author 倪宗锋 | |||
*/ | |||
public function getProdCateInfo($pro_cate_id) | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['=', 'pro_cate_id', $pro_cate_id]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:巴士产品获取详情 | |||
* Function Name: getBusProdDetail | |||
* @param $pro_cate_id | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getBusProdDetail($pro_cate_id) | |||
{ | |||
$result = self::find()->select(['pro_cate_id', 'pro_cate_name', "IFNULL(prod_des, '') prod_des", 'category_id', 'sign', 'show_img', 'IFNULL(close_sale_time,24) as close_sale_time', "(select category_name from cms_category where cms_category_id =(select cms_cate_id from cms_category_prod where prod_cate_id=$pro_cate_id limit 1)) as category_name" | |||
, 'b.start_area_name', 'b.start_area_id', 'b.start_res_name', 'b.end_res_name', 'b.end_area_name', 'b.end_area_id', 'memo booking_notice']) | |||
->from(self::tableName() . ' as a') | |||
->leftJoin('bus_ticket b', 'a.bus_ticket_id=b.ticket_id') | |||
->where(['and', ['=', 'pro_cate_id', $pro_cate_id]]) | |||
->asArray() | |||
->one(); | |||
return $result; | |||
} | |||
/* | |||
* 后台产品列表 | |||
*/ | |||
public function AdminGetList($param) | |||
{ | |||
$where = ['and', ['=', 'a.delete_flag', 0]]; | |||
if ($param['category_id'] != '') { | |||
$where[] = ['=', 'b.cms_cate_id', $param['category_id']]; | |||
} | |||
if ($param['pro_cate_name'] != '') { | |||
$where[] = ['like', 'pro_cate_name', $param['pro_cate_name']]; | |||
} | |||
if ($param['is_recom'] != '') { | |||
$where[] = ['=', 'is_recom', $param['is_recom']]; | |||
} | |||
$offset = ($param['current_page'] - 1) * $param['page_size']; | |||
$select = [ | |||
'pro_cate_id', | |||
'a.category_id', | |||
"if(a.category_id=1,if(a.sign is not null,concat(c.category_name,'(主线路)'),concat(c.category_name,'(子线路)')),c.category_name) as base_category", | |||
'pro_cate_name', 'close_sale_time', | |||
'memo', "IFNULL(prod_des, '') prod_des", | |||
'commission', 'show_img', | |||
'is_recom as is_recom_id', | |||
'if(is_recom=1,"已推荐","未推荐") as is_recom' | |||
, "(select 1) as commission_way_id", "(select '按金额') as commission_way", | |||
"ifnull((select category_name from cms_category where cms_category_id =(select cms_cate_id from cms_category_prod where prod_cate_id=a.pro_cate_id limit 1)),'') as category_name" | |||
, "ifnull(b.cms_cate_id,-1) as cms_category_id" | |||
]; | |||
$result = self::find()->select($select) | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod as b', 'b.prod_cate_id = a.pro_cate_id') | |||
->innerJoin(BaseCategory::tableName() . ' c', 'c.category_id = a.category_id') | |||
->where($where) | |||
->groupBy('a.pro_cate_id') | |||
->orderBy('a.pro_cate_id DESC') | |||
->offset($offset) | |||
->limit((int)$param['page_size']) | |||
->asArray() | |||
->all(); | |||
$result1 = self::find()->select('count(1) as count') | |||
->from(self::tableName() . ' a') | |||
->leftJoin('cms_category_prod as b', 'b.prod_cate_id=a.pro_cate_id') | |||
->asArray() | |||
->where($where) | |||
->one(); | |||
$result1 = $result1['count']; | |||
return ['list' => $result, 'count' => $result1]; | |||
} | |||
/* | |||
* 产品推荐 | |||
*/ | |||
public function Recommend($pro_cate_id) | |||
{ | |||
$is_recom = self::find()->select(["is_recom"])->from(self::tableName())->where(['=', 'pro_cate_id', $pro_cate_id])->asArray()->one(); | |||
if ($is_recom['is_recom'] == 1) { | |||
$count = self::updateAll(['is_recom' => 0], ['=', 'pro_cate_id', $pro_cate_id]); | |||
} else { | |||
$count = self::updateAll(['is_recom' => 1], ['=', 'pro_cate_id', $pro_cate_id]); | |||
} | |||
return $count; | |||
} | |||
/* | |||
* 添加产品 | |||
*/ | |||
public function addProd($param) | |||
{ | |||
$values = [ | |||
'category_id' => $param['category_id'], | |||
'pro_cate_name' => $param['pro_cate_name'], | |||
'memo' => $param['memo'], | |||
'sales_count' => rand(1, 10), | |||
'show_img' => $param['show_img'], | |||
'create_time' => date('Y-m-d H:i:s'), | |||
'prod_des' => $param['prod_des'], | |||
'close_sale_time' => $param['close_sale_time'] //截止售卖时间 2017-05-18 fuhc | |||
]; | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$this->attributes = $values; | |||
$res = $this->insert(); | |||
if (!$res) { | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/* | |||
* 修改show price | |||
*/ | |||
public function changeShowPrice($pro_cate_id) | |||
{ | |||
//查当前产品的子产品最低价 | |||
$show_price = ProdMain::find()->select(['min(prod_price) as price'])->from('prod_main')->where(['and', ['=', 'delete_flag', '0'], ['=', 'prod_cate_id', $pro_cate_id]])->asArray()->one(); | |||
$show_price = $show_price['price']; | |||
$count = self::updateAll(['show_price' => $show_price], ['and', ['=', 'pro_cate_id', $pro_cate_id]]); | |||
return $count; | |||
} | |||
/* | |||
* 自定义佣金 | |||
*/ | |||
public function DefineCommission($pro_cate_id, $commission) | |||
{ | |||
$count = self::updateAll(['commission' => $commission], ['and', ['=', 'pro_cate_id', $pro_cate_id]]); | |||
return $count; | |||
} | |||
/* | |||
* 后台修改产品信息 | |||
*/ | |||
public function uptAdminProd($param) | |||
{ | |||
$values = [ | |||
'category_id' => $param['category_id'], | |||
'pro_cate_name' => $param['pro_cate_name'], | |||
'memo' => $param['memo'], | |||
'show_img' => $param['show_img'], | |||
'prod_des' => $param['prod_des'], | |||
'update_time' => date('Y-m-d H:i:s'), | |||
'close_sale_time' => $param['close_sale_time'] //截止售卖时间 2017-05-18 fuhc | |||
]; | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$uptOne = self::findOne(['pro_cate_id' => $param['pro_cate_id']]); | |||
$uptOne->attributes = $values; | |||
$res = $uptOne->update(); | |||
if ($res === false) { | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/* | |||
* 产品增量 | |||
*/ | |||
public function addCount($pro_cate_id, $cnt) | |||
{ | |||
$sql = '' . "UPDATE prod_category | |||
set sales_count=sales_count+$cnt | |||
where pro_cate_id = $pro_cate_id | |||
"; | |||
$res = $this->getDb()->createCommand($sql)->execute(); | |||
if (!$res) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
/** | |||
* Des: | |||
* Name: getEntranceTicket | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getEntranceTicket() | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['and', ['<>', 'sign', ''], ['=', 'category_id', 2], ['=', 'delete_flag', 0]]) | |||
->indexBy('sign') | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des:同步门票数据 | |||
* Name: addEntranceTicketFormCs | |||
* @param $prodArr | |||
* @return int | |||
* @throws \yii\db\Exception | |||
* @author 倪宗锋 | |||
*/ | |||
public function addEntranceTicketFormCs($prodArr) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
/**添加产品主表数据***************/ | |||
$prodValues = []; | |||
$prodKeys = [ | |||
'pro_cate_name', | |||
'category_id', | |||
'create_time', | |||
'sign', | |||
]; | |||
foreach ($prodArr as $key => $val) { | |||
$prodVal = []; | |||
$prodVal[] = $val['name']; | |||
$prodVal[] = 2; | |||
$prodVal[] = date('Y-m-d H:i:s'); | |||
$prodVal[] = $key; | |||
$prodValues[] = $prodVal; | |||
} | |||
$count = Yii::$app->db->createCommand()->batchInsert('prod_category', $prodKeys, $prodValues)->execute(); | |||
if ($count == 0) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
/**获取新添加的产品主表数据及其ID**/ | |||
$signArr = array_keys($prodArr); | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['and', ['in', 'sign', $signArr], ['=', 'category_id', 2]]) | |||
->indexBy('sign') | |||
->asArray() | |||
->all(); | |||
/**将数据产褥prod_main表中*/ | |||
$prodMainValues = []; | |||
$prodMainKeys = ['prod_cate_id', 'prod_name', 'create_time', 'bus_id']; | |||
foreach ($result as $key => $val) { | |||
if (!empty($prodArr[$val['sign']]['sub_ticket']) && count($prodArr[$val['sign']]['sub_ticket']) > 0) { | |||
$subTicket = $prodArr[$val['sign']]['sub_ticket']; | |||
foreach ($subTicket as $subVal) { | |||
$prodMainVal = []; | |||
$prodMainVal[] = $val['pro_cate_id']; | |||
$prodMainVal[] = $subVal['prod_name']; | |||
$prodMainVal[] = date('Y-m-d H:i:s'); | |||
$prodMainVal[] = $subVal['prod_id']; | |||
$prodMainValues[] = $prodMainVal; | |||
} | |||
} | |||
} | |||
$count = Yii::$app->db->createCommand()->batchInsert('prod_main', $prodMainKeys, $prodMainValues)->execute(); | |||
if ($count == 0) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des: 删除门票数据 | |||
* Name: delEntranceTicketFormCs | |||
* @author 倪宗锋 | |||
*/ | |||
public function delEntranceTicketFormCs($prodArr) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$values = [ | |||
'delete_flag' => 1 | |||
]; | |||
$signArr = array_keys($prodArr); | |||
$res = self::updateAll($values, ['in', 'sign', $signArr]); | |||
if ($res === false) { | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des:修改订单状态为激活 | |||
* Name: interEntranceTicketFormCs | |||
* @param $new_bus_arr_inter | |||
* @return bool | |||
* @throws \yii\db\Exception | |||
* @author 倪宗锋 | |||
*/ | |||
public function interEntranceTicketFormCs($new_bus_arr_inter) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$values = [ | |||
'delete_flag' => 0 | |||
]; | |||
$signArr = array_keys($new_bus_arr_inter); | |||
$res = self::updateAll($values, ['in', 'sign', $signArr]); | |||
if ($res === false) { | |||
throw new Exception('编辑出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des:每日增加产品的销售量 每月1号重置产品的销售量 | |||
* Name: setSaleCnt | |||
* @param $day | |||
* @return bool | |||
* @throws \yii\db\Exception | |||
* @author 倪宗锋 | |||
*/ | |||
public function setSaleCnt($day) | |||
{ | |||
if ($day == 1) { | |||
$values = [ | |||
'sales_count' => new Expression("1+ROUND(RAND()*10,0)") | |||
]; | |||
} else { | |||
$values = [ | |||
'sales_count' => new Expression("sales_count+sales_count*0.05+1+ROUND(RAND()*5,0)") | |||
]; | |||
} | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$res = self::updateAll($values); | |||
if ($res === false) { | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des:LBS获取产品列表 | |||
* Name: getLBSListByCmsCate | |||
* @param $point | |||
* @param $cms_cate_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getLBSListByCmsCate($point, $cms_cate_id) | |||
{ | |||
$pointArr = explode(',', $point);//经纬度坐标 | |||
if (empty($pointArr['0']) || empty($pointArr['1'])) { | |||
return []; | |||
} | |||
$longitude = $pointArr['0']; | |||
$latitude = $pointArr['1']; | |||
$sql = '' . "SELECT round(if(a.start_lbs>a.end_lbs,a.end_lbs,a.start_lbs),3) 'lbs', b.pro_cate_id,b.sales_count, | |||
b.pro_cate_name,IFNULL(prod_des, '') prod_des,if(category_id=1,(if(sign is null,category_id,1000)),category_id) as category_id | |||
,show_price,concat(show_img,'.','min.jpg') as show_img | |||
from ( | |||
select ticket_id,line_type,sqrt( | |||
((({$longitude}-start_res_longitude)*PI()*12656*cos((($latitude+start_res_latitude)/2)*PI()/180)/180) | |||
* (({$longitude}-start_res_longitude)*PI()*12656*cos ((($latitude+start_res_latitude)/2)*PI()/180)/180)) | |||
+ ((($latitude-start_res_latitude)*PI()*12656/180) | |||
* (($latitude-start_res_latitude)*PI()*12656/180)) | |||
)/2 as start_lbs, | |||
sqrt( | |||
((({$longitude}-end_res_longitude)*PI()*12656*cos((($latitude+end_res_latitude)/2)*PI()/180)/180) | |||
*(({$longitude}-end_res_longitude)*PI()*12656*cos ((($latitude+end_res_latitude)/2)*PI()/180)/180) | |||
)+((($latitude-end_res_latitude)*PI()*12656/180) | |||
*(($latitude-end_res_latitude)*PI()*12656/180)) | |||
)/2 as end_lbs, | |||
start_res_longitude, start_res_latitude,end_res_longitude,end_res_latitude | |||
from bus_ticket where | |||
start_res_longitude is not null and end_res_longitude is not NULL | |||
and start_res_latitude is not null and end_res_latitude is not NULL | |||
) a | |||
JOIN prod_category b on a.ticket_id=b.bus_ticket_id | |||
JOIN cms_category_prod c on b.pro_cate_id = c.prod_cate_id | |||
WHERE b.sign is NULL and c.cms_cate_id={$cms_cate_id} and b.show_img <> '' and b.delete_flag=0 | |||
ORDER BY lbs | |||
LIMIT 10 "; | |||
$result = Yii::$app->getDb()->createCommand($sql)->queryAll(); | |||
foreach($result as &$v){ | |||
$v['show_price'] = $this->dealFloat($v['show_price']); | |||
} | |||
return $result; | |||
} | |||
/** | |||
* Des: | |||
* Name: getEntranceHotel | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getEntranceHotel() | |||
{ | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['and', ['<>', 'sign', ''], ['=', 'category_id', 3]]) | |||
->indexBy('sign') | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Des:同步酒店数据 | |||
* Name: addEntranceHotelFormCs | |||
* @param $prodArr | |||
* @return bool | |||
* @throws \yii\db\Exception | |||
* @author 付泓程 | |||
*/ | |||
public function addEntranceHotelFormCs($prodArr) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
/**添加产品主表数据***************/ | |||
$prodValues = []; | |||
$prodKeys = [ | |||
'pro_cate_name', | |||
'category_id', | |||
'create_time', | |||
'sign', | |||
]; | |||
foreach ($prodArr as $key => $val) { | |||
$prodVal = []; | |||
$prodVal[] = $val['name']; | |||
$prodVal[] = 3; | |||
$prodVal[] = date('Y-m-d H:i:s'); | |||
$prodVal[] = $key; | |||
$prodValues[] = $prodVal; | |||
} | |||
$count = Yii::$app->db->createCommand()->batchInsert('prod_category', $prodKeys, $prodValues)->execute(); | |||
if ($count == 0) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
/**获取新添加的产品主表数据及其ID**/ | |||
$signArr = array_keys($prodArr); | |||
$result = self::find() | |||
->from(self::tableName()) | |||
->where(['and', ['in', 'sign', $signArr], ['=', 'category_id', 3]]) | |||
->indexBy('sign') | |||
->asArray() | |||
->all(); | |||
/**将数据插入prod_main表中*/ | |||
$prodMainValues = []; | |||
$prodMainKeys = ['prod_cate_id', 'prod_name', 'create_time', 'bus_id']; | |||
foreach ($result as $key => $val) { | |||
if (!empty($prodArr[$val['sign']]['sub_ticket']) && count($prodArr[$val['sign']]['sub_ticket']) > 0) { | |||
$subTicket = $prodArr[$val['sign']]['sub_ticket']; | |||
foreach ($subTicket as $subVal) { | |||
$prodMainVal = []; | |||
$prodMainVal[] = $val['pro_cate_id']; | |||
$prodMainVal[] = $subVal['prod_name']; | |||
$prodMainVal[] = date('Y-m-d H:i:s'); | |||
$prodMainVal[] = $subVal['prod_id']; | |||
$prodMainValues[] = $prodMainVal; | |||
} | |||
} | |||
} | |||
$count = Yii::$app->db->createCommand()->batchInsert('prod_main', $prodMainKeys, $prodMainValues)->execute(); | |||
if ($count == 0) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des: 删除酒店数据 | |||
* Name: delEntranceTicketFormCs | |||
* @author 付泓程 | |||
*/ | |||
public function delEntranceHotelFormCs($prodArr) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$values = [ | |||
'delete_flag' => 1 | |||
]; | |||
$signArr = array_keys($prodArr); | |||
$res = self::updateAll($values, ['in', 'sign', $signArr]); | |||
if ($res === false) { | |||
throw new Exception('删除出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Des:修改订单状态为激活 | |||
* Name: interEntranceHotelFormCs | |||
* @param $new_bus_arr_inter | |||
* @return bool | |||
* @throws \yii\db\Exception | |||
* @author 付泓程 | |||
*/ | |||
public function interEntranceHotelFormCs($new_bus_arr_inter) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
try { | |||
$values = [ | |||
'delete_flag' => 0 | |||
]; | |||
$signArr = array_keys($new_bus_arr_inter); | |||
$res = self::updateAll($values, ['in', 'sign', $signArr]); | |||
if ($res === false) { | |||
throw new Exception('编辑出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} catch (Exception $e) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* Function Description:处理价格 | |||
* Function Name: dealFloat | |||
* @param $float | |||
* | |||
* @return float | |||
* | |||
* @author LUOCJ | |||
*/ | |||
public function dealFloat($float) | |||
{ | |||
$int = floor($float); | |||
if ($float - $int == 0) { | |||
$float = $int; | |||
} | |||
return $float; | |||
} | |||
} |
@@ -0,0 +1,286 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "prod_main". | |||
* | |||
* @property integer $prod_id | |||
* @property integer $prod_cate_id | |||
* @property string $prod_name | |||
* @property string $prod_price | |||
* @property string $create_user | |||
* @property string $create_time | |||
* @property string $update_time | |||
* @property integer $delete_flag | |||
* @property string $update_user | |||
* @property string $bus_id | |||
*/ | |||
class ProdMain extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'prod_main'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['prod_cate_id', 'prod_price'], 'required'], | |||
[['prod_cate_id', 'delete_flag'], 'integer'], | |||
[['prod_price', 'commission'], 'number'], | |||
[['create_time', 'update_time'], 'safe'], | |||
[['prod_name'], 'string', 'max' => 100], | |||
[['create_user', 'update_user'], 'string', 'max' => 50], | |||
[['bus_id'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'prod_id' => 'Prod ID', | |||
'prod_cate_id' => 'Prod Cate ID', | |||
'prod_name' => 'Prod Name', | |||
'prod_price' => 'Prod Price', | |||
'create_user' => 'Create User', | |||
'create_time' => 'Create Time', | |||
'update_time' => 'Update Time', | |||
'delete_flag' => 'Delete Flag', | |||
'update_user' => 'Update User', | |||
'bus_id' => 'Bus ID', | |||
]; | |||
} | |||
/** | |||
* Function Description:产品详情获取子产品数组 | |||
* Function Name: getProdArr | |||
* @param $pro_cate_id | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getProdArr($pro_cate_id) | |||
{ | |||
$result = self::find()->select(['prod_name', 'prod_price', 'prod_id', 'bus_id', '(select 100) as prod_count', 'commission']) | |||
->from(self::tableName()) | |||
->where(['and', ['=', 'prod_cate_id', $pro_cate_id], ['=', 'delete_flag', 0]]) | |||
->asArray() | |||
->all(); | |||
if (empty($result['0'])) { | |||
return []; | |||
} else { | |||
foreach ($result as &$v) { | |||
$v['prod_price'] = $this->dealFloat($v['prod_price']); | |||
} | |||
} | |||
return $result; | |||
} | |||
/** | |||
* Des:获取订单总价格 | |||
* Name: getTotalMoney | |||
* @param $params array 多为数组 产品ID和数量 | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getTotalMoney($params) | |||
{ | |||
$prod_id = []; | |||
$sqlCase = ''; | |||
foreach ($params as $val) { | |||
$sqlCase .= " WHEN {$val['prod_id']} THEN prod_price*{$val['prod_count']} "; | |||
$prod_id[] = $val['prod_id']; | |||
} | |||
$prodId = implode(',', $prod_id); | |||
$sql = '' . "SELECT | |||
SUM(CASE prod_id | |||
{$sqlCase} | |||
ELSE 0 | |||
END) | |||
from prod_main | |||
where prod_id in ({$prodId}) | |||
"; | |||
$result = Yii::$app->db->createCommand($sql)->queryScalar(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:获取票种id | |||
* Function Name: getTicketId | |||
* @param $pro_cate_id | |||
* | |||
* @return array|null|\yii\db\ActiveRecord | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getTicketId($pro_cate_id) | |||
{ | |||
$where = ['and']; | |||
$where[] = ['=', 'prod_cate_id', $pro_cate_id]; | |||
$where[] = ['=', 'delete_flag', 0]; | |||
$result = self::find()->select(['bus_id', 'prod_price', 'prod_id', 'prod_name']) | |||
->from(self::tableName()) | |||
->where($where) | |||
->orderBy('prod_id') | |||
->asArray() | |||
->all(); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:查询起始站点 | |||
* Function Name: getStation | |||
* @param $prod_id | |||
* | |||
* @return mixed | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function getStation($prod_id) | |||
{ | |||
$result = self::find()->select(["concat(start_res_name,' - ',end_res_name) as station_str"]) | |||
->from(self::tableName() . ' as a') | |||
->leftJoin('bus_ticket as b', 'a.bus_id=b.ticket_id') | |||
->where(['a.prod_id' => $prod_id]) | |||
->asArray() | |||
->one(); | |||
return $result['station_str']; | |||
} | |||
/** | |||
* Function Description:子产品表添加(只能添加非巴士产品) | |||
* Function Name: addProdMain | |||
* @param $param | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function addProdMain($param) | |||
{ | |||
$transaction = Yii::$app->db->beginTransaction(); | |||
if ($param['category_id'] != 1) { | |||
foreach ($param['price_type'] as $val) { | |||
$values = [ | |||
'prod_cate_id' => $param['prod_cate_id'], | |||
'prod_name' => $val['price_type_name'], | |||
'prod_price' => $val['price_type_price'], | |||
'create_time' => date('Y-m-d H:i:s'), | |||
]; | |||
$prod_main = clone $this; | |||
$prod_main->attributes = $values; | |||
$res = $prod_main->insert(); | |||
if (!$res) { | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
} | |||
$transaction->commit(); | |||
return true; | |||
} | |||
/* | |||
* 修改子产品表 | |||
*/ | |||
public function uptCmsProd($prod_arr, $pro_cate_id) | |||
{ | |||
if ($prod_arr['prod_id'] == 0) { | |||
$value = [ | |||
'prod_name' => $prod_arr['price_type_name'], | |||
'prod_price' => $prod_arr['price_type_price'], | |||
'prod_cate_id' => $pro_cate_id, | |||
'create_time' => date('Y-m-d H:i:s') | |||
]; | |||
$this->attributes = $value; | |||
$res = $this->insert(); | |||
if (!$res) { | |||
return false; | |||
} | |||
} else { | |||
$count = self::updateAll(['prod_name' => $prod_arr['price_type_name'], 'prod_price' => $prod_arr['price_type_price']], ['=', 'prod_id', $prod_arr['prod_id']]); | |||
if ($count === false) { | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
/* | |||
* 获取产品的子产品数组 | |||
*/ | |||
public function getIdArr($pro_cate_id) | |||
{ | |||
$arr = self::find()->select('prod_id')->from(self::tableName())->where(['prod_cate_id' => $pro_cate_id])->indexBy('prod_id')->asArray()->all(); | |||
return $arr; | |||
} | |||
public function delCount($prod_id) | |||
{ | |||
$count = self::updateAll(['delete_flag' => 1], ['=', 'prod_id', $prod_id]); | |||
return $count; | |||
} | |||
/* | |||
* Des:设置产品佣金 (根据prod_cate_id) | |||
* Name: setProdCommissionByCateId | |||
* @param $param | |||
* @return int | |||
* @author 付泓程 | |||
*/ | |||
public function setProdCommissionByCateId($param) | |||
{ | |||
$commission = $param['commission']; | |||
$prod_cate_id = $param['prod_cate_id']; | |||
$count = $this->updateAll(['commission' => $commission], ['and', ['=', 'prod_cate_id', $prod_cate_id], ['=', 'delete_flag', '0']]); | |||
return $count; | |||
} | |||
/* | |||
* Des:设置产品佣金 (根据prod_id) | |||
* Name: setProdCommissionByProdId | |||
* @param $param | |||
* @return int | |||
* @author 付泓程 | |||
*/ | |||
public function setProdCommissionByProdId($param) | |||
{ | |||
$commission = $param['commission']; | |||
$prod_id = $param['prod_id']; | |||
$count = $this->updateAll(['commission' => $commission], ['and', ['=', 'prod_id', $prod_id], ['=', 'delete_flag', '0']]); | |||
return $count; | |||
} | |||
/** | |||
* Function Description:处理价格 | |||
* Function Name: dealFloat | |||
* @param $float | |||
* | |||
* @return float | |||
* | |||
* @author LUOCJ | |||
*/ | |||
public function dealFloat($float) | |||
{ | |||
$int = floor($float); | |||
if ($float - $int == 0) { | |||
$float = $int; | |||
} | |||
return $float; | |||
} | |||
} |
@@ -0,0 +1,115 @@ | |||
<?php | |||
namespace common\models; | |||
use yii\db\ActiveRecord; | |||
/** | |||
* This is the model class for table "sh_user". | |||
* | |||
* @property integer $uid | |||
* @property string $openid | |||
* @property string $phone | |||
* @property integer $fx_uid | |||
* @property integer $status | |||
* @property string $nickname | |||
* @property string $headimgurl | |||
* @property integer $sex | |||
* @property string $country | |||
* @property string $province | |||
* @property string $city | |||
* @property string $reg_time | |||
*/ | |||
class ShUser extends ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'sh_user'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['status'], 'integer'], | |||
[['reg_time', 'last_login'], 'safe'], | |||
[['phone'], 'string', 'max' => 20], | |||
[['phone'], 'unique'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'uid' => 'Uid', | |||
'phone' => 'Phone', | |||
'status' => 'Status', | |||
'reg_time' => 'Reg Time', | |||
'last_login' => 'Last Login', | |||
]; | |||
} | |||
/** | |||
* Des:根据手机号获取用户ID 没有则注册一个 | |||
* Name: getUidByPhone | |||
* @param $phone | |||
* @return int|mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUidByPhone($phone) | |||
{ | |||
$info = $this->getUserInfoByPhone($phone); | |||
if (empty($info['uid'])) { | |||
$this->addUser(['phone' => $phone]); | |||
$info = $this->getUserInfoByPhone($phone); | |||
} | |||
if (empty($info['uid'])) { | |||
return 0; | |||
} | |||
return $info['uid']; | |||
} | |||
/** | |||
* Des:根据手机号获取用户的信息 | |||
* Name: getUserInfoByPhone | |||
* @param $phone | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUserInfoByPhone($phone) | |||
{ | |||
$info = self::find() | |||
->where(['=', 'phone', $phone]) | |||
->asArray() | |||
->one(); | |||
if (empty($info['uid'])) { | |||
return []; | |||
} | |||
return $info; | |||
} | |||
/** | |||
* Des: 添加用户 | |||
* Name: addUser | |||
* @param $param | |||
* @return bool | |||
* @author 倪宗锋 | |||
*/ | |||
public function addUser($param) | |||
{ | |||
$this->setAttributes($param); | |||
$return = $this->insert(true); | |||
return $return; | |||
} | |||
} |
@@ -0,0 +1,85 @@ | |||
<?php | |||
namespace common\models; | |||
use yii\base\Exception; | |||
use Yii; | |||
use fx\util\FxUtil; | |||
/** | |||
* This is the model class for table "order_main". | |||
* | |||
* @property integer $id | |||
* @property string $name | |||
*/ | |||
class Test extends \yii\db\ActiveRecord | |||
{ | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() | |||
{ | |||
return 'fx_user'; | |||
} | |||
public function testList(){ | |||
$select = [ | |||
'uid', | |||
new Expression("ifnull(user_name,'') as user_name") , | |||
'phone', | |||
'nickname' | |||
]; | |||
$list=self::find()->select($select) | |||
->limit(100) | |||
->asArray(true) | |||
->all(); | |||
return $list; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() | |||
{ | |||
return [ | |||
[['id'], 'number'], | |||
[['name'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() | |||
{ | |||
return [ | |||
'id' => 'Order ID', | |||
'name' => 'Spider Order ID', | |||
]; | |||
} | |||
/** | |||
* Function Description:插入主订单 | |||
* Function Name: insertOrder | |||
* | |||
* @return bool | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public function insertOrder(){ | |||
$values=[ | |||
'name'=>'3333', | |||
]; | |||
$transaction=Yii::$app->db->beginTransaction(); | |||
try{ | |||
$this->attributes=$values; | |||
$res=$this->insert(true); | |||
if(!$res){ | |||
throw new Exception('添加出错'); | |||
} | |||
$transaction->commit(); | |||
return true; | |||
}catch (Exception $e){ | |||
$transaction->rollBack(); | |||
return false; | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,318 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权�?�? 运游�? * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改�? | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布�? | |||
* ============================================================================ | |||
* Author By: 倪宗�? | |||
* PhpStorm AliPayService.php | |||
* Create By 2016/12/12 14:32 $ | |||
*/ | |||
namespace common\util; | |||
class AliPay | |||
{ | |||
private static $aliPayConfig = null; | |||
/** | |||
* Des:扫描支付 | |||
* Name: unifiedOrderByOrderIdForSao | |||
* @param $par | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function unifiedOrderByOrderIdForSao($par) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
$aliPay = new AliPay(); | |||
//交易参数 | |||
$params['body'] = $par['name']; | |||
$params['subject'] = $par['name']; | |||
$params['order_id'] = $par['order_id'] . '_' . rand(100, 999); | |||
$params['price'] = $par['total_fee']; | |||
$params['timeout_express'] = '1m'; | |||
$params['goType'] = 3; | |||
$params['method'] = 'alipay.trade.precreate'; | |||
$getUrl = $aliPay->getAliPayUrl($params); | |||
$url = $siteConfig['host_name'] . '/fx/?r=weChat/we-chat/q-code&qCode=' . urlencode($getUrl['data']['codUrl']) . '&_math=' . rand(100, 999); | |||
return Util::returnArrSu('', array('codUrl' => $url, 'price' => $par['total_fee'])); | |||
} | |||
/** | |||
* Function Description:支付宝web支付 | |||
* Function Name: webPay | |||
* @param $param array | |||
* @return array | |||
* | |||
* @author nzf | |||
*/ | |||
public function webPay($param) | |||
{ | |||
//交易参数 | |||
$params['body'] = $param['name']; | |||
$params['subject'] = $param['name']; | |||
$params['order_id'] = $param['order_id']; | |||
$params['price'] = $param['total_fee']; | |||
$params['timeout_express'] = '1m'; | |||
$params['goType'] = 2; | |||
$params['method'] = 'alipay.trade.wap.pay'; | |||
$return = static::getAliPayUrl($params); | |||
return $return; | |||
} | |||
/********************通用方法**************************/ | |||
/** | |||
* Function Description:获取阿里支付pay | |||
* Function Name: getAliPayUrl | |||
* @param $params array | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
private static function getAliPayUrl($params) | |||
{ | |||
$config = self::getAliPayConfig(); | |||
$sysParams = self::getSysParams(); | |||
$sysParams["method"] = $params['method']; | |||
//交易参数 | |||
$body['productCode'] = 'QUICK_WAP_PAY'; | |||
$body['body'] = $params['body']; | |||
$body['subject'] = $params['subject']; | |||
$body['out_trade_no'] = $params['order_id']; | |||
$body['total_amount'] = $params['price']; | |||
$body['timeout_express'] = $config['timeout']; | |||
$sysParams['biz_content'] = json_encode($body); | |||
if ($params['goType'] == 1) {//如果是页面跳�? | |||
$sysParams['sign'] = urlencode(static::getSign($sysParams)); | |||
$paramString = static::getSignContent($sysParams); | |||
$requestUrl = $config['gatewayUrl'] . "?" . $paramString; | |||
return Util::returnArrSu('', ['payData' => $requestUrl]); | |||
} elseif ($params['goType'] == 2) {//如果是参数返�? | |||
$sysParams['sign'] = static::getSign($sysParams); | |||
$result = self::buildRequestForm($sysParams); | |||
return Util::returnArrSu('', ['payData' => $result]); | |||
} else { | |||
$sysParams['sign'] = urlencode(static::getSign($sysParams)); | |||
$paramString = static::getSignContent($sysParams); | |||
$requestUrl = $config['gatewayUrl'] . "?" . $paramString; | |||
$curl = new CurlInterface('', 5); | |||
$result = $curl->execute($requestUrl, 'GET'); | |||
$result = json_decode($result, true); | |||
$return['codUrl'] = ''; | |||
if ($result['alipay_trade_precreate_response']['code'] == '10000') { | |||
$return['codUrl'] = $result['alipay_trade_precreate_response']['qr_code']; | |||
} | |||
return Util::returnArrSu('', $return); | |||
} | |||
} | |||
/** | |||
* Function Description:取消订单 | |||
* Function Name: cancelOrder | |||
* @param $params | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function cancelOrder($params) | |||
{ | |||
$config = self::getAliPayConfig(); | |||
$sysParams = self::getSysParams(); | |||
$sysParams["method"] = 'alipay.trade.refund'; | |||
$body = array( | |||
'out_trade_no' => $params['order_id'],//订单�? | |||
'refund_amount' => $params['refund_fee'],//退款金额 | |||
'refund_reason' => $params['memo'], | |||
'out_request_no' => $params['order_id'] . '-' . date('YmdHis') . rand(100, 999)//�?款原�? | |||
); | |||
$sysParams['biz_content'] = json_encode($body); | |||
$sysParams['sign'] = static::getSign($sysParams); | |||
$sysParams['sign'] = urlencode(static::getSign($sysParams)); | |||
$paramString = static::getSignContent($sysParams); | |||
$requestUrl = $config['gatewayUrl'] . "?" . $paramString; | |||
//调用�?款接�? | |||
$curlInterface = new CurlInterface($sysParams, 5); | |||
$result = $curlInterface->execute($requestUrl, 'GET'); | |||
$result = json_decode(mb_convert_encoding($result, 'utf-8'), true); | |||
if (isset($result['alipay_trade_refund_response']) && $result['alipay_trade_refund_response']['code'] == '10000') { | |||
return Util::returnArrSu(); | |||
} | |||
return Util::returnArrEr('退款失败!'); | |||
} | |||
/** | |||
* Function Description:获取系统通用参数 | |||
* Function Name: getSysParams | |||
* | |||
* @return mixed | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
private static function getSysParams() | |||
{ | |||
$config = self::getAliPayConfig(); | |||
$siteConfig = Util::getSiteConfig(); | |||
//组装系统参数 | |||
$sysParams["app_id"] = $config['app_id']; | |||
$sysParams["version"] = '1.0'; | |||
$sysParams["format"] = 'json'; | |||
$sysParams["sign_type"] = 'RSA'; | |||
$sysParams["timestamp"] = date("Y-m-d H:i:s"); | |||
$sysParams["alipay_sdk"] = 'alipay-sdk-php-20160411'; | |||
$sysParams["prod_code"] = ''; | |||
$sysParams["notify_url"] = $siteConfig['host_name'] . $siteConfig['notify_url']; | |||
// $sysParams["return_url"] = $config['return_url']; | |||
$sysParams["charset"] = $config['charset']; | |||
return $sysParams; | |||
} | |||
/** | |||
* Function Description:建立请求,以表单HTML形式构�?�(默认�? | |||
* Function Name: buildRequestForm | |||
* @param $para_temp | |||
* | |||
* @return string 提交表单HTML文本 | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
protected static function buildRequestForm($para_temp) | |||
{ | |||
$config = self::getAliPayConfig(); | |||
$sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $config['gatewayUrl'] . "?charset=" . trim($config['charset']) . "' method='get'>"; | |||
while (list ($key, $val) = each($para_temp)) { | |||
if (false === static::checkEmpty($val)) { | |||
$val = str_replace("'", "'", $val); | |||
$sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; | |||
} | |||
} | |||
return $sHtml; | |||
} | |||
/** | |||
* Function Description:获取签名 | |||
* Function Name: getSign | |||
* @param $params | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function getSign($params) | |||
{ | |||
if (isset($params['sign'])) { | |||
unset($params['sign']); | |||
} | |||
$content = self::getSignContent($params); | |||
$config = self::getAliPayConfig(); | |||
$priKey = $config['merchant_private_key']; | |||
$res = "-----BEGIN RSA PRIVATE KEY-----\n" . | |||
wordwrap($priKey, 64, "\n", true) . | |||
"\n-----END RSA PRIVATE KEY-----"; | |||
openssl_sign($content, $sign, $res); | |||
$sign = base64_encode($sign); | |||
return $sign; | |||
} | |||
/** | |||
* Function Description:获取参数配置 | |||
* Function Name: getAliPayConfig | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function getAliPayConfig() | |||
{ | |||
if (self::$aliPayConfig == null) { | |||
$payConfig = require ROOT_PATH . '/common/config/aliConfig/payConfig.php'; | |||
$siteConfig = Util::getSiteConfig(); | |||
self::$aliPayConfig = $payConfig[$siteConfig['aliPay']]; | |||
} | |||
return self::$aliPayConfig; | |||
} | |||
/** | |||
* Function Description:将数组转换为符合阿里支付的路由参�? | |||
* Function Name: getSignContent | |||
* @param $params | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function getSignContent($params) | |||
{ | |||
ksort($params); | |||
$stringToBeSigned = ""; | |||
$i = 0; | |||
foreach ($params as $k => $v) { | |||
if (false === self::checkEmpty($v) && "@" != substr($v, 0, 1)) { | |||
// 转换成目标字符集 | |||
$v = self::characet($v, 'utf-8'); | |||
if ($i == 0) { | |||
$stringToBeSigned .= "$k" . "=" . "$v"; | |||
} else { | |||
$stringToBeSigned .= "&" . "$k" . "=" . "$v"; | |||
} | |||
$i++; | |||
} | |||
} | |||
unset ($k, $v); | |||
return $stringToBeSigned; | |||
} | |||
/** | |||
* Function Description:校验$value是否非空 | |||
* Function Name: checkEmpty | |||
* @param $value | |||
* | |||
* @return bool | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
private static function checkEmpty($value) | |||
{ | |||
if (!isset($value)) { | |||
return true; | |||
} | |||
if ($value === null) { | |||
return true; | |||
} | |||
if (trim($value) === "") { | |||
return true; | |||
} | |||
return false; | |||
} | |||
/** | |||
* Function Description:转换字符集编�? | |||
* Function Name: characet | |||
* @param $data | |||
* @param $targetCharset | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
private static function characet($data, $targetCharset) | |||
{ | |||
if (!empty($data)) { | |||
$fileType = 'utf-8'; | |||
if (strcasecmp($fileType, $targetCharset) != 0) { | |||
$data = mb_convert_encoding($data, $targetCharset); | |||
} | |||
} | |||
return $data; | |||
} | |||
} |
@@ -0,0 +1,196 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |||
<meta charset="utf-8"> | |||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> | |||
<!-- 控制浏览器缓存--> | |||
<meta http-equiv="Cache-Control" content="no-store"> | |||
<!-- 优先使用 IE 最新版本和 Chrome--> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |||
<!-- 页面描述--> | |||
<meta name="description" content="不超过150个字符"> | |||
<!-- 页面关键词--> | |||
<meta name="keywords" content=""> | |||
<title>支付金额</title> | |||
<style> | |||
* { | |||
margin: 0; | |||
padding: 0; | |||
box-sizing: border-box; | |||
} | |||
html, | |||
body { | |||
height: 100%; | |||
overflow: hidden; | |||
} | |||
.clearfix:after { | |||
content: "\200B"; | |||
display: block; | |||
height: 0; | |||
clear: both; | |||
} | |||
.clearfix { | |||
*zoom: 1; | |||
} | |||
/*IE/7/6*/ | |||
.shuru div::-webkit-scrollbar { | |||
width: 0; | |||
height: 0; | |||
-webkit-transition: 1s; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb { | |||
background-color: #a7afb4; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb:hover { | |||
background-color: #525252; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-track-piece { | |||
background-color: #ccd0d2; | |||
} | |||
.wrap { | |||
position: relative; | |||
margin: auto; | |||
max-width: 640px; | |||
min-width: 320px; | |||
width: 100%; | |||
height: 100%; | |||
background: #F0EFF5; | |||
overflow: hidden; | |||
} | |||
.layer-content { | |||
position: absolute; | |||
left: 50%; | |||
bottom: -200px; | |||
width: 100%; | |||
max-width: 640px; | |||
height: auto; | |||
z-index: 12; | |||
-webkit-transform: translateX(-50%); | |||
transform: translateX(-50%); | |||
} | |||
/* 输入表单 */ | |||
.edit_cash { | |||
display: block; | |||
margin-top: 15px; | |||
padding: 15px; | |||
margin: 0 auto; | |||
width: 90%; | |||
border: 1px solid #CFCFCF; | |||
border-radius: 10px; | |||
background-color: #fff; | |||
} | |||
.edit_cash p { | |||
font-size: 14px; | |||
color: #8D8D8F; | |||
} | |||
.shuru { | |||
position: relative; | |||
margin-bottom: 10px; | |||
} | |||
.shuru div { | |||
border: none; | |||
width: 100%; | |||
height: 50px; | |||
font-size: 25px; | |||
line-height: 50px; | |||
border-bottom: 1px solid #CFCFCF; | |||
text-indent: 30px; | |||
outline: none; | |||
white-space: pre; | |||
overflow-x: scroll; | |||
} | |||
.shuru span { | |||
position: absolute; | |||
top: 5px; | |||
font-size: 25px; | |||
} | |||
.submit { | |||
display: block; | |||
margin: 20px auto 0; | |||
width: 90%; | |||
height: 40px; | |||
font-size: 16px; | |||
color: #fff; | |||
background: #80D983; | |||
border: 1px solid #47D14C; | |||
border-radius: 3px; | |||
} | |||
/* 键盘 */ | |||
.form_edit { | |||
width: 100%; | |||
background: #D1D4DD; | |||
} | |||
.form_edit > div { | |||
margin-bottom: 2px; | |||
margin-right: 0.5%; | |||
float: left; | |||
width: 33%; | |||
height: 45px; | |||
text-align: center; | |||
color: #333; | |||
line-height: 45px; | |||
font-size: 18px; | |||
font-weight: 600; | |||
background-color: #fff; | |||
border-radius: 5px; | |||
} | |||
.form_edit > div:nth-child(3n) { | |||
margin-right: 0; | |||
} | |||
.form_edit > div:last-child { | |||
background-color: #DEE1E9; | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<div class="wrap" style="padding-top: 20px;"> | |||
<div style="text-align: left;font-size: 24px;font-weight: 900;margin-bottom: 5px;margin-left: 35px"><?php echo $orderInfo['pro_cate_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px;">购买数量:<?php echo $orderInfo['prod_cnt']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">联系人:<?php echo $orderInfo['contacts_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">手机号:<?php echo $orderInfo['contacts_phone']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">出游时间:<?php echo $orderInfo['run_time']; ?></div> | |||
<form action="" class="edit_cash"> | |||
<p>消费总额</p> | |||
<div class="shuru"> | |||
<span>¥</span> | |||
<div id="div"><?php echo $params['total_fee']; ?></div> | |||
</div> | |||
</form> | |||
<input value="确认支付" class="submit" type="button" onclick="call();"> | |||
<?php echo $info; ?> | |||
</div> | |||
</body> | |||
<script type="text/javascript"> | |||
function call() { | |||
document.forms['alipaysubmit'].submit(); | |||
} | |||
</script> | |||
</html> |
@@ -0,0 +1,198 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |||
<meta charset="utf-8"> | |||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> | |||
<!-- 控制浏览器缓存--> | |||
<meta http-equiv="Cache-Control" content="no-store"> | |||
<!-- 优先使用 IE 最新版本和 Chrome--> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |||
<!-- 页面描述--> | |||
<meta name="description" content="不超过150个字符"> | |||
<!-- 页面关键词--> | |||
<meta name="keywords" content=""> | |||
<title>支付金额</title> | |||
<style> | |||
* { | |||
margin: 0; | |||
padding: 0; | |||
box-sizing: border-box; | |||
} | |||
html, | |||
body { | |||
height: 100%; | |||
overflow: hidden; | |||
} | |||
.clearfix:after { | |||
content: "\200B"; | |||
display: block; | |||
height: 0; | |||
clear: both; | |||
} | |||
.clearfix { | |||
*zoom: 1; | |||
} | |||
/*IE/7/6*/ | |||
.shuru div::-webkit-scrollbar { | |||
width: 0; | |||
height: 0; | |||
-webkit-transition: 1s; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb { | |||
background-color: #a7afb4; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb:hover { | |||
background-color: #525252; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-track-piece { | |||
background-color: #ccd0d2; | |||
} | |||
.wrap { | |||
position: relative; | |||
margin: auto; | |||
max-width: 640px; | |||
min-width: 320px; | |||
width: 100%; | |||
height: 100%; | |||
background: #F0EFF5; | |||
overflow: hidden; | |||
} | |||
.layer-content { | |||
position: absolute; | |||
left: 50%; | |||
bottom: -200px; | |||
width: 100%; | |||
max-width: 640px; | |||
height: auto; | |||
z-index: 12; | |||
-webkit-transform: translateX(-50%); | |||
transform: translateX(-50%); | |||
} | |||
/* 输入表单 */ | |||
.edit_cash { | |||
display: block; | |||
margin-top: 15px; | |||
padding: 15px; | |||
margin: 0 auto; | |||
width: 90%; | |||
border: 1px solid #CFCFCF; | |||
border-radius: 10px; | |||
background-color: #fff; | |||
} | |||
.edit_cash p { | |||
font-size: 14px; | |||
color: #8D8D8F; | |||
} | |||
.shuru { | |||
position: relative; | |||
margin-bottom: 10px; | |||
} | |||
.shuru div { | |||
border: none; | |||
width: 100%; | |||
height: 50px; | |||
font-size: 25px; | |||
line-height: 50px; | |||
border-bottom: 1px solid #CFCFCF; | |||
text-indent: 30px; | |||
outline: none; | |||
white-space: pre; | |||
overflow-x: scroll; | |||
} | |||
.shuru span { | |||
position: absolute; | |||
top: 5px; | |||
font-size: 25px; | |||
} | |||
.submit { | |||
display: block; | |||
margin: 20px auto 0; | |||
width: 90%; | |||
height: 40px; | |||
font-size: 16px; | |||
color: #fff; | |||
background: #80D983; | |||
border: 1px solid #47D14C; | |||
border-radius: 3px; | |||
} | |||
/* 键盘 */ | |||
.form_edit { | |||
width: 100%; | |||
background: #D1D4DD; | |||
} | |||
.form_edit > div { | |||
margin-bottom: 2px; | |||
margin-right: 0.5%; | |||
float: left; | |||
width: 33%; | |||
height: 45px; | |||
text-align: center; | |||
color: #333; | |||
line-height: 45px; | |||
font-size: 18px; | |||
font-weight: 600; | |||
background-color: #fff; | |||
border-radius: 5px; | |||
} | |||
.form_edit > div:nth-child(3n) { | |||
margin-right: 0; | |||
} | |||
.form_edit > div:last-child { | |||
background-color: #DEE1E9; | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<div class="wrap" style="padding-top: 20px;"> | |||
<div style="text-align: left;font-size: 24px;font-weight: 900;margin-bottom: 5px;margin-left: 35px"><?php echo $orderInfo['pro_cate_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px;">购买数量:<?php echo $orderInfo['prod_cnt']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">联系人:<?php echo $orderInfo['contacts_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">手机号:<?php echo $orderInfo['contacts_phone']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">出游时间:<?php echo $orderInfo['run_time']; ?></div> | |||
<form action="" class="edit_cash"> | |||
<p>消费总额</p> | |||
<div class="shuru"> | |||
<span>¥</span> | |||
<div id="div"><?php echo $params['total_fee']; ?></div> | |||
</div> | |||
</form> | |||
<!-- <input value="微信支付" class="submit" type="button" onclick="wx_call();">--> | |||
<input value="支付宝支付" class="submit" type="button" onclick="ali_call();"> | |||
<?php echo $ali_info; ?> | |||
</div> | |||
</body> | |||
<script type="text/javascript"> | |||
function ali_call() { | |||
document.forms['alipaysubmit'].submit(); | |||
} | |||
</script> | |||
</html> |
@@ -0,0 +1,451 @@ | |||
<?php | |||
/** | |||
* 接口调用 | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm CurlInterface.php | |||
* Create By 2016/11/10 13:20 $ | |||
*/ | |||
namespace common\util; | |||
class CurlInterface | |||
{ | |||
protected $url = null; | |||
protected $verb = 'GET'; | |||
protected $body = ''; | |||
protected $requestLength = 0; | |||
protected $baseUrl = null; | |||
protected $timeOut = 200; | |||
protected $clientId = 1;//站点类型 1 微信 | |||
protected $responseBody = null;//接收到的返回值 | |||
protected $notReturn = false; //是否有返回值 | |||
protected $siteConfig = null; //配置参数 | |||
protected $curlGetInfo = null;//交易概要 | |||
private $logMessage = ''; //日志内容 | |||
private $curlOptHeader = 0; //是否返回头部信息 | |||
private $bodyType = 1; | |||
private $cert = false;//是否使用证书 | |||
private $certPem; | |||
private $keyPem; | |||
/****************============类的初始化=============*******************/ | |||
/** | |||
* @param null $body 2:xml | |||
* @param int $type 1:json 2:xml 3 发送原数据接收xml 4 发送原数据 接收json 5:都是原数据 | |||
*/ | |||
public function __construct($body = null, $type = 1) | |||
{ | |||
$this->setBody($body, $type); | |||
$this->setBaseUrl(); | |||
} | |||
/*****************==========参数设置函数开始=========******************/ | |||
/** | |||
* Function Description:设置是否返回头部信息 | |||
* Function Name: setCurlOptHeader | |||
* @param $curlOptHeader | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setCurlOptHeader($curlOptHeader) | |||
{ | |||
$this->curlOptHeader = $curlOptHeader; | |||
} | |||
/** | |||
* Function Description:获取交易概要 | |||
* Function Name: getCurlGetInfo | |||
* | |||
* @return null | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function getCurlGetInfo() | |||
{ | |||
return $this->curlGetInfo; | |||
} | |||
/** | |||
* Function Description:获取返回值报文 | |||
* Function Name: getResponseBody | |||
* | |||
* @return null | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function getResponseBody() | |||
{ | |||
return $this->responseBody; | |||
} | |||
/** | |||
* Function Description:获取全路径地址 | |||
* Function Name: getUrl | |||
* | |||
* @return null | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function getUrl() | |||
{ | |||
return $this->url; | |||
} | |||
/** | |||
* Function Description:设置路径 在baseUrl基础上 | |||
* Function Name: setUrl | |||
* @param $url | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setUrl($url) | |||
{ | |||
$this->url = $this->baseUrl . $url; | |||
} | |||
/** | |||
* Function Description:设置过期时间 | |||
* Function Name: setTimeOut | |||
* @param $timeOut | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setTimeOut($timeOut) | |||
{ | |||
$this->timeOut = $timeOut; | |||
} | |||
/** | |||
* Function Description:设置传值方式 | |||
* Function Name: setVerb | |||
* @param $verb | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setVerb($verb) | |||
{ | |||
$this->verb = $verb; | |||
} | |||
/** | |||
* Function Description:设置baseUrl | |||
* Function Name: setBaseUrl | |||
* @param $baseUrl string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setBaseUrl($baseUrl = '') | |||
{ | |||
$this->baseUrl = $baseUrl; | |||
} | |||
/** | |||
* Function Description:获取BaseUrl | |||
* Function Name: getBaseUrl | |||
* | |||
* @return null | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function getBaseUrl() | |||
{ | |||
return $this->baseUrl; | |||
} | |||
/** | |||
* Function Description:设置是否有返回值 | |||
* Function Name: setNotReturn | |||
* @param $str | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setNotReturn($str) | |||
{ | |||
$this->notReturn = $str; | |||
} | |||
/** | |||
* Function Description:设置请求报文 $body 必须是个数组 | |||
* Function Name: setBody | |||
* @param $body | |||
* @param $type int 1:json 2:xml 3 发送原数据接收xml 4 发送原数据 接收json 5:都是原数据 | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setBody($body, $type = 1) | |||
{ | |||
$this->body = ''; | |||
if (is_array($body)) { | |||
if ($type == 1) { | |||
$this->body = json_encode($body); | |||
$this->requestLength = strlen($this->body); | |||
} elseif ($type == 2) { | |||
$this->body = Util::arrayToXml($body); | |||
$this->requestLength = strlen($this->body); | |||
} elseif (in_array($type, array(3, 4, 5))) { | |||
$this->body = $body; | |||
} | |||
} else { | |||
$this->body = $body; | |||
} | |||
$this->bodyType = $type; | |||
} | |||
/** | |||
* Function Description:设置ssl类型 | |||
* Function Name: setCert | |||
* @param $certArr array | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public function setCert($certArr) | |||
{ | |||
$this->cert = true; | |||
$this->certPem = $certArr['SSLCERT_PATH']; | |||
$this->keyPem = $certArr['SSLKEY_PATH']; | |||
} | |||
/*****************==========参数设置函数结束=========******************/ | |||
/*****************==========调用接口并返回结果===开始======******************/ | |||
/** | |||
* Function Description:执行交易 | |||
* Function Name: execute | |||
* | |||
* @param $url string sap地址 | |||
* @param $verb string 请求方式 post|get | |||
* | |||
* @return array | |||
* | |||
* @author nizongfeng | |||
* Modify Date:2016.11.10 | |||
*/ | |||
public function execute($url, $verb = 'GET') | |||
{ | |||
$this->verb = $verb; | |||
$this->url = $this->baseUrl . $url; | |||
$this->logMessage .= date('Y-m-d H:i:s') . " Url : {$this->url}"; | |||
$this->logMessage .= ' Method:' . $this->verb; | |||
if (is_array($this->body)) { | |||
$this->logMessage .= "sendContent: " . print_r($this->body, 1) . PHP_EOL; | |||
} else { | |||
$this->logMessage .= "sendContent: {$this->body}" . PHP_EOL; | |||
} | |||
$ch = curl_init($this->url); | |||
try { | |||
switch (strtoupper($this->verb)) { | |||
case 'GET': | |||
$this->executeGet($ch); | |||
break; | |||
case 'POST': | |||
$this->executePost($ch); | |||
break; | |||
case 'PUT': | |||
$this->executePut($ch); | |||
break; | |||
case 'DELETE': | |||
$this->executeDelete($ch); | |||
break; | |||
default: | |||
$this->logMessage .= "current verb: {$this->verb}, is an invalid REST verb." . PHP_EOL; | |||
break; | |||
} | |||
} catch (\Exception $e) { | |||
$this->logMessage .= $e->getMessage() . PHP_EOL; | |||
} | |||
curl_close($ch); | |||
$ch = null; | |||
return $this->getResult(); | |||
} | |||
/** | |||
* Function Description:获取返回数据 | |||
* Function Name: getResult | |||
* | |||
* @return array|mixed | |||
* | |||
* @author nizongfeng | |||
* Modify Date:2016.11.10 | |||
*/ | |||
public function getResult() | |||
{ | |||
if (in_array($this->bodyType, array(1, 4))) { | |||
$return = json_decode($this->responseBody, true); | |||
} elseif (in_array($this->bodyType, array(2, 3))) { | |||
$return = Util::xmlToArray($this->responseBody); | |||
} elseif ($this->bodyType == 5) { | |||
$return = $this->responseBody; | |||
} else { | |||
$return = ''; | |||
} | |||
file_put_contents(APP_PATH . '/log/curl/' . date('Y-m-d') . '.log', $this->logMessage . PHP_EOL, FILE_APPEND); | |||
return $return; | |||
} | |||
/*******************=====GET传值=====********************/ | |||
/** | |||
* Function Description:GET传值 | |||
* Function Name: executeGet | |||
* @param $ch | |||
* | |||
* @return void | |||
* | |||
* @author nizongfeng 2016.11.10 | |||
*/ | |||
protected function executeGet($ch) | |||
{ | |||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); | |||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |||
$this->doExecute($ch); | |||
} | |||
/*******************=====POST传值=====********************/ | |||
/** | |||
* Function Description:POST传值 | |||
* Function Name: executePost | |||
* @param $ch | |||
* | |||
* @return void | |||
* | |||
* @author nizongfeng 2016.11.10 | |||
*/ | |||
protected function executePost($ch) | |||
{ | |||
// curl_setopt($ch, CURLOPT_VERBOSE, true); | |||
curl_setopt($ch, CURLOPT_POST, true); | |||
if (is_array($this->body)) { | |||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->body)); | |||
} else { | |||
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->body); | |||
} | |||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |||
$this->doExecute($ch); | |||
} | |||
/*******************=====PUT传值=====********************/ | |||
/** | |||
* Function Description:PUT传值 | |||
* Function Name: executePut | |||
* @param $ch | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
protected function executePut($ch) | |||
{ | |||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); | |||
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->body); | |||
$this->doExecute($ch); | |||
} | |||
/*******************=====DELETE传值=====********************/ | |||
/** | |||
* Function Description:DELETE传值 | |||
* Function Name: executeDelete | |||
* @param $ch | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
protected function executeDelete($ch) | |||
{ | |||
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->body); | |||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); | |||
$this->doExecute($ch); | |||
} | |||
/*******************=====传值及接收=====********************/ | |||
/** | |||
* Function Description: 传值及接受数据 | |||
* Function Name: doExecute | |||
* @param $curlHandle | |||
* | |||
* @return void | |||
* | |||
* @author nizongfeng 2015.12.08 | |||
*/ | |||
protected function doExecute(&$curlHandle) | |||
{ | |||
if ($this->verb != 'get') { | |||
$this->setCurlOpts($curlHandle); | |||
} | |||
curl_setopt($curlHandle, CURLOPT_HEADER, $this->curlOptHeader); | |||
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); | |||
curl_setopt($curlHandle, CURLOPT_TIMEOUT, $this->timeOut); | |||
//记录报文发送时间 | |||
$sendTime = microtime(true); | |||
$this->responseBody = curl_exec($curlHandle); | |||
//记录报文返回时间 | |||
$responseTime = microtime(true); | |||
$timeIncrement = round(floatval($responseTime - $sendTime), 3); | |||
//记录返回的报文信息 | |||
$this->logMessage .= "response: {$this->responseBody}" . PHP_EOL; | |||
$curlInfo = curl_getinfo($curlHandle); | |||
$this->curlGetInfo = $curlInfo; | |||
if (empty($curlInfo['primary_port'])) { | |||
$curlInfo['primary_port'] = ''; | |||
} | |||
$curlInfoStr = ''; | |||
if (isset($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_PORT']) { | |||
$curlInfoStr = " toIP {$curlInfo['primary_ip']}:{$curlInfo['primary_port']}"; | |||
$curlInfoStr .= " selfIP {$_SERVER['SERVER_ADDR']} {$_SERVER['SERVER_PORT']}"; | |||
} | |||
//记录通信信息及性能指标 | |||
$this->logMessage .= "Info: " . json_encode($curlInfoStr) . PHP_EOL; | |||
$this->logMessage .= "sendTime: " . date('H:i:s', $sendTime) . " , responseTime: "; | |||
$this->logMessage .= date('H:i:s', $responseTime) . " , timeIncrement:" . $timeIncrement . 's' | |||
. PHP_EOL; | |||
$curlError = curl_error($curlHandle); | |||
if ($curlError) { | |||
$this->logMessage .= "Error: " . $curlError . PHP_EOL; | |||
} | |||
} | |||
/*******************=====头部设置=====********************/ | |||
/** | |||
* Function Description:头部设置 | |||
* Function Name: setCurlOpts | |||
* @param $curlHandle | |||
* | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
protected function setCurlOpts(&$curlHandle) | |||
{ | |||
if ($this->cert == 1) { | |||
//设置证书 | |||
//使用证书:cert 与 key 分别属于两个.pem文件 | |||
curl_setopt($curlHandle, CURLOPT_SSLCERTTYPE, 'PEM'); | |||
curl_setopt($curlHandle, CURLOPT_SSLCERT, $this->certPem); | |||
curl_setopt($curlHandle, CURLOPT_SSLKEYTYPE, 'PEM'); | |||
curl_setopt($curlHandle, CURLOPT_SSLKEY, $this->keyPem); | |||
} | |||
} | |||
/*****************==========调用接口并返回结果===结束======******************/ | |||
} | |||
?> |
@@ -0,0 +1,224 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 付泓程 | |||
* PhpStorm EntranceHotelService.php | |||
* Create By 2017/5/15 16:08 $ | |||
*/ | |||
namespace common\util; | |||
use common\models\ProdCategory; | |||
use common\models\ProdMain; | |||
class EntranceHotelService | |||
{ | |||
/** | |||
* Des:获取酒店产品初始化数据 | |||
* Name: getInitialize | |||
* @param $prod_cate_id | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getInitialize($prod_cate_id) | |||
{ | |||
if (Util::checkPattern('intVal', $prod_cate_id) == false) { | |||
return Util::returnArrEr('params error'); | |||
} | |||
/**获取产品信息*/ | |||
$prodCate = new ProdCategory(); | |||
$prodInfo = $prodCate->getProdDetail($prod_cate_id); | |||
// return Util::returnArrSu('fda',$prodInfo); | |||
if (!isset($prodInfo['category_id']) || $prodInfo['category_id'] != 3) { | |||
return Util::returnArrEr('该产品不是酒店产品!'); | |||
} | |||
/**获取产品的价格日历*/ | |||
$getDatePriceList = $this->getDatePriceList($prodInfo); | |||
if ($getDatePriceList['flag'] == false) { | |||
return $getDatePriceList; | |||
} | |||
$datePriceList = $getDatePriceList['data']; | |||
$prodInfo['date_list'] = $datePriceList; | |||
$keys = array_keys($datePriceList);//将数组的健组成一个数组 | |||
$date = $keys[0];//取健的第一个值为默认日期 | |||
$prodInfo['date'] = $date; | |||
/**获取产品的价格列表*/ | |||
$getProdArr = $this->getProdArr($prodInfo, $date); | |||
if ($getProdArr['flag'] == false) { | |||
return $getProdArr; | |||
} | |||
$prodInfo['prod_arr'] = $getProdArr['data']; | |||
return Util::returnArrSu('', $prodInfo); | |||
} | |||
/** | |||
* Des:获取价格日历 | |||
* Name: getDatePriceList | |||
* @param $prodInfo | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getDatePriceList($prodInfo) | |||
{ | |||
if (empty($prodInfo['sign']) == false) {//如果不是cs的巴士 | |||
$siteConfig = Util::getSiteConfig(); | |||
$time = time(); | |||
$data = [ | |||
'auth_code' => Util::authCodeForCs($time), | |||
'user_key' => $siteConfig['adm_user_key'], | |||
'user' => $siteConfig['adm_user'], | |||
'user_id' => $siteConfig['adm_user_id'], | |||
'request_time' => $time, | |||
'action' => 'gate_ticket_mini_value', | |||
'sign' => $prodInfo['sign'], | |||
]; | |||
$curl = new CurlInterface($data, 4); | |||
// $result = $curl->execute($siteConfig['adm_host1'] . '/api/nfx', 'POST'); | |||
// if (!isset($result['code']) || $result['code'] != '0' || count($result['list']) == 0) { | |||
// return Util::returnArrEr('产品已售完!'); | |||
// } | |||
$result = ["code"=>"0","info"=>"","list"=>[ | |||
["ticket_date"=>"2017-05-09","ticket_time"=>"","mini_price"=>"509.00"], | |||
["ticket_date"=>"2017-05-12","ticket_time"=>"","mini_price"=>"512.00"], | |||
["ticket_date"=>"2017-05-15","ticket_time"=>"","mini_price"=>"515.00"] | |||
] | |||
]; | |||
$datePriceList = []; | |||
foreach ($result['list'] as $val) { | |||
$datePriceList[$val['ticket_date']] = $val['mini_price']; | |||
} | |||
} else { | |||
$endDate = strtotime(date('Y-m-01') . " +4 month -1 day");//获取第三个月的最后一天 | |||
$_time = range(strtotime(date('Y-m-d')), $endDate, 24 * 60 * 60); | |||
$_time = array_map(create_function('$v', 'return date("Y-m-d", $v);'), $_time); | |||
$datePriceList = array_fill_keys($_time, $this->dealFloat($prodInfo['show_price'])); | |||
} | |||
return Util::returnArrSu('', $datePriceList); | |||
} | |||
/** | |||
* Des:获取品类的产品列表 | |||
* Name: getProdArr | |||
* @param $prodInfo | |||
* @param $date | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getProdArr($prodInfo, $date) | |||
{ | |||
$prodMain = new ProdMain(); | |||
// $prodArray = $prodMain->getProdArr($prodInfo['pro_cate_id']);//获取本地存储的酒店品类下的酒店房型产品 | |||
if (empty($prodInfo['sign']) == false) { | |||
$result = $this->getCsPro($prodInfo, $date); | |||
if (!isset($result['code']) || $result['code'] != '0' || count($result['product_list']) == 0) { | |||
return Util::returnArrEr('系统繁忙,请稍后再试!'); | |||
} | |||
//对数据进行整合 | |||
// $csProdArr = $result['product_list']; | |||
// foreach ($prodArray as $key => $val) { | |||
// $prod = false; | |||
// foreach ($csProdArr as $csVal) { | |||
// if ($csVal['prod_id'] == $val['bus_id']) { | |||
// $prod = true; | |||
// $prodArray[$key]['prod_count'] = $csVal['ticket_num']; | |||
// $prodArray[$key]['prod_price'] = intval(ceil($csVal['ticket_price'])) ; | |||
// break; | |||
// } | |||
// } | |||
// if ($prod == false) {//当这个产品在cs那边不存在的话 则删除该产品 | |||
// unset($prodArray[$key]); | |||
// } | |||
// } | |||
$prodArray = array_values($result['product_list']); | |||
} | |||
return Util::returnArrSu('', $prodArray); | |||
} | |||
/** | |||
* Des:获取品类某天的产品列表 | |||
* Name: getProdArrForDate | |||
* @param $params | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getProdArrForDate($params) | |||
{ | |||
if (Util::checkPattern('intVal', $params['prod_cate_id']) == false) { | |||
return Util::returnArrEr('params error'); | |||
} | |||
/**获取产品品类信息*/ | |||
$prodCate = new ProdCategory(); | |||
$prodInfo = $prodCate->getProdDetail($params['prod_cate_id']); | |||
if (!isset($prodInfo['category_id']) || $prodInfo['category_id'] != 3) { | |||
return Util::returnArrEr('该产品不是酒店产品!'); | |||
} | |||
/**获取的品类的产品列表*/ | |||
$getProdArr = $this->getProdArr($prodInfo, $params['date']); | |||
if ($getProdArr['flag'] == false) { | |||
return $getProdArr; | |||
} | |||
$return['prod_arr'] = $getProdArr['data']; | |||
return Util::returnArrSu('', $return); | |||
} | |||
/** | |||
* Des:获取cs酒店产品 | |||
* Name: getCsPro | |||
* @param $prodInfo | |||
* @param $date | |||
* @return array | |||
* @author 付泓程 | |||
*/ | |||
public function getCsPro($prodInfo, $date) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
$time = time(); | |||
$data = [ | |||
'auth_code' => Util::authCodeForCs($time), | |||
'user_key' => $siteConfig['adm_user_key'], | |||
'user' => $siteConfig['adm_user'], | |||
'user_id' => $siteConfig['adm_user_id'], | |||
'request_time' => $time, | |||
'action' => 'gate_ticket_date_run', | |||
'sign' => $prodInfo['sign'], | |||
'date' => $date | |||
]; | |||
// $curl = new CurlInterface($data, 4); | |||
// $result = $curl->execute($siteConfig['adm_host1'] . '/api/nfx', 'POST');//获取cs的门票产品 | |||
$curl = new CurlInterface($data,4); | |||
$result = $curl->execute('http://cs.zhizhuchuxing.com/zz-jd/st-ht/HTcontrol.php?type=order_ChooseProduct&key_word=&room_name=¤t_page=1&page_size=25','GET'); | |||
// $result = []; | |||
return $result; | |||
} | |||
/** | |||
* Function Description:处理价格 | |||
* Function Name: dealFloat | |||
* @param $float | |||
* | |||
* @return float | |||
* | |||
* @author LUOCJ | |||
*/ | |||
public function dealFloat($float) | |||
{ | |||
$int = floor($float); | |||
if ($float - $int == 0) { | |||
$float = $int; | |||
} | |||
return $float; | |||
} | |||
} |
@@ -0,0 +1,292 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm EntranceTicketService.php | |||
* Create By 2017/3/20 16:14 $ | |||
*/ | |||
namespace common\util; | |||
use common\models\ProdCategory; | |||
use common\models\ProdMain; | |||
class EntranceTicketService | |||
{ | |||
/** | |||
* Function Description:处理价格 | |||
* Function Name: dealFloat | |||
* @param $float | |||
* | |||
* @return float | |||
* | |||
* @author LUOCJ | |||
*/ | |||
public function dealFloat($float) | |||
{ | |||
$int = floor($float); | |||
if ($float - $int == 0) { | |||
$float = $int; | |||
} | |||
return $float; | |||
} | |||
/** | |||
* Des:获取门票产品初始化数据 | |||
* Name: getInitialize | |||
* @param $prod_cate_id | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getInitialize($prod_cate_id) | |||
{ | |||
if (Util::checkPattern('intVal', $prod_cate_id) == false) { | |||
return Util::returnArrEr('params error'); | |||
} | |||
/**获取产品信息*/ | |||
$prodCate = new ProdCategory(); | |||
$prodInfo = $prodCate->getProdDetail($prod_cate_id); | |||
if (!isset($prodInfo['category_id']) || $prodInfo['category_id'] != 2) { | |||
return Util::returnArrEr('该产品不是门票产品!'); | |||
} | |||
/**获取产品的价格日历*/ | |||
$getDatePriceList = $this->getDatePriceList($prodInfo); | |||
if ($getDatePriceList['flag'] == false) { | |||
return $getDatePriceList; | |||
} | |||
$datePriceList = $getDatePriceList['data']; | |||
$prodInfo['date_list'] = $datePriceList; | |||
$keys = array_keys($datePriceList);//将数组的健组成一个数组 | |||
$date = $keys[0];//取健的第一个值为默认日期 | |||
$prodInfo['date'] = $date; | |||
/**获取产品的价格列表*/ | |||
$getProdArr = $this->getProdArr($prodInfo, $date); | |||
if ($getProdArr['flag'] == false) { | |||
return $getProdArr; | |||
} | |||
$prodInfo['prod_arr'] = $getProdArr['data']; | |||
return Util::returnArrSu('', $prodInfo); | |||
} | |||
/** | |||
* Des:获取价格日历 | |||
* Name: getDatePriceList | |||
* @param $prodInfo | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getDatePriceList($prodInfo) | |||
{ | |||
if (empty($prodInfo['sign']) == false) {//如果是cs的门票 | |||
$siteConfig = Util::getSiteConfig(); | |||
$time = time(); | |||
$data = [ | |||
'auth_code' => Util::authCodeForCs($time), | |||
'user_key' => $siteConfig['adm_user_key'], | |||
'user' => $siteConfig['adm_user'], | |||
'user_id' => $siteConfig['adm_user_id'], | |||
'request_time' => $time, | |||
'action' => 'gate_ticket_mini_value', | |||
'sign' => $prodInfo['sign'], | |||
]; | |||
$curl = new CurlInterface($data, 4); | |||
$result = $curl->execute($siteConfig['adm_host1'] . '/api/nfx', 'POST'); | |||
if (!isset($result['code']) || $result['code'] != '0' || count($result['list']) == 0) { | |||
return Util::returnArrEr('产品已售完!'); | |||
} | |||
$datePriceList = []; | |||
foreach ($result['list'] as $val) { | |||
$datePriceList[$val['ticket_date']] = $val['mini_price']; | |||
} | |||
//判断售卖截止时间差 | |||
$s_time_h = $prodInfo['close_sale_time']; | |||
$_time_new = array(); | |||
foreach ($datePriceList as $k => $v) { | |||
//得到能卖的时间 | |||
// $v.=" 00:00:00"; | |||
$s_time = strtotime($k) + $s_time_h * 60 * 60; | |||
//能卖的时间和当前时间比较 | |||
$currdate = time(); | |||
if ($s_time > $currdate) { | |||
$_time_new[$k] = $v; | |||
} | |||
} | |||
$datePriceList = $_time_new; | |||
} else { | |||
$endDate = strtotime(date('Y-m-01') . " +4 month -1 day");//获取第三个月的最后一天 | |||
$_time = range(strtotime(date('Y-m-d')), $endDate, 24 * 60 * 60); | |||
$_time = array_map(create_function('$v', 'return date("Y-m-d", $v);'), $_time); | |||
//判断售卖截止时间差 | |||
$s_time_h = $prodInfo['close_sale_time']; | |||
$_time_new = array(); | |||
foreach ($_time as $k => $v) { | |||
//得到能卖的时间 | |||
// $v.=" 00:00:00"; | |||
$s_time = strtotime($v) + $s_time_h * 60 * 60; | |||
//能卖的时间和当前时间比较 | |||
$currdate = time(); | |||
if ($s_time > $currdate) { | |||
$_time_new[] = $v; | |||
} | |||
} | |||
$datePriceList = array_fill_keys($_time_new, $this->dealFloat($prodInfo['show_price'])); | |||
} | |||
return Util::returnArrSu('', $datePriceList); | |||
} | |||
/** | |||
* Des:获取品类的产品列表 | |||
* Name: getProdArr | |||
* @param $prodInfo | |||
* @param $date | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getProdArr($prodInfo, $date) | |||
{ | |||
$prodMain = new ProdMain(); | |||
$prodArray = $prodMain->getProdArr($prodInfo['pro_cate_id']);//获取本地存储的门票品类下的门票产品 | |||
if (empty($prodInfo['sign']) == false) { | |||
$result = $this->getCsPro($prodInfo, $date); | |||
if (!isset($result['code']) || $result['code'] != '0' || count($result['list']) == 0) { | |||
return Util::returnArrEr('系统繁忙,请稍后再试!'); | |||
} | |||
//对数据进行整合 | |||
$csProdArr = $result['list']; | |||
foreach ($prodArray as $key => $val) { | |||
$prod = false; | |||
foreach ($csProdArr as $csVal) { | |||
if ($csVal['prod_id'] == $val['bus_id']) { | |||
if (Util::checkPattern('intVal', $csVal['ticket_num'])) { | |||
$prod = true; | |||
$prodArray[$key]['prod_count'] = $csVal['ticket_num']; | |||
$prodArray[$key]['prod_price'] = $csVal['ticket_price']; | |||
break; | |||
} | |||
} | |||
} | |||
if ($prod == false) {//当这个产品在cs那边不存在的话 则删除该产品 | |||
unset($prodArray[$key]); | |||
} | |||
} | |||
$prodArray = array_values($prodArray); | |||
} | |||
foreach($prodArray as &$v){ | |||
$v['prod_price'] = $this->dealFloat($v['prod_price']); | |||
} | |||
return Util::returnArrSu('', $prodArray); | |||
} | |||
/** | |||
* Des:获取品类某天的产品列表 | |||
* Name: getProdArrForDate | |||
* @param $params | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getProdArrForDate($params) | |||
{ | |||
if (Util::checkPattern('intVal', $params['prod_cate_id']) == false) { | |||
return Util::returnArrEr('params error'); | |||
} | |||
/**获取产品品类信息*/ | |||
$prodCate = new ProdCategory(); | |||
$prodInfo = $prodCate->getProdDetail($params['prod_cate_id']); | |||
if (!isset($prodInfo['category_id']) || $prodInfo['category_id'] != 2) { | |||
return Util::returnArrEr('该产品不是门票产品!'); | |||
} | |||
/**获取的品类的产品列表*/ | |||
$getProdArr = $this->getProdArr($prodInfo, $params['date']); | |||
if ($getProdArr['flag'] == false) { | |||
return $getProdArr; | |||
} | |||
$return['prod_arr'] = $getProdArr['data']; | |||
return Util::returnArrSu('', $return); | |||
} | |||
/** | |||
* Des:获取cs门票产品 | |||
* Name: getCsPro | |||
* @param $prodInfo | |||
* @param $date | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getCsPro($prodInfo, $date) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
$time = time(); | |||
$data = [ | |||
'auth_code' => Util::authCodeForCs($time), | |||
'user_key' => $siteConfig['adm_user_key'], | |||
'user' => $siteConfig['adm_user'], | |||
'user_id' => $siteConfig['adm_user_id'], | |||
'request_time' => $time, | |||
'action' => 'gate_ticket_date_run', | |||
'sign' => $prodInfo['sign'], | |||
'date' => $date | |||
]; | |||
$curl = new CurlInterface($data, 4); | |||
$result = $curl->execute($siteConfig['adm_host1'] . '/api/nfx', 'POST');//获取cs的门票产品 | |||
return $result; | |||
} | |||
/** | |||
* Des:获取cs系统门票订单产品价格 | |||
* Name: getOrderPriceFromCs | |||
* @param $prodInfo | |||
* @param $date | |||
* @param $order_prod_arr | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public function getOrderPriceFromCs($prodInfo, $date, $order_prod_arr) | |||
{ | |||
$prodMain = new ProdMain(); | |||
$prodArray = $prodMain->getProdArr($prodInfo['pro_cate_id']);//获取本地存储的门票品类下的门票产品 | |||
$result = $this->getCsPro($prodInfo, $date); | |||
if (!isset($result['code']) || $result['code'] != '0' || count($result['list']) == 0) { | |||
return Util::returnArrEr('系统繁忙,请稍后再试!'); | |||
} | |||
//对数据进行整合 | |||
$csProdArr = $result['list']; | |||
$csOrderProdParams = []; | |||
/**将数据拼接成cs产品ID对应产品数量的格式**/ | |||
foreach ($order_prod_arr as $orderProd) { | |||
foreach ($prodArray as $val) { | |||
if ($orderProd['prod_id'] == $val['prod_id']) { | |||
$csOrderProdParams[$val['bus_id']] = [ | |||
'prod_id' => $val['bus_id'], | |||
'prod_cnt' => $orderProd['prod_count'] | |||
]; | |||
break; | |||
} | |||
} | |||
} | |||
/**根据cs产品格式计算价格**/ | |||
$price = 0; | |||
foreach ($csProdArr as $csPro) { | |||
if (isset($csOrderProdParams[$csPro['prod_id']])) { | |||
$theProd = $csOrderProdParams[$csPro['prod_id']]; | |||
$price += $theProd['prod_cnt'] * ceil($csPro['ticket_price']); | |||
} | |||
} | |||
return Util::returnArrSu('', $price); | |||
} | |||
} |
@@ -0,0 +1,108 @@ | |||
<?php | |||
/** | |||
* 分销用户钱包 | |||
* Created by PhpStorm. | |||
* User: admin | |||
* Date: 2017/5/4 | |||
* Time: 10:29 | |||
*/ | |||
namespace common\util; | |||
use common\models\FxUserAccount; | |||
use common\models\FxUserAmountLog; | |||
use common\models\OrderMain; | |||
class FxAmount | |||
{ | |||
/** | |||
* 余额支付 | |||
* @param $fx_uid | |||
* @param $amount | |||
* @return array | |||
*/ | |||
public static function pay($fx_uid, $amount) | |||
{ | |||
/****判断余额是否充足***/ | |||
$fxUserAccount = new FxUserAccount(); | |||
$info = $fxUserAccount->getMyCommission($fx_uid); | |||
if ($info['remaining_sum'] < $amount) { | |||
return Util::returnArrEr('账户余额不足!'); | |||
} | |||
/**扣除余额**/ | |||
$flag = $fxUserAccount->deductAmount($fx_uid, $amount); | |||
if ($flag) { | |||
static::addLog($fx_uid, 2, $amount, ''); | |||
return Util::returnArrSu(); | |||
} else { | |||
return Util::returnArrEr('余额支付失败!'); | |||
} | |||
} | |||
/** | |||
* 退款 | |||
* @param $fx_uid | |||
* @param $amount | |||
* @return array | |||
*/ | |||
public static function refund($fx_uid, $amount) | |||
{ | |||
$fxUserAccount = new FxUserAccount(); | |||
$flag = $fxUserAccount->rechargeAmount($fx_uid, $amount); | |||
if ($flag) { | |||
static::addLog($fx_uid, 3, $amount, ''); | |||
return Util::returnArrSu(); | |||
} else { | |||
return Util::returnArrEr('退款失败![amount_1001]'); | |||
} | |||
} | |||
/** | |||
* 充值 | |||
* @param $fx_uid | |||
* @param $amount | |||
* @return array | |||
*/ | |||
public static function recharge($fx_uid, $amount) | |||
{ | |||
$fxUserAccount = new FxUserAccount(); | |||
$flag = $fxUserAccount->rechargeAmount($fx_uid, $amount); | |||
if ($flag) { | |||
static::addLog($fx_uid, 1, $amount, ''); | |||
return Util::returnArrSu(); | |||
} else { | |||
return Util::returnArrEr('充值失败![amount_1002]'); | |||
} | |||
} | |||
/** | |||
* 添加日志 | |||
* @param $fx_uid | |||
* @param $trade_type int 交易类型 1、充值 2、支出 3、退款 | |||
* @param $amount | |||
* @param $msg | |||
* @return array | |||
*/ | |||
public static function addLog($fx_uid, $trade_type, $amount, $msg) | |||
{ | |||
$fxUserAccount = new FxUserAccount(); | |||
$info = $fxUserAccount->getMyCommission($fx_uid); | |||
$remaining_sum = $info['remaining_sum']; | |||
$fxUserAmountLog = new FxUserAmountLog(); | |||
return $fxUserAmountLog->addLog($fx_uid, $trade_type, $amount, $remaining_sum, $msg); | |||
} | |||
/** | |||
* 取消订单加扣款 | |||
* @param $params | |||
* @return array | |||
*/ | |||
public function cancelOrder($params) | |||
{ | |||
$order = new OrderMain(); | |||
$orderInfo = $order->getOrderInfo($params['order_id']); | |||
$fx_uid = $orderInfo['fx_uid']; | |||
return self::refund($fx_uid, $params['refund_fee']); | |||
} | |||
} |
@@ -0,0 +1,362 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm OrderUtil.php | |||
* Create By 2017/3/10 11:52 $ | |||
*/ | |||
namespace common\util; | |||
use common\models\BusTicket; | |||
use common\models\CmsCategory; | |||
use common\models\OrderMain; | |||
use common\models\ProdCategory; | |||
use common\models\ProdMain; | |||
use common\util\curl\CsCurl; | |||
use common\util\prod\LineProdService; | |||
use yii\db\Exception; | |||
class OrderUtil | |||
{ | |||
/** | |||
* Des:申请取消订单 | |||
* Name: applyCancelOrder | |||
* @param $order_id int 订单ID | |||
* @param $is_check int 是否校验 | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function applyCancelOrder($order_id, $is_check = 1) | |||
{ | |||
$return = Util::interfaceZzcx(['order_id' => $order_id, 'is_check' => $is_check], '/zzcx/interfaces/order/cancel-order'); | |||
if ($return['flag']) { | |||
return Util::returnArrSu(); | |||
} | |||
return Util::returnArrEr($return['msg']); | |||
} | |||
/** | |||
* Des:获取子线路产品的库存日历 | |||
* Name: getBusSaleDate | |||
* @param $pro_cate_id | |||
* @param $if_back | |||
* @param $date | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function getBusSaleDate($pro_cate_id, $if_back, $date = '') | |||
{ | |||
$prod_main = new ProdMain(); | |||
$bus_ticket = new BusTicket(); | |||
if ($if_back == 1) { | |||
$ticket_info = $prod_main->getTicketId($pro_cate_id); | |||
$pro_cate_id = $bus_ticket->getBackTicketId($ticket_info[0]['bus_id']); | |||
} | |||
//读取产品对应的巴士票种id | |||
$ticket_info = $prod_main->getTicketId($pro_cate_id); | |||
$return = CsCurl::getBusSaleDate($ticket_info[0]['bus_id']);//获取库存日历 | |||
//将比今天或者指定日期小的日期剔除 | |||
if (empty($return['data']['list']['0']) == false) { | |||
if (empty($date)) { | |||
$date = date('Y-m-d'); | |||
} | |||
foreach ($return['data']['list'] as $key => $val) { | |||
if (strtotime($val) < strtotime($date)) { | |||
unset($return['data']['list'][$key]); | |||
} else { | |||
break; | |||
} | |||
} | |||
} | |||
$return['data']['list'] = array_values($return['data']['list']); | |||
return $return; | |||
} | |||
/** | |||
* Function Description:切换日期实时获取库存 | |||
* Function Name: getBusStock | |||
* @param $date | |||
* @param $pro_cate_id | |||
* @param $if_back | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public static function getBusStock($date, $pro_cate_id, $if_back) | |||
{ | |||
$prod_main = new ProdMain(); | |||
$bus_ticket = new BusTicket(); | |||
if ($if_back == 1) { | |||
$ticket_info = $prod_main->getTicketId($pro_cate_id); | |||
$pro_cate_id = $bus_ticket->getBackTicketId($ticket_info[0]['bus_id']); | |||
} | |||
//读取产品对应的巴士票种id | |||
$ticket_info = $prod_main->getTicketId($pro_cate_id); | |||
//去cs系统查实时库存信息 | |||
$time = time(); | |||
$siteConfig = Util::getSiteConfig(); | |||
$send_data = [ | |||
'auth_code' => Util::authCodeForCs($time), | |||
'user_key' => $siteConfig['adm_user_key'], | |||
'user' => $siteConfig['adm_user'], | |||
'user_id' => $siteConfig['adm_user_id'], | |||
'request_time' => $time, | |||
'action' => 'get_run_array', | |||
'run_date' => $date, | |||
'ticket_id' => $ticket_info[0]['bus_id'] | |||
]; | |||
$curlInterface = new CurlInterface($send_data, 4); | |||
$curlInterface->setBaseUrl(''); | |||
$ticket_arr_cs = $curlInterface->execute($siteConfig['adm_host1'] . '/api/nfx', 'POST'); | |||
if ($ticket_arr_cs['code'] == 0 && $ticket_arr_cs['data']) { | |||
$result = []; | |||
foreach ($ticket_arr_cs['data'] as $val) { | |||
if (intval($val['count']) <= 0) { | |||
$val['count'] = 0; | |||
} | |||
/** 将null字段的过滤掉 update on 2017-06-06 14:54**/ | |||
if (empty($val['start_time'])) { | |||
continue; | |||
} | |||
$stat_time = strtotime($date . ' ' . $val['start_time']); | |||
if ($stat_time <= time()) { | |||
continue; | |||
} | |||
/**白哥说将已停运的过滤掉 update on 2017-06-01 10:23**/ | |||
if ($val['run_status'] == 142) { | |||
continue; | |||
} | |||
foreach ($ticket_info as $k => $v) { | |||
$val['prod_name'] = $v['prod_name']; | |||
$val['prod_id'] = $v['prod_id']; | |||
$val['prod_price'] = $v['prod_price']; | |||
$val['station_str'] = $prod_main->getStation($v['prod_id']); | |||
if ($val['run_status'] != 137) { | |||
$result[$val['start_time']][$k] = $val; | |||
}; | |||
} | |||
} | |||
if (count($result) == 0) { | |||
return Util::returnArrEr('该日的班次已截止售卖,请选择其它日期'); | |||
} | |||
/******************************增加售卖截止时间判断*****************************/ | |||
$prod_category = new ProdCategory(); | |||
$prodInfo = $prod_category->getBusProdDetail($pro_cate_id); | |||
$close_sale_time = $prodInfo['close_sale_time']; | |||
if ($close_sale_time == '') $close_sale_time = 24; | |||
$s_time = strtotime($date) + $close_sale_time * 60 * 60; | |||
$curr_h_i = date('H:i:00', $s_time); | |||
if ($curr_h_i == '00:00:00') $curr_h_i = '24:00:00'; | |||
//1.判断是否存在订单了 | |||
$orderMain = new OrderMain(); | |||
$param = ["prod_cate_id" => $pro_cate_id, "start_date" => $date, "start_time" => $curr_h_i, "small24" => $close_sale_time < 0]; | |||
$boolExist = $orderMain->existOrder($param); | |||
if (!$boolExist) { | |||
if ($s_time <= time()) { | |||
return Util::returnArrEr('该日的班次已截止售卖,请选择其它日期'); | |||
} | |||
} | |||
/******************************华丽的分割线*****************************/ | |||
$result1 = ['prod_info' => $result, 'pro_cate_id' => $pro_cate_id]; | |||
return Util::returnArrSu('', $result1); | |||
} | |||
return Util::returnArrEr('没有库存,请重选日期'); | |||
} | |||
/** | |||
* Function Description:订单状态查询 | |||
* Function Name: getOrderStatus | |||
* @param $order_id | |||
* | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public static function getOrderStatus($order_id) | |||
{ | |||
$order_main = new OrderMain(); | |||
$str_arr = explode('-', $order_id); | |||
$order_id = $str_arr[0]; | |||
$result = $order_main->getOrderStatus($order_id); | |||
if ($result['order_status'] == 1) { | |||
return Util::returnArrSu('尚未支付', array('order_status' => 1)); | |||
} elseif ($result['order_status'] == 2) { | |||
return Util::returnArrSu('支付已完成', array('order_status' => 2)); | |||
} else { | |||
return Util::returnArrSu('订单已失效', array('order_status' => 0)); | |||
} | |||
} | |||
/** | |||
* Function Description:车详情 | |||
* Function Name: getDetail | |||
* @param $pro_cate_id | |||
* | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public static function getDetail($pro_cate_id) | |||
{ | |||
//参数校验 | |||
if (Util::checkPattern('intVal', $pro_cate_id) == false) { | |||
return Util::returnArrEr('参数错误'); | |||
} | |||
$prod_category = new ProdCategory(); | |||
$prod_main = new ProdMain(); | |||
$prod_detail = $prod_category->getBusProdDetail($pro_cate_id); | |||
if ($prod_detail['sign'] != '') { | |||
$getRunDate = LineProdService::getLineSaleDate($pro_cate_id, 0); | |||
} else { | |||
$getRunDate = OrderUtil::getBusSaleDate($pro_cate_id, 0); | |||
} | |||
//子产品列表 | |||
$prod_arr = $prod_main->getProdArr($pro_cate_id); | |||
$prod_detail['prod_arr'] = $prod_arr; | |||
$prod_detail['run_date'] = $getRunDate['data']['list']; | |||
return Util::returnArrSu('', $prod_detail); | |||
} | |||
/** | |||
* Function Description:首页列表数据获取 | |||
* Function Name: getAllProd | |||
* @param $where | |||
* @param $point | |||
* @return array | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public static function getAllProd($where, $point) | |||
{ | |||
$cms_category = new CmsCategory(); | |||
$prod_category = new ProdCategory(); | |||
$result = []; | |||
$getHotProdArr = $prod_category->GetHotProd($where); | |||
//热销产品 | |||
if (count($getHotProdArr)) { | |||
$result[0] = [ | |||
'prod_arr' => $getHotProdArr, | |||
'cms_category_id' => 1, | |||
'category_name' => '购买过', | |||
'recom_arr' => [] | |||
]; | |||
} | |||
//推荐产品 | |||
$getRecommendArr = $prod_category->GetRecommendProd($where); | |||
if (count($getRecommendArr)) { | |||
$result[1] = [ | |||
'prod_arr' => $getRecommendArr, | |||
'cms_category_id' => 2, | |||
'category_name' => '热销', | |||
'recom_arr' => [] | |||
]; | |||
} | |||
//自定义产品类型 | |||
$category_arr = $cms_category->getCategoryArr(); | |||
foreach ($category_arr as $key => $val) { | |||
$category_id = $val['cms_category_id']; | |||
$prodArr = $prod_category->GetListProd($category_id, $where); | |||
if (count($prodArr)) { | |||
$category_arr[$key]['prod_arr'] = $prodArr; | |||
$siteConfig = Util::getSiteConfig(); | |||
if (in_array($category_id, $siteConfig['show_recom'])) {//获取LBS定位推荐产品 | |||
$category_arr[$key]['recom_arr'] = $prod_category->getLBSListByCmsCate($point, $category_id); | |||
} else { | |||
$category_arr[$key]['recom_arr'] = []; | |||
} | |||
} else { | |||
unset($category_arr[$key]); | |||
} | |||
} | |||
$arr = array_merge($result, $category_arr); | |||
$data = ['prod_list' => $arr]; | |||
return Util::returnArrSu('', $data); | |||
} | |||
/** | |||
* Des:前往蜘蛛出行确认支付 | |||
* Name: payOrder | |||
* @param $orderId | |||
* @param $param_arr | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function payOrderNotify($orderId, $param_arr) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
$pay = FxAmount::pay($param_arr['fx_uid'], $param_arr['total_money']); | |||
if ($pay['flag'] == false) { | |||
return $pay; | |||
} | |||
//将数据进行加密 | |||
$time = time(); | |||
$data = [ | |||
'out_trade_no' => $orderId, | |||
'time' => $time, | |||
'buyer_pay_amount' => $param_arr['total_money'], | |||
]; | |||
$code = Util::authCode(http_build_query($data), "ENCODE"); | |||
$pay_params = [ | |||
'system' => 1, | |||
'code' => $code, | |||
'time' => $time, | |||
]; | |||
//调用支付确认接口 | |||
$curl = new CurlInterface($pay_params, 3); | |||
$payResult = $curl->execute($siteConfig['notify_url'], 'POST'); | |||
if ($payResult['return_code'] != 'SUCCESS') { | |||
return Util::returnArrEr('预下单失败!' . $payResult['return_msg']); | |||
} | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
* Des:下单 | |||
* Name: makeOrder | |||
* @param $params | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function makeOrder($params) | |||
{ | |||
/***前往蜘蛛出行下单***/ | |||
$siteConfig = Util::getSiteConfig(); | |||
$curl = new CurlInterface($params, 4); | |||
$makeOrder = $curl->execute($siteConfig['zzcx_host'] . '/zzcx/order/order/make-order', 'POST'); | |||
if ($makeOrder['flag'] != true) {//下单成功 | |||
return Util::returnArrEr($makeOrder['msg']); | |||
} | |||
$return = $makeOrder['data'];//返回值 | |||
//如果是余额支付 需扣除当前分销账户的余额 并调用支付完成通知接口告知支付已完成 | |||
if ($params['pay_type'] == 3) {//余额支付 | |||
$orderId = $return['order_id']; | |||
$payOrder = [ | |||
'fx_uid' => $params['fx_uid'], | |||
'total_money' => $return['total_money'], | |||
]; | |||
$payFlag = static::payOrderNotify($orderId, $payOrder); | |||
if ($payFlag['flag'] == false) { | |||
return Util::returnArrEr($payFlag['msg']); | |||
} | |||
} | |||
/****设置返回值****/ | |||
$return['qr_code'] = $siteConfig['host_name'] . '/fx/?r=weChat/we-chat/q-code&qCode=' . urlencode($return['pay_url']) . '&_math=441'; | |||
$return['pay_type'] = $params['pay_type']; | |||
return Util::returnArrSu('', $return); | |||
} | |||
} |
@@ -0,0 +1,105 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm PayService.php | |||
* Create By 2017/3/3 19:53 $ | |||
*/ | |||
namespace common\util; | |||
class PayService | |||
{ | |||
/** | |||
* Des:扫描支付 | |||
* Name: sao | |||
* @param $params array order_id:订单ID name:订单名称 total_fee:总金额-元 | |||
* @param int $type | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function sao($params, $type = 1) | |||
{ | |||
/****微信支付****/ | |||
if ($type == 1) { | |||
$pay = new WeChatPay(); | |||
} else { | |||
/****阿里支付****/ | |||
$pay = new AliPay(); | |||
} | |||
$return = $pay->unifiedOrderByOrderIdForSao($params); | |||
return $return; | |||
} | |||
/** | |||
* Des:取消订单 | |||
* Name: cancel | |||
* @param $params array order_id:订单ID name:订单名称 total_fee:总金额-元 refund_fee退款金额 | |||
* @param int $type | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function cancel($params, $type = 1) | |||
{ | |||
/****微信支付****/ | |||
if ($type == 1) { | |||
$pay = new WeChatPay(); | |||
} elseif ($type == 2) { | |||
/****阿里支付****/ | |||
$pay = new AliPay(); | |||
} else { | |||
$pay = new FxAmount(); | |||
} | |||
$return = $pay->cancelOrder($params); | |||
return $return; | |||
} | |||
/** | |||
* Des: 直接付款 | |||
* Name: pay | |||
* @param $params array | |||
* $order_id string 订单表 订单ID | |||
* $name string 产品名称 | |||
* $total_fee int 总金额 单位元 | |||
* $openid string 用户opendid | |||
* $type 1微信 2支付宝 | |||
* | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function pay($params,$type = 1) | |||
{ | |||
if($type == 1) { | |||
$pay = new WeChatPay(); | |||
$return = $pay->unifiedOrderByOrderIdForWeChat($params); | |||
}else { | |||
$pay = new AliPay(); | |||
$return = $pay->webPay($params); | |||
} | |||
// include ROOT_PATH.'/common/util/WeChatHtml.php'; | |||
return $return['data']['payData']; | |||
} | |||
/** | |||
* Des: 支付 目前只支持微信直接支付 | |||
* Name: pay | |||
* @param $orderId string 订单ID | |||
* | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function checkIsPay($orderId) | |||
{ | |||
$pay = new WeChatPay(); | |||
$return = $pay->checkIsPay($orderId); | |||
return $return; | |||
} | |||
} |
@@ -0,0 +1,264 @@ | |||
<?php | |||
/** | |||
* | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm UploadPic.php | |||
* Create By 2017/3/10 15:10 $ | |||
*/ | |||
namespace common\util; | |||
use yii\base\Exception; | |||
class UploadPic | |||
{ | |||
/** | |||
* Des:生成新图片 | |||
* Name: _UPLOADPIC | |||
* @param $upfile | |||
* @param $maxsize | |||
* @param $updir | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function _UPLOADPIC($upfile, $maxsize, $updir) | |||
{ | |||
$type = $upfile ["type"]; | |||
$size = $upfile ["size"]; | |||
switch ($type) { | |||
case 'image/jpeg' : | |||
$extend = ".jpg"; | |||
break; | |||
} | |||
if (empty($extend)) { | |||
return Util::returnArrEr('只能上传图片类型:JPG '); | |||
} | |||
$pin = 100; | |||
if ($size > $maxsize) { | |||
$pin = round($maxsize / $size, 2) * 100; | |||
} | |||
try{ | |||
list($width, $height) = getimagesize($upfile['tmp_name']); | |||
move_uploaded_file($upfile['tmp_name'], $updir); | |||
$new_image = imagecreatetruecolor($width, $height); | |||
$old_image = imagecreatefromjpeg($updir); | |||
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $width, $height, $width, $height); | |||
imagejpeg($new_image, $updir, $pin); | |||
return Util::returnArrSu('', ['url' => $updir]); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr('上传图片失败! '); | |||
} | |||
} | |||
/** | |||
* Des:获取比例压缩后的图片大小 | |||
* Name: show_pic_scal | |||
* @param $width | |||
* @param $height | |||
* @param $picpath | |||
* @return mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public static function show_pic_scal($width, $height, $picpath) | |||
{ | |||
$imginfo = GetImageSize($picpath); | |||
$imgw = $imginfo [0]; | |||
$imgh = $imginfo [1]; | |||
$ra = number_format(($imgw / $imgh), 1); //宽高比 | |||
$ra2 = number_format(($imgh / $imgw), 1); //高宽比 | |||
if ($imgw > $width or $imgh > $height) { | |||
if ($imgw > $imgh) { | |||
$newWidth = $width; | |||
$newHeight = round($newWidth / $ra); | |||
} elseif ($imgw < $imgh) { | |||
$newHeight = $height; | |||
$newWidth = round($newHeight / $ra2); | |||
} else { | |||
$newWidth = $width; | |||
$newHeight = round($newWidth / $ra); | |||
} | |||
} else { | |||
$newHeight = $imgh; | |||
$newWidth = $imgw; | |||
} | |||
$newsize [0] = $newWidth; | |||
$newsize [1] = $newHeight; | |||
return $newsize; | |||
} | |||
public static function getImageInfo($src) | |||
{ | |||
return getimagesize($src); | |||
} | |||
/** | |||
* 创建图片,返回资源类型 | |||
* @param string $src 图片路径 | |||
* @return resource $im 返回资源类型 | |||
* **/ | |||
public static function create($src) | |||
{ | |||
$info = static::getImageInfo($src); | |||
switch ($info[2]) { | |||
case 1: | |||
$im = imagecreatefromgif($src); | |||
break; | |||
case 2: | |||
$im = imagecreatefromjpeg($src); | |||
break; | |||
default: | |||
$im = imagecreatefrompng($src); | |||
break; | |||
} | |||
return $im; | |||
} | |||
/** | |||
* 缩略图主函数 | |||
* @param string $src 图片路径 | |||
* @param int $w 缩略图宽度 | |||
* @param int $h 缩略图高度 | |||
* @return mixed 返回缩略图路径 | |||
* **/ | |||
public static function resize($src, $w, $h, $savepath) | |||
{ | |||
//获取图片的基本信息 | |||
$info = static::getImageInfo($src); | |||
$width = $info[0];//获取图片宽度 | |||
$height = $info[1];//获取图片高度 | |||
$per1 = round($width / $height, 2);//计算原图长宽比 | |||
$per2 = round($w / $h, 2);//计算缩略图长宽比 | |||
//计算缩放比例 | |||
if ($per1 > $per2 || $per1 == $per2) { | |||
//原图长宽比大于或者等于缩略图长宽比,则按照宽度优先 | |||
$per = $w / $width; | |||
} else { | |||
//原图长宽比小于缩略图长宽比,则按照高度优先 | |||
$per = $h / $height; | |||
} | |||
$temp_w = intval($width * $per);//计算原图缩放后的宽度 | |||
$temp_h = intval($height * $per);//计算原图缩放后的高度 | |||
$temp_img = imagecreatetruecolor($temp_w, $temp_h);//创建画布 | |||
$im = static::create($src); | |||
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height); | |||
if ($per1 > $per2) { | |||
imagejpeg($temp_img, $savepath, 100); | |||
imagedestroy($im); | |||
return static::addBg($savepath, $w, $h, "w"); | |||
//宽度优先,在缩放之后高度不足的情况下补上背景 | |||
} | |||
if ($per1 == $per2) { | |||
imagejpeg($temp_img, $savepath, 100); | |||
imagedestroy($im); | |||
return $savepath; | |||
//等比缩放 | |||
} | |||
if ($per1 < $per2) { | |||
imagejpeg($temp_img, $savepath, 100); | |||
imagedestroy($im); | |||
return static::addBg($savepath, $w, $h, "h"); | |||
//高度优先,在缩放之后宽度不足的情况下补上背景 | |||
} | |||
return ''; | |||
} | |||
/** | |||
* Des:添加背景 返回加上背景的图片 | |||
* Name: addBg | |||
* @param string $src 图片路径 | |||
* @param int $w 背景图像宽度 | |||
* @param int $h 背景图像高度 | |||
* @param String $first 决定图像最终位置的,w 宽度优先 h 高度优先 wh:等比 | |||
* @return mixed | |||
* @author 倪宗锋 | |||
*/ | |||
public static function addBg($src, $w, $h, $first = "w") | |||
{ | |||
$bg = imagecreatetruecolor($w, $h); | |||
$white = imagecolorallocate($bg, 255, 255, 255); | |||
imagefill($bg, 0, 0, $white);//填充背景 | |||
//获取目标图片信息 | |||
$info = static::getImageInfo($src); | |||
$width = $info[0];//目标图片宽度 | |||
$height = $info[1];//目标图片高度 | |||
$img = static::create($src); | |||
if ($first == "wh") { | |||
//等比缩放 | |||
return $src; | |||
} else { | |||
if ($first == "w") { | |||
$x = 0; | |||
$y = ($h - $height) / 2;//垂直居中 | |||
} else { | |||
$x = ($w - $width) / 2;//水平居中 | |||
$y = 0; | |||
} | |||
imagecopymerge($bg, $img, $x, $y, 0, 0, $width, $height, 100); | |||
imagejpeg($bg, $src, 100); | |||
imagedestroy($bg); | |||
imagedestroy($img); | |||
return $src; | |||
} | |||
} | |||
/** | |||
* Des:剪切图片 | |||
* Name: cutPic | |||
* @param $image | |||
* @param $upFile | |||
* @param int $xx | |||
* @param int $yy | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function cutPic($image, $upFile, $xx = 300, $yy = 300) | |||
{ | |||
$imgstream = file_get_contents($image); | |||
$im = imagecreatefromstring($imgstream); | |||
$x = imagesx($im);//获取图片的宽 | |||
$y = imagesy($im);//获取图片的高 | |||
if ($x > $y) { | |||
//图片宽大于高 | |||
$sx = abs(($y - $x) / 2); | |||
$sy = 0; | |||
$thumbw = $y; | |||
$thumbh = $y; | |||
} else { | |||
//图片高大于等于宽 | |||
$sy = abs(($x - $y) / 2.5); | |||
$sx = 0; | |||
$thumbw = $x; | |||
$thumbh = $x; | |||
} | |||
if (function_exists("imagecreatetruecolor")) { | |||
$dim = imagecreatetruecolor($yy, $xx); // 创建目标图gd2 | |||
} else { | |||
$dim = imagecreate($yy, $xx); // 创建目标图gd1 | |||
} | |||
imageCopyreSampled($dim, $im, 0, 0, $sx, $sy, $yy, $xx, $thumbw, $thumbh); | |||
imagejpeg($dim, $upFile); | |||
return Util::returnArrSu('', array('url' => $upFile)); | |||
} | |||
} |
@@ -0,0 +1,545 @@ | |||
<?php | |||
/** | |||
* 全局通用方法集合 | |||
* ============================================================================ | |||
* * 版权所有 蜘蛛出行 * * | |||
* 网站地址: http://www.zhizhuchuxing.com | |||
* ---------------------------------------------------------------------------- | |||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 | |||
* 使用;不允许对程序代码以任何形式任何目的的再发布。 | |||
* ============================================================================ | |||
* Author By: 倪宗锋 | |||
* PhpStorm Util.php | |||
* Create By 2017/2/22 19:44 $ | |||
*/ | |||
namespace common\util; | |||
use yii\helpers\ArrayHelper; | |||
class Util | |||
{ | |||
/**微信配置参数**/ | |||
private static $weChatConfig = null; | |||
private static $siteConfig = null; | |||
/** | |||
* Des:获取配置参数 | |||
* Name: getSiteConfig | |||
* @return null | |||
* @author 倪宗锋 | |||
*/ | |||
public static function getSiteConfig() | |||
{ | |||
if (static::$siteConfig == null) { | |||
static::$siteConfig = ArrayHelper::merge( | |||
require ROOT_PATH . '/common/config/siteConfig/' . YII_ENV . '/siteConfig.php', | |||
require ROOT_PATH . '/common/config/siteConfig.php' | |||
); | |||
} | |||
return static::$siteConfig; | |||
} | |||
/** | |||
* Des:设置siteConfig | |||
* Name: setSiteConfig | |||
* @param $array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function setSiteConfig($array) | |||
{ | |||
$siteConfig = static::getSiteConfig(); | |||
static::$siteConfig = ArrayHelper::merge( | |||
$siteConfig, | |||
$array | |||
); | |||
} | |||
/** | |||
* Function Description:返回成功Json数据到 | |||
* Function Name: returnSu | |||
* @param string $msg 提示信息 | |||
* @param string $url 跳转地址 | |||
* @param string|array $data 需要传递的数据 | |||
* @param string $code 错误码 | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function returnJsSu($msg = '', $data = '', $url = '', $code = '') | |||
{ | |||
$return = array(); | |||
$return['flag'] = true; | |||
$return['msg'] = $msg; | |||
$return['url'] = $url; | |||
$return['code'] = $code; | |||
$return['data'] = $data; | |||
return json_encode($return); | |||
} | |||
/** | |||
* Function Description:返回成功Json数据 | |||
* Function Name: returnEr | |||
* @param string $msg 提示信息 | |||
* @param string $url 跳转地址 | |||
* @param string|array $data 需要传递的数据 | |||
* @param string $code 错误码 | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function returnJsEr($msg = '', $data = '', $url = '', $code = '') | |||
{ | |||
$return = array(); | |||
$return['flag'] = false; | |||
$return['msg'] = $msg; | |||
$return['url'] = $url; | |||
$return['code'] = $code; | |||
$return['data'] = $data; | |||
return json_encode($return); | |||
} | |||
/** | |||
* Function Description:返回成功数组数据 | |||
* Function Name: returnArrSu | |||
* @param string $msg 提示信息 | |||
* @param string $url 跳转地址 | |||
* @param string|array $data 需要传递的数据 | |||
* @param string $code 错误码 | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function returnArrSu($msg = '', $data = '', $url = '', $code = '') | |||
{ | |||
$return = array(); | |||
$return['flag'] = true; | |||
$return['msg'] = $msg; | |||
$return['url'] = $url; | |||
$return['code'] = $code; | |||
$return['data'] = $data; | |||
return $return; | |||
} | |||
/** | |||
* Function Description:返回错误数组数据 | |||
* Function Name: returnArrEr | |||
* @param string $msg 提示信息 | |||
* @param string $url 跳转地址 | |||
* @param string|array $data 需要传递的数据 | |||
* @param string $code 错误码 | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function returnArrEr($msg = '', $data = '', $url = '', $code = '') | |||
{ | |||
$return = array(); | |||
$return['flag'] = false; | |||
$return['msg'] = $msg; | |||
$return['url'] = $url; | |||
$return['code'] = $code; | |||
$return['data'] = $data; | |||
return $return; | |||
} | |||
/** | |||
* Des:获取微信配置文件 | |||
* Name: getWeChatConfig | |||
* @return null | |||
* @author 倪宗锋 | |||
*/ | |||
public static function getWeChatConfig() | |||
{ | |||
if (static::$weChatConfig == null) { | |||
static::$weChatConfig = require ROOT_PATH . '/common/config/wechatConfig/payConfig.php'; | |||
} | |||
return static::$weChatConfig; | |||
} | |||
/** | |||
* Function Description:校验字符串的正则 | |||
* Function Name: checkPattern | |||
* @param $type string 已有正则的key | |||
* @param $str string 校验的字符串 | |||
* @param string $Regex 校验规则 固若该值不为空 则使用该正则校验 $type失效 | |||
* | |||
* @return bool | |||
* | |||
* @author 倪宗锋 2016-11-10 | |||
*/ | |||
public static function checkPattern($type, $str, $Regex = '') | |||
{ | |||
if ($Regex == '') { | |||
$pattern = require(ROOT_PATH . '/common/config/checkParams.php'); | |||
if (empty($pattern[$type])) {//正则不存在 则验证失败 | |||
return false; | |||
} | |||
$Regex = $pattern[$type]; | |||
} | |||
if (preg_match($Regex, $str)) { | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} | |||
/** | |||
* Function Description:json转换为xml | |||
* Function Name: jsonToXml | |||
* @param $json | |||
* | |||
* @return bool|string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function jsonToXml($json) | |||
{ | |||
if (empty($json)) { | |||
return false; | |||
} | |||
$array = json_decode($json); | |||
$xml = ''; | |||
$xml .= self::arrayToXml($array); | |||
return $xml; | |||
} | |||
/** | |||
* Function Description:数组转换xml | |||
* Function Name: change | |||
* @param $array | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function arrayToXml($array) | |||
{ | |||
$string = '<xml>'; | |||
foreach ($array as $k => $v) { | |||
$string .= '<' . $k . '>'; | |||
if (is_array($v) || is_object($v)) {//判断是否是数组,或者,对像 | |||
$string .= self::arrayToXml($v);//是数组或者对像就的递归调用 | |||
} elseif (is_numeric($v)) { | |||
$string .= $v; | |||
} else { | |||
$string .= '<![CDATA[' . $v . ']]>'; | |||
} | |||
$string .= '</' . $k . '>'; | |||
} | |||
$string .= '</xml>'; | |||
return $string; | |||
} | |||
/** | |||
* Function Description:xml转换为json | |||
* Function Name: xml_to_json | |||
* @param $source | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function xmlToJson($source) | |||
{ | |||
if (is_file($source)) { //传的是文件,还是xml的string的判断 | |||
$xml_array = simplexml_load_file($source); | |||
} else { | |||
$xml_array = simplexml_load_string(trim($source)); | |||
} | |||
$json = json_encode($xml_array, true); | |||
return $json; | |||
} | |||
/** | |||
* Function Description:xml转换成数组 | |||
* Function Name: xmlToArray | |||
* @param $source | |||
* | |||
* @return mixed | |||
* | |||
* @author 倪宗锋 | |||
*/ | |||
public static function xmlToArray($source) | |||
{ | |||
libxml_disable_entity_loader(true); | |||
$getResult = json_decode(json_encode(simplexml_load_string(trim($source), 'SimpleXMLElement', LIBXML_NOCDATA)), true); | |||
return $getResult; | |||
} | |||
/** Function Description:加密解密函数 | |||
* Function Name: authCode | |||
* @param $string | |||
* @param string $operation | |||
* @param int $expiry | |||
* @return string | |||
* @author 倪宗锋 | |||
*/ | |||
static function authCode($string, $operation = 'DECODE', $expiry = 0) | |||
{ | |||
$key = 'udM5A8S50eg8veH15dd0m601de7073N8Bcn7d1I8Res7C7o7z274D6y342I4C7t7'; | |||
$ckey_length = 4; // 随机密钥长度 取值 0-32; | |||
// 加入随机密钥,可以令密文无任何规律,即便是原文和密钥完全相同,加密结果也会每次不同,增大破解难度。 | |||
// 取值越大,密文变动规律越大,密文变化 = 16 的 $ckey_length 次方 | |||
// 当此值为 0 时,则不产生随机密钥 | |||
$key = md5($key); | |||
$keya = md5(substr($key, 0, 16)); | |||
$keyb = md5(substr($key, 16, 16)); | |||
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : ''; | |||
$cryptkey = $keya . md5($keya . $keyc); | |||
$key_length = strlen($cryptkey); | |||
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string; | |||
$string_length = strlen($string); | |||
$result = ''; | |||
$box = range(0, 255); | |||
$rndkey = array(); | |||
for ($i = 0; $i <= 255; $i++) { | |||
$rndkey[$i] = ord($cryptkey[$i % $key_length]); | |||
} | |||
for ($j = $i = 0; $i < 256; $i++) { | |||
$j = ($j + $box[$i] + $rndkey[$i]) % 256; | |||
$tmp = $box[$i]; | |||
$box[$i] = $box[$j]; | |||
$box[$j] = $tmp; | |||
} | |||
for ($a = $j = $i = 0; $i < $string_length; $i++) { | |||
$a = ($a + 1) % 256; | |||
$j = ($j + $box[$a]) % 256; | |||
$tmp = $box[$a]; | |||
$box[$a] = $box[$j]; | |||
$box[$j] = $tmp; | |||
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); | |||
} | |||
if ($operation == 'DECODE') { | |||
if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) { | |||
return substr($result, 26); | |||
} else { | |||
return ''; | |||
} | |||
} else { | |||
return $keyc . str_replace('=', '', base64_encode($result)); | |||
} | |||
} | |||
/** | |||
* Des: 生成二维码 | |||
* Name: addQRCode | |||
* @param $qCode string 生成的内容 | |||
* @param $QRFile string 二维码图片路径 | |||
* @param int $reType 1:返回成功或失败 2 返回图片数据流 | |||
* @param bool|false $isCreate 生成的图片是否保留 当$reType=2才会有效 | |||
* @param bool $logo 是否添加logo图 | |||
* @param string $logoUrl logo图地址 | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function addQRCode($qCode, $QRFile, $reType = 1, $isCreate = false, $logo = false, $logoUrl = '') | |||
{ | |||
include ROOT_PATH . '/common/util/phpqrcode/phpqrcode.php'; | |||
$value = $qCode;//二维码内容 | |||
$errorCorrectionLevel = 'H';//容错级别 | |||
$matrixPointSize = 6;//生成图片大小 | |||
//生成二维码图片 | |||
\QRcode::png($value, $QRFile, $errorCorrectionLevel, $matrixPointSize, 2); | |||
$QR = imagecreatefromstring(file_get_contents($QRFile)); | |||
if ($logo !== FALSE && $logoUrl != '') { | |||
$logoUrl = imagecreatefromstring(file_get_contents($logoUrl)); | |||
$QR_width = imagesx($QR);//二维码图片宽度 | |||
$logo_width = imagesx($logoUrl);//logo图片宽度 | |||
$logo_height = imagesy($logoUrl);//logo图片高度 | |||
$logo_qr_width = $QR_width / 5; | |||
$scale = $logo_width / $logo_qr_width; | |||
$logo_qr_height = $logo_height / $scale; | |||
$from_width = ($QR_width - $logo_qr_width) / 2; | |||
//重新组合图片并调整大小 | |||
imagecopyresampled($QR, $logoUrl, $from_width, $from_width, 0, 0, $logo_qr_width, | |||
$logo_qr_height, $logo_width, $logo_height); | |||
} | |||
//只返回成功失败的话 则图片必须保存 | |||
if ($reType == 1) { | |||
@ImagePng($QR, $QRFile); | |||
if (file_exists($QRFile)) { | |||
return Util::returnArrSu(); | |||
} | |||
return Util::returnArrEr('图片生成失败!'); | |||
} else { | |||
//输出图片 | |||
Header("Content-type: image/png"); | |||
ImagePng($QR); | |||
if ($isCreate == false) {//不保存图片则删除 | |||
@unlink($QRFile); | |||
} else {//保存则需图片再生成一次 | |||
@ImagePng($QR, $QRFile); | |||
} | |||
die; | |||
} | |||
} | |||
/** | |||
* Function Description:调用CS接口时的加密规则 | |||
* Function Name: authCodeForCs | |||
* | |||
* @return string | |||
* | |||
* @author 娄梦宁 | |||
*/ | |||
public static function authCodeForCs($request_time) | |||
{ | |||
$siteConfig = static::getSiteConfig(); | |||
$user = $siteConfig['adm_user']; | |||
$user_key = $siteConfig['adm_user_key']; | |||
//加密规则为 request_time(linux时间戳)前三位作为种子,调用srand生成随机数 + user + user_key,进行MD5加密后,换成大写字母 | |||
$auth_code = strtoupper(md5(substr($request_time, 0, 3) . "|" . $user . "|" . $user_key . "|" . substr($request_time, strlen($request_time) - 3, 3))); | |||
return $auth_code; | |||
} | |||
/** | |||
* Des:发送验证码 | |||
* Name: sendMessage | |||
* @param $msg | |||
* @param $phone | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function sendMessage($msg, $phone) | |||
{ | |||
$siteConfig = static::getSiteConfig(); | |||
$send_data = array(); | |||
$send_data["account"] = "dh78301"; | |||
$send_data["password"] = strtolower(md5("jGRk34B7")); | |||
$send_data["sign"] = "【{$siteConfig['web_name']}】"; | |||
$send_data["phones"] = $phone; | |||
$send_data["content"] = $msg; | |||
$url = 'http://www.dh3t.com/json/sms/Submit'; | |||
$curlInterface = new CurlInterface($send_data, 1); | |||
$result = $curlInterface->execute($url, 'POST'); | |||
if (isset($result['result']) && $result['result'] == '0') { | |||
return Util::returnArrSu('验证码发送成功'); | |||
} | |||
return Util::returnArrEr('验证码发送失败'); | |||
} | |||
/** | |||
* 检测是微信还是支付宝 1、微信 2、支付宝 | |||
* @return string | |||
*/ | |||
public static function checkWeChatOrAliPay() | |||
{ | |||
$header = \Yii::$app->request->getHeaders(); | |||
$user_agent = $header['user-agent']; | |||
//判断是不是微信 | |||
if (preg_match('/MicroMessenger/i', $user_agent)) { | |||
return 1; | |||
} | |||
if (preg_match('/AlipayClient/i', $user_agent)) { | |||
return 2; | |||
} | |||
return 3; | |||
} | |||
/** | |||
* Des:发送信息到RTX | |||
* Name: sendMsgRTX | |||
* @param string $receiverList | |||
* @param $title | |||
* @param $msg | |||
* @author 倪宗锋 | |||
*/ | |||
public static function sendMsgRTX($receiverList = 'nizf', $title, $msg) | |||
{ | |||
$arr = array( | |||
'title' => $title . '【' . date('Y-m-d H:i:s', time()) . '】', | |||
'receiver' => $receiverList, | |||
'msg' => substr($msg, 0, 1024), | |||
); | |||
$curl = new CurlInterface($arr, 5); | |||
$curl->execute('http://180.168.4.58:8012/SendNotify.cgi', 'POST'); | |||
} | |||
/** | |||
* Des:调用蜘蛛出行接口 | |||
* Name: interfaceZzcx | |||
* @param $data array 传递参数 | |||
* @param $url string 接口地址 | |||
* @param $timeout int 超时秒数 | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function interfaceZzcx($data, $url, $timeout = 0) | |||
{ | |||
$time = time(); | |||
$data['time'] = $time; | |||
$param = [ | |||
'code' => Util::authCode(http_build_query($data), 'ENCODE'), | |||
'time' => $time | |||
]; | |||
$curl = new CurlInterface($param, 4); | |||
if ($timeout != 0) { | |||
$curl->setTimeOut($timeout); | |||
} | |||
$siteConfig = Util::getSiteConfig(); | |||
$return = $curl->execute($siteConfig['zzcx_host'] . $url, 'POST'); | |||
return $return; | |||
} | |||
/** | |||
* Des:添加订单日志 | |||
* Name: addOrderLog | |||
* @param $uid | |||
* @param $u_type | |||
* @param $order_id | |||
* @param $name | |||
* @param $log_type | |||
* @author 倪宗锋 | |||
*/ | |||
public static function addOrderLog($uid, $u_type, $order_id, $name, $log_type) | |||
{ | |||
$data = []; | |||
$data['uid'] = $uid; | |||
$data['u_type'] = $u_type; | |||
$data['order_id'] = $order_id; | |||
$data['name'] = $name; | |||
$data['log_type'] = $log_type; | |||
$url = '/zzcx/interfaces/fx/add-order-log'; | |||
static::interfaceZzcx($data, $url); | |||
} | |||
/** | |||
* Des:添加用户操作日志 | |||
* Name: addUserOrderLog | |||
* @param $title string 标题 | |||
* @param $memo string 内容 | |||
* @param $uid int 用户ID | |||
* @param $u_type int 1管理员,2分销商,3微信用户,4cs系统', | |||
* @param $order_id string 订单ID | |||
* @param $source_type 资源类型 1、产品,2、订单 | |||
* @author 倪宗锋 | |||
*/ | |||
public static function addUserOrderLog($title, $memo, $uid, $u_type, $order_id,$source_type) | |||
{ | |||
$data = []; | |||
$data['title'] = $title; | |||
$data['memo'] = $memo; | |||
$data['uid'] = $uid; | |||
$data['u_type'] = $u_type; | |||
$data['source_id'] = $order_id; | |||
$data['source_type'] = $source_type; | |||
$url = '/zzcx/interfaces/fx/add-user-log'; | |||
static::interfaceZzcx($data, $url); | |||
} | |||
} |
@@ -0,0 +1,234 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |||
<meta charset="utf-8"> | |||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> | |||
<!-- 控制浏览器缓存--> | |||
<meta http-equiv="Cache-Control" content="no-store"> | |||
<!-- 优先使用 IE 最新版本和 Chrome--> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |||
<!-- 页面描述--> | |||
<meta name="description" content="不超过150个字符"> | |||
<!-- 页面关键词--> | |||
<meta name="keywords" content=""> | |||
<title>支付金额</title> | |||
<style> | |||
* { | |||
margin: 0; | |||
padding: 0; | |||
box-sizing: border-box; | |||
} | |||
html, | |||
body { | |||
height: 100%; | |||
overflow: hidden; | |||
} | |||
.clearfix:after { | |||
content: "\200B"; | |||
display: block; | |||
height: 0; | |||
clear: both; | |||
} | |||
.clearfix { | |||
*zoom: 1; | |||
} | |||
/*IE/7/6*/ | |||
.shuru div::-webkit-scrollbar { | |||
width: 0; | |||
height: 0; | |||
-webkit-transition: 1s; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb { | |||
background-color: #a7afb4; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-thumb:hover { | |||
background-color: #525252; | |||
background-clip: padding-box; | |||
min-height: 28px; | |||
} | |||
.shuru div::-webkit-scrollbar-track-piece { | |||
background-color: #ccd0d2; | |||
} | |||
.wrap { | |||
position: relative; | |||
margin: auto; | |||
max-width: 640px; | |||
min-width: 320px; | |||
width: 100%; | |||
height: 100%; | |||
background: #F0EFF5; | |||
overflow: hidden; | |||
} | |||
.layer-content { | |||
position: absolute; | |||
left: 50%; | |||
bottom: -200px; | |||
width: 100%; | |||
max-width: 640px; | |||
height: auto; | |||
z-index: 12; | |||
-webkit-transform: translateX(-50%); | |||
transform: translateX(-50%); | |||
} | |||
/* 输入表单 */ | |||
.edit_cash { | |||
display: block; | |||
margin-top: 15px; | |||
padding: 15px; | |||
margin: 0 auto; | |||
width: 90%; | |||
border: 1px solid #CFCFCF; | |||
border-radius: 10px; | |||
background-color: #fff; | |||
} | |||
.edit_cash p { | |||
font-size: 14px; | |||
color: #8D8D8F; | |||
} | |||
.shuru { | |||
position: relative; | |||
margin-bottom: 10px; | |||
} | |||
.shuru div { | |||
border: none; | |||
width: 100%; | |||
height: 50px; | |||
font-size: 25px; | |||
line-height: 50px; | |||
border-bottom: 1px solid #CFCFCF; | |||
text-indent: 30px; | |||
outline: none; | |||
white-space: pre; | |||
overflow-x: scroll; | |||
} | |||
.shuru span { | |||
position: absolute; | |||
top: 5px; | |||
font-size: 25px; | |||
} | |||
.submit { | |||
display: block; | |||
margin: 20px auto 0; | |||
width: 90%; | |||
height: 40px; | |||
font-size: 16px; | |||
color: #fff; | |||
background: #80D983; | |||
border: 1px solid #47D14C; | |||
border-radius: 3px; | |||
} | |||
/* 键盘 */ | |||
.form_edit { | |||
width: 100%; | |||
background: #D1D4DD; | |||
} | |||
.form_edit > div { | |||
margin-bottom: 2px; | |||
margin-right: 0.5%; | |||
float: left; | |||
width: 33%; | |||
height: 45px; | |||
text-align: center; | |||
color: #333; | |||
line-height: 45px; | |||
font-size: 18px; | |||
font-weight: 600; | |||
background-color: #fff; | |||
border-radius: 5px; | |||
} | |||
.form_edit > div:nth-child(3n) { | |||
margin-right: 0; | |||
} | |||
.form_edit > div:last-child { | |||
background-color: #DEE1E9; | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<div class="wrap" style="padding-top: 20px;"> | |||
<div style="text-align: left;font-size: 24px;font-weight: 900;margin-bottom: 5px;margin-left: 35px"><?php echo $orderInfo['pro_cate_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px;">购买数量:<?php echo $orderInfo['prod_cnt']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">联系人:<?php echo $orderInfo['contacts_name']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">手机号:<?php echo $orderInfo['contacts_phone']; ?></div> | |||
<div style="text-align: left;font-size: 16px;margin-bottom: 5px;margin-left: 35px">出游时间:<?php echo $orderInfo['run_time']; ?></div> | |||
<form action="" class="edit_cash"> | |||
<p>消费总额</p> | |||
<div class="shuru"> | |||
<span>¥</span> | |||
<div id="div"><?php echo $params['total_fee']; ?></div> | |||
</div> | |||
</form> | |||
<input value="确认支付" class="submit" type="button" onclick="call();"> | |||
</div> | |||
</body> | |||
<script type="text/javascript"> | |||
// window.onload = function () { | |||
// if (typeof WeixinJSBridge == "undefined") { | |||
// if (document.addEventListener) { | |||
// document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | |||
// } else if (document.attachEvent) { | |||
// document.attachEvent('WeixinJSBridgeReady', jsApiCall); | |||
// document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | |||
// } | |||
// } else { | |||
// jsApiCall(); | |||
// } | |||
// }; | |||
function call() { | |||
if (typeof WeixinJSBridge == "undefined") { | |||
if (document.addEventListener) { | |||
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | |||
} else if (document.attachEvent) { | |||
document.attachEvent('WeixinJSBridgeReady', jsApiCall); | |||
document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | |||
} | |||
} else { | |||
jsApiCall(); | |||
} | |||
} | |||
//调用微信JS api 支付 | |||
function jsApiCall() { | |||
WeixinJSBridge.invoke( | |||
'getBrandWCPayRequest', | |||
<?php echo json_encode($info); ?>, | |||
function (res) { | |||
WeixinJSBridge.log(res.err_msg); | |||
if (res.err_msg == 'get_brand_wcpay_request:ok') { | |||
alert('支付成功'); | |||
} else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | |||
alert('支付取消'); | |||
} else { | |||
alert('支付失败'); | |||
} | |||
} | |||
); | |||
} | |||
</script> | |||
</html> |
@@ -0,0 +1,307 @@ | |||
<?php | |||
namespace common\util; | |||
/** | |||
* Class WxPayService | |||
* 微信交易接口调用核心 | |||
* @package Base\Tool | |||
*/ | |||
class WeChatPay | |||
{ | |||
public $unifiedOrderUrl = 'https://api.mch.weixin.qq.com/pay/unifiedorder';//统一下单API | |||
/************************web支付**************************************/ | |||
/** | |||
* Function Description:去微信下单并获取返回 | |||
* Function Name: unifiedOrderByOrderId | |||
* @param $params array | |||
* $order_id string 订单表 订单ID | |||
* $name string 产品名称 | |||
* $total_fee int 总金额 单位分 | |||
* $openid string 用户opendid | |||
* @return array | |||
* | |||
* @author nzf | |||
*/ | |||
public function unifiedOrderByOrderIdForWeChat($params) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
if (empty($params['notify_url'])) { | |||
$params['notify_url'] = $siteConfig['notify_url']; | |||
} | |||
$data = array( | |||
'name' => $params['name'],//名称 | |||
'order_id' => (string)$params['order_id'],//支付ID | |||
'total_fee' => (string)$params['total_fee'] * 100,//总金 | |||
'notify_url' => $siteConfig['host_name'] . $params['notify_url'],//支付回调接口 | |||
'openid' => empty($params['openid']) ? '' : $params['openid'],//用户的OPENID | |||
); | |||
$getPrepayId = $this->unifiedOrderForWeChat($data);//统一下单API | |||
if ($getPrepayId['flag'] == false) { | |||
return $getPrepayId; | |||
} | |||
//设置成功返回的结果数 | |||
$wxPayConfig = static::getAuthWeChatConfig(); | |||
$return = array( | |||
'appId' => $wxPayConfig['appid'],//微信�?放平台审核�?�过的应用APPID | |||
'package' => 'prepay_id=' . $getPrepayId['data']['prepay_id'],//微信返回的支付交易会话ID | |||
'nonceStr' => self::getNonceStr(),//随机字符�? | |||
'signType' => 'MD5', | |||
'timeStamp' => strval(time()),//当前时间�? | |||
); | |||
$return['paySign'] = self::getSign($return); | |||
return Util::returnArrSu('', array('payData' => $return, 'price' => $params['total_fee'])); | |||
} | |||
/** | |||
* Function Description:统一下单API | |||
* Function Name: unifiedOrder | |||
* @param $params array | |||
* attach 附加数据,在查询API和支付知中原样返回,该字段主要用于商户携带订单的自定义数 | |||
* line_name 线路名称 | |||
* order_id 订单ID | |||
* total_fee 总金 | |||
* notify_url 回调地址 | |||
* | |||
* @return array | |||
* | |||
* @author nzf | |||
*/ | |||
public function unifiedOrderForWeChat($params) | |||
{ | |||
$wxPayConfig = static::getAuthWeChatConfig(); | |||
$data = array( | |||
'appid' => $wxPayConfig['appid'],//微信开放平台审核过的应用APPID | |||
'attach' => empty($params['attach']) ? '' : $params['attach'], | |||
'body' => $params['name'],//产品名称 | |||
'mch_id' => $wxPayConfig['mch_id'],//商户微信支付分配的商户号 | |||
'nonce_str' => $this->getNonceStr(),//随机字符 | |||
'notify_url' => $params['notify_url'],//通知地址 | |||
'out_trade_no' => $params['order_id'],//商户订单ID加上当前时间 | |||
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],//用户端实际ip | |||
'total_fee' => $params['total_fee'],//订单总金额,单位为分 | |||
'trade_type' => empty($params['openid']) ? 'WAP' : 'JSAPI',//交易类型 | |||
'openid' => empty($params['openid']) ? '' : $params['openid'] | |||
); | |||
$data['sign'] = $this->getSign($data);//交易签名 | |||
$curl = new CurlInterface($data, 2);//函数 | |||
$curl->setBaseUrl($this->unifiedOrderUrl); | |||
$result = $curl->execute('', 'POST'); | |||
if (empty($result['prepay_id'])) { | |||
return Util::returnArrEr('预支付交易会话异常!'); | |||
} | |||
return Util::returnArrSu('', array('prepay_id' => $result['prepay_id'])); | |||
} | |||
/************************扫描支付**************************************/ | |||
/** | |||
* Function Description:去微信下单并获取返回 | |||
* Function Name: unifiedOrderByOrderId | |||
* @param $par | |||
* @return array | |||
* | |||
* @author nzf | |||
*/ | |||
public function unifiedOrderByOrderIdForSao($par) | |||
{ | |||
$siteConfig = Util::getSiteConfig(); | |||
$notify_url = $siteConfig['host_name'] . $siteConfig['notify_url']; | |||
$data = array( | |||
'name' => $par['name'],//线路名称 | |||
'order_id' => (string)$par['order_id'] . '_' . rand(100, 999),//订单ID | |||
'total_fee' => $par['total_fee'] * 100,//总金 | |||
'notify_url' => $notify_url | |||
); | |||
$codUrl = $this->unifiedOrderForSao($data);//统一下单API | |||
if ($codUrl['flag'] == false) { | |||
return $codUrl; | |||
} | |||
//设置成功返回的结果数�? | |||
$url = $siteConfig['host_name'] . '/fx/?r=weChat/we-chat/q-code&qCode=' . urlencode($codUrl['data']['code_url']) . '&_math=' . rand(100, 999); | |||
return Util::returnArrSu('', array('codUrl' => $url, 'price' => $par['total_fee'])); | |||
} | |||
/** | |||
* Function Description:统一下单API | |||
* Function Name: unifiedOrder | |||
* @param $params array | |||
* attach 附加数据,在查询API和支付知中原样返回,该字段主要用于商户携带订单的自定义数 | |||
* line_name 线路名称 | |||
* order_id 订单ID | |||
* total_fee 总金 | |||
* notify_url 回调地址 | |||
* | |||
* @return array | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public function unifiedOrderForSao($params) | |||
{ | |||
$wxPayConfig = static::getAuthWeChatConfig(); | |||
$data = array( | |||
'appid' => $wxPayConfig['appid'],//微信�?放平台审核�?�过的应用APPID | |||
'mch_id' => $wxPayConfig['mch_id'],//商户�? 微信支付分配的商户号 | |||
'nonce_str' => $this->getNonceStr(),//随机字符�? | |||
'body' => $params['name'],//线路名称 �? 上订单ID | |||
'out_trade_no' => $params['order_id'],//商户订单ID加上当前时间 | |||
'total_fee' => $params['total_fee'],//订单总金额,单位为分 | |||
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],//用户端实际ip | |||
'notify_url' => $params['notify_url'],//通知地址 | |||
'trade_type' => 'NATIVE',//交易类型 | |||
); | |||
$data['sign'] = $this->getSign($data);//交易签名 | |||
$curl = new CurlInterface($data, 2);//函数�? | |||
$curl->setBaseUrl($this->unifiedOrderUrl); | |||
$result = $curl->execute('', 'POST'); | |||
if (empty($result['prepay_id'])) { | |||
return Util::returnArrEr('预支付交易会话异常!'); | |||
} | |||
return Util::returnArrSu('', array('prepay_id' => $result['prepay_id'], 'code_url' => $result['code_url'])); | |||
} | |||
/***************************************退款****************************************/ | |||
/** | |||
* Des:微信退款接口 | |||
* Name: cancelOrder | |||
* @param $params | |||
* @return array | |||
* @author 倪宗锋 | |||
*/ | |||
public static function cancelOrder($params) | |||
{ | |||
$config = static::getAuthWeChatConfig(); | |||
$arr = array( | |||
'appid' => $config['appid'], | |||
'mch_id' => $config['mch_id'], | |||
'nonce_str' => static::getNonceStr(), | |||
'out_trade_no' => (string)$params['order_id'],//订单ID | |||
'out_refund_no' => (string)date('YmdHis') . rand(100, 999),//退款ID | |||
'total_fee' => (string)$params['total_fee'] * 100,//订单总金额 元 | |||
'refund_fee' => (string)$params['refund_fee'] * 100,//退款金额 元 | |||
'op_user_id' => $config['mch_id'] | |||
); | |||
$arr['sign'] = static::getSign($arr); | |||
$curl = new CurlInterface($arr, 2);//函数类 | |||
$curl->setCert($config); | |||
$curl->setBaseUrl('https://api.mch.weixin.qq.com/secapi/pay/refund'); | |||
$result = $curl->execute('', 'POST'); | |||
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { | |||
return Util::returnArrSu(); | |||
} | |||
$msg = $result['return_msg']; | |||
if ($msg == 'OK') { | |||
$msg = $result['err_code_des']; | |||
} | |||
return Util::returnArrEr('退款失败!' . $msg); | |||
} | |||
/*************************************通用方法**************************************/ | |||
public static function checkIsPay($orderId) | |||
{ | |||
$config = static::getAuthWeChatConfig(); | |||
$arr = array( | |||
'appid' => $config['appid'], | |||
'mch_id' => $config['mch_id'], | |||
'out_trade_no' => (string)$orderId,//订单ID | |||
'nonce_str' => static::getNonceStr(), | |||
); | |||
$arr['sign'] = static::getSign($arr); | |||
$curl = new CurlInterface($arr, 2);//函数类 | |||
$curl->setCert($config); | |||
$curl->setBaseUrl('https://api.mch.weixin.qq.com/pay/orderquery'); | |||
$result = $curl->execute('', 'POST'); | |||
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { | |||
return Util::returnArrSu('', $result); | |||
} | |||
$msg = $result['return_msg']; | |||
if ($msg == 'OK') { | |||
$msg = $result['err_code_des']; | |||
} | |||
return Util::returnArrEr('退款失败!' . $msg); | |||
} | |||
/** | |||
* Function Description:获取签名 | |||
* Function Name: getSign | |||
* @param $params | |||
* @return string | |||
* | |||
* @author nzf | |||
*/ | |||
public static function getSign($params) | |||
{ | |||
if (isset($params['sign'])) { | |||
unset($params['sign']); | |||
} | |||
$config = static::getAuthWeChatConfig(); | |||
//签名步骤按字典序排序参 | |||
ksort($params); | |||
$string = self::ToUrlParams($params); | |||
//签名步骤二:在string后加入KEY | |||
$string = $string . "&key=" . $config['key']; | |||
//签名步骤三:MD5加密 | |||
$string = md5($string); | |||
//签名步骤四:有字符转为大 | |||
$result = strtoupper($string); | |||
return $result; | |||
} | |||
/** | |||
* Function Description:格式化参�? 格式化成url参数 | |||
* Function Name: ToUrlParams | |||
* @param $params | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function ToUrlParams($params) | |||
{ | |||
$buff = ""; | |||
foreach ($params as $k => $v) { | |||
if ($k != "sign" && $v != "" && !is_array($v)) { | |||
$buff .= $k . "=" . $v . "&"; | |||
} | |||
} | |||
$buff = trim($buff, "&"); | |||
return $buff; | |||
} | |||
/** | |||
* Function Description:产生的随机字符串 不长 | |||
* Function Name: getNonceStr | |||
* @param int $length | |||
* | |||
* @return string | |||
* | |||
* @author 倪宗�? | |||
*/ | |||
public static function getNonceStr($length = 32) | |||
{ | |||
$chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | |||
$str = ""; | |||
for ($i = 0; $i < $length; $i++) { | |||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); | |||
} | |||
return $str; | |||
} | |||
/** | |||
* Des:获取登录授权微信配置 | |||
* Name: getEntryAuthWeChatConfig | |||
* @author 倪宗锋 | |||
*/ | |||
public static function getAuthWeChatConfig() | |||
{ | |||
$weChatConfig = Util::getWeChatConfig(); | |||
$siteConfig = Util::getSiteConfig(); | |||
return $weChatConfig[$siteConfig['entryAuthWeChat']]; | |||
} | |||
} |