diff --git a/src/applet/app/controllers/AliCallBackController.php b/src/applet/app/controllers/AliCallBackController.php index eaf8fb3..8aeccd2 100644 --- a/src/applet/app/controllers/AliCallBackController.php +++ b/src/applet/app/controllers/AliCallBackController.php @@ -2,6 +2,7 @@ namespace SRVX\Api\Controllers; +use SRVX\Model\SelfSupportForSchoolInfo; use SRVX\Traits\BasisFun; class AliCallBackController extends \Phalcon\Mvc\Controller @@ -53,15 +54,31 @@ class AliCallBackController extends \Phalcon\Mvc\Controller $secretKey = "HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI="; //配置应用公私钥 中生成的私钥 $privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDIuTvLQk9tirKw0BSiZedjbEHqnqM+bgeuvxazCp9uqoYXgC/dtIooy1P8aso+ZrroC/0vZV7TQBGBjbSSkKPn7ShZM2hfYQFpmLznwpel7KJbP6AJ8atv99wjB6uvqNf6fMU7IbQKBgQCsG3mj0amsYbS5ZQZpl2v65QnlkAxv0dxcstx15kW0hXRugLOu7EGcJNZMhO4gbn8dzMOaJANZPG1VLcFpe/QyP/AW7vDt9vTWdeQkQCD5xcXEDihLLCq0pFaSkmuOHWCI+aepSHUILlJ1P/K/5biD7MTdPg6tyLqyM+rjUd/38QKBgQCNu2fsVQHDOsEMB/qakK3YlSb0q61iAjzeAjKYcXV9BHJ6ERTfeN3Z+9asSjs1TqzZSAtoQQ1EiCaFS4P9dNCTpYttS+52gy+VlJhNjCT0RHfxlGkpb+4OA4vHkbKpvTUAHjjXnMW1ZwC5CugSAchdTXTeV1im4Yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W'; - $publicKey = "xxxxxxx"; - $iv = ""; - // 1、验签、请求报文 - - $response = [ - "code" => "10000", - "msg" => "Success", - "face_group_key" => "K12_91440402MA55R51X8H", - ]; + + $response = []; + switch ($params["service"]) { + case "alipay.planet.ecocampus.spi.school.queryFaceGroupKey": + $biz_content = json_encode($params["biz_content"], true); + //SPI::获取学校人脸库id + $selfSupportForSchoolInfo = SelfSupportForSchoolInfo::findFirst("school_code = '{$biz_content["schoolCode"]}'"); + if (empty($selfSupportForSchoolInfo)) { + $response = [ + "code" => "40000", + "msg" => "Business Failed", + "sub_code" => "20000", + "sub_msg" => "未查询到对应的学校记录", + ]; + } else { + $response = [ + "code" => "10000", + "msg" => "Success", + "face_group_key" => $selfSupportForSchoolInfo->group_key, + ]; + } + break; + default: + + } // 3、业务处理结果加签,业务返回结果需要进行排序 ksort($response);//数组排序 diff --git a/src/common/Model/SelfSupportForSchoolInfo.php b/src/common/Model/SelfSupportForSchoolInfo.php new file mode 100644 index 0000000..44297a5 --- /dev/null +++ b/src/common/Model/SelfSupportForSchoolInfo.php @@ -0,0 +1,88 @@ +setSource("self_support_for_school_info"); + } + + /** + * Allows to query a set of records that match the specified conditions + * + * @param mixed $parameters + * @return SelfSupportForSchoolInfo[]|SelfSupportForSchoolInfo|\Phalcon\Mvc\Model\ResultSetInterface + */ + public static function find($parameters = null): \Phalcon\Mvc\Model\ResultsetInterface + { + return parent::find($parameters); + } + + /** + * Allows to query the first record that match the specified conditions + * + * @param mixed $parameters + * @return SelfSupportForSchoolInfo|\Phalcon\Mvc\Model\ResultInterface|\Phalcon\Mvc\ModelInterface|null + */ + public static function findFirst($parameters = null): ?\Phalcon\Mvc\ModelInterface + { + return parent::findFirst($parameters); + } + +} diff --git a/src/common/config/config.php b/src/common/config/config.php deleted file mode 100644 index d4d60a9..0000000 --- a/src/common/config/config.php +++ /dev/null @@ -1,67 +0,0 @@ - false, - 'exceptionOnFailedSave' => true, - 'ignoreUnknownColumns' => true -]); -// return config -return new Phalcon\Config([ - 'application' => [ - 'baseUri' => '/', - 'commDir' => DIR_COMMON, - 'modelsDir' => DIR_MODEL, - 'cacheDir' => DIR_CACHE, - 'metaDataDir' => DIR_METADATA, - 'controllersDir' => DIR_SRC . APP_NAME . '/app/controllers', - 'constantsDir' => DIR_CONSTANTS, - ], - //主从DB - 'database' => [ - 'adapter' => 'mysql', - 'host' => '119.23.182.117', - 'port' => '3306', - 'username' => 'root', - 'password' => 'Fnuo123com@', - 'dbname' => 'zhios_pay', - 'charset' => 'utf8', - 'persistent' => false, //TRUE, //线上开启长连接 - 'log_file' => DIR_SRC . '../db_debug.log' - ], - //redis - 'redis' => [ - 'host' => '120.24.28.6', - 'port' => '32572', - 'timeout' => '2.5', - 'persistent' => false, - 'prefix' => 'zyos_', - 'sess_prefix' => 'sid', - 'ttl' => 86400, - 'lifetime' => 3600, - ], - 'version' => 'v1.0.0', -]); \ No newline at end of file