Yyys.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. //用友YS的执行
  4. class Yyys extends Lyapi_Controller{
  5. // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
  6. public function __construct() {
  7. // 这里不执行登录校验,只加载缓存驱动
  8. parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
  9. $this->load->_model("Model_ysrecords","ysrecords");
  10. }
  11. public function lyysmsghz() {
  12. $ip = $this->input->ip_address();
  13. $json_str = $this->input->raw_input_stream;
  14. $data = json_decode($json_str,true);
  15. $jiami_str = hash_hmac('sha256', 'LYERP_'.$data['timestamp'], 'ys&ly202608261549');
  16. //$jiami_str.="&";
  17. // if($gsmc != $jiami_str){
  18. // echo "ERROR!-".$jiami_str;
  19. // }
  20. $ys_no = "";
  21. if(!empty($data['content'])){
  22. if(!empty($data['content']['code'])){
  23. $ys_no = $data['content']['code'];
  24. }
  25. }
  26. if($jiami_str != $data['gsmc']){
  27. $this->db->insert("ysnorecords",[
  28. 'ys_no'=>$ys_no,
  29. 'recept_cont'=>$json_str,
  30. 'addtime'=>time(),
  31. ]);
  32. echo "ERROR";
  33. exit;
  34. }else{
  35. $time = time();
  36. $info = $this->ysrecords->find("ys_no = '{$ys_no}'");
  37. if(empty($info)){
  38. $this->db->insert("ysnorecords",[
  39. 'ys_no'=>$ys_no,
  40. 'recept_cont'=>$json_str,
  41. 'addtime'=>time(),
  42. ]);
  43. echo "ERROR";
  44. exit;
  45. }
  46. //调拨订单审核
  47. if($data['type'] == 'st_transferapply_bill_audit'){
  48. $this->ysrecords->save(
  49. [
  50. 'recept_cont'=>$json_str,
  51. 'recepttime'=>$time,
  52. 'status'=>0,
  53. 'dotime'=>0
  54. ],$info['id']);
  55. }
  56. //调拨订单弃审
  57. if($data['st_transferapply_bill_unaudit']){
  58. $this->ysrecords->save(
  59. [
  60. 'recept_cont'=>$json_str,
  61. 'unaudit_time'=>$time,
  62. 'status'=>0,
  63. 'dotime'=>0
  64. ],$info['id']);
  65. }
  66. echo "SUCCESS";
  67. exit;
  68. }
  69. }
  70. }