asynrunAction.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. class asynrunClassAction extends apiAction
  3. {
  4. public $queuelogid = 0;
  5. public function initAction()
  6. {
  7. $this->display = false;
  8. $uid = (int)$this->get('adminid');
  9. $this->queuelogid = (int)$this->get('queuelogid','0');
  10. if($uid==0)$uid = 1;
  11. $key = $this->get('asynkey');
  12. $mykey = getconfig('asynkey');
  13. if($mykey != ''){
  14. $wodkey = md5(md5($mykey));
  15. if($wodkey != $key)exit('sorry,asyn');
  16. }
  17. $urs = m('admin')->getone($uid,'`id`,`name`,`user`');
  18. if($urs)$this->setNowUser($urs['id'], $urs['name'], $urs['user']);
  19. }
  20. public function afterAction()
  21. {
  22. if($this->queuelogid > 0){
  23. $cont = ob_get_contents();
  24. m('log')->update(array('result' => $cont), $this->queuelogid);
  25. }
  26. }
  27. public function asyntestAction()
  28. {
  29. $krand = $this->get('krand');
  30. m('option')->setval('asyntest', $krand);
  31. return $krand;
  32. }
  33. //测试
  34. public function indexAction()
  35. {
  36. $runtime = $this->get('runtime');
  37. $this->rock->debugs('hehe:'.time().','.$runtime.'','yibu');
  38. echo 'lala'.time().'';
  39. }
  40. //消息同步到微信企业会话
  41. public function wxchattbAction()
  42. {
  43. $id = (int)$this->get('id');
  44. return m('weixin:chat')->chattongbu($id);
  45. }
  46. //消息同步到企业客服消息汇总
  47. public function wxkefutbAction()
  48. {
  49. $id = (int)$this->get('id');
  50. return m('weixin:kefu')->chattongbu($id);
  51. }
  52. //薪资发放通知给人员
  53. public function salaryffAction()
  54. {
  55. $id = (int)$this->get('id');
  56. return m('flow')->initflow('hrsalary', $id)->todouser();
  57. }
  58. //下载微信发送的图片到服务器(弃用)
  59. public function downwxpicAction()
  60. {
  61. //$picurl = $this->rock->jm->uncrypt($this->get('picurl'));
  62. //$msgid = $this->get('msgid');
  63. //return m('reim')->downwximg($picurl, $msgid);
  64. return 'noturl';
  65. }
  66. //下载微信上媒体文件
  67. public function downwxmediaAction()
  68. {
  69. $mediaid = $this->get('mediaid');
  70. $msgid = $this->get('msgid');
  71. $fileext = $this->get('fileext');
  72. $barr = m('weixin:media')->downmedia($mediaid, $fileext, $msgid);
  73. return $barr;
  74. }
  75. //异步发送邮件
  76. public function sendemailAction()
  77. {
  78. $id = (int)$this->get('id');
  79. $msg = m('email')->sendemailcont($id);
  80. if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
  81. return $msg;
  82. }
  83. //异步微信企业号发送提醒
  84. public function wxsendmsgAction()
  85. {
  86. $body = $this->get('body');
  87. if($body=='')return;
  88. $body = $this->jm->base64decode($body);
  89. $barr = m('weixin:index')->sendbody($body);
  90. m('log')->todolog('微信提醒', $barr);
  91. return $barr;
  92. }
  93. //异步企业微信发送提醒
  94. public function wxqysendmsgAction()
  95. {
  96. $body = $this->get('body');
  97. $agentid = $this->get('agentid');
  98. if($body=='')return;
  99. $body = $this->jm->base64decode($body);
  100. $barr = m('weixinqy:index')->sendbody($body, $agentid);
  101. m('log')->todolog('企业微信提醒', $barr);
  102. return $barr;
  103. }
  104. //企业微信异步获取头像
  105. public function wxqyfaceAction()
  106. {
  107. $userid = $this->get('userid');
  108. if($userid=='')return;
  109. $barr = m('weixinqy:user')->anayface($userid);
  110. m('log')->todolog('企业微信提醒', $barr);
  111. return $barr;
  112. }
  113. //钉钉异步提醒
  114. public function ddsendmsgAction()
  115. {
  116. $body = $this->get('body');
  117. if($body=='')return;
  118. $body = $this->jm->base64decode($body);
  119. $barr = m('dingding:index')->sendbody($body);
  120. m('log')->todolog('钉钉提醒', $barr);
  121. return $barr;
  122. }
  123. //转pdf完成了设置
  124. public function topdfokAction()
  125. {
  126. $id = (int)$this->get('id');
  127. $type = $this->get('type','html');
  128. $status = $this->get('status','1'); //转化状态
  129. $frs = m('file')->getone($id);
  130. $pdfpath= str_replace('.'.$frs['fileext'].'','.'.$type.'', $frs['filepath']);
  131. if(!file_exists($pdfpath))return;
  132. if($type=='html'){
  133. $cont = file_get_contents($pdfpath);
  134. $str1 = '<meta http-equiv=Content-Type content="text/html; charset=gb2312">';
  135. $cont = str_replace('</head>', ''.$str1.'</head>', $cont);
  136. $this->rock->createtxt($pdfpath, $cont);
  137. }
  138. m('file')->update("`pdfpath`='$pdfpath'", $id);
  139. }
  140. //发送短信
  141. public function sendsmsAction()
  142. {
  143. $tomobile = $this->get('tomobile');
  144. $qiannum = $this->get('qiannum');
  145. $tplnum = $this->get('tplnum');
  146. $url = $this->jm->base64decode($this->get('url'));
  147. $params = json_decode($this->jm->base64decode($this->get('params')), true);
  148. return c('xinhuapi')->send($tomobile, $qiannum, $tplnum, $params, $url);
  149. }
  150. //订阅的
  151. public function subscribeAction()
  152. {
  153. $id = $this->get('id');
  154. $uid = $this->get('uid');
  155. $receid = $this->get('receid');
  156. $recename = $this->jm->base64decode($this->get('recename'));
  157. $flow = m('flow')->initflow('subscribeinfo');
  158. return $flow->subscribe($id, $uid, $receid, $recename);
  159. }
  160. //获取打卡记录
  161. public function wxdkjlAction()
  162. {
  163. $dt1 = $this->get('dt1');
  164. $dt2 = $this->get('dt2');
  165. $page = (int)$this->get('page','2');
  166. return m('weixinqy:daka')->getrecord('', $dt1, $dt2, $page);
  167. }
  168. //发送模版消息
  169. public function wxgzhtplsendAction()
  170. {
  171. $body = $this->jm->base64decode($this->get('body'));
  172. $barr = m('wxgzh:index')->sendtplasyn($body);
  173. m('log')->todolog('模版消息', $barr);
  174. return $barr;
  175. }
  176. }
粤ICP备19079148号