123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\library\RsaUtil;
- class Demo extends Api
- {
-
-
-
-
-
- protected $noNeedLogin = ['*'];
-
- protected $noNeedRight = ['*'];
-
- public function test()
- {
- $this->success('success');
- }
-
- public function test1()
- {
- $this->success('返回成功', ['action' => 'test1']);
- }
-
- public function test2()
- {
- $this->success('返回成功', ['action' => 'test2']);
- }
-
- public function test3()
- {
- $this->send_score(1, 1);
- }
- public function send_score($score, $grade_id)
- {
- $url = 'http://apip-gateway-nrouter-saas-gn-C.month.sdc.cs.icbc:8081/api/mybank/farm/farmplatf/updateVillagerIntegral/V1';
- $biz_content = [
- 'fSeqNo' => createUniqueNo('fseq', $grade_id),
- 'corpCode' => 'xingfulishequ',
- 'mobilePhone' => $this->auth->mobile,
- 'integralValue' => $score,
- 'integralType' => '',
-
- ];
- $public_key = APP_PATH.'/common/certs/icbc/public_key.pem';
- $private_key = APP_PATH.'/common/certs/icbc/private_key.pem';
- $rsautil = new RsaUtil($public_key,$private_key);
- $sign = $rsautil->publicEncrypt(json_encode($biz_content));
- dump($sign);
- $data = [
- 'app_id' => '10000000000004096993',
- 'msg_id' => createUniqueNo('msg', $grade_id),
- 'format' => 'json',
- 'charset' => 'UTF-8',
- 'sign_type' => 'RSA',
- 'sign' => $sign,
- 'timestamp' => date('Y-m-d H:i:s'),
- 'biz_content' => $biz_content,
- ];
- $rs = curl_post($url, json_encode($data, JSON_UNESCAPED_UNICODE));
-
- }
- }
|