asynrunAction.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. }
  65. //下载微信上媒体文件
  66. public function downwxmediaAction()
  67. {
  68. $mediaid = $this->get('mediaid');
  69. $msgid = $this->get('msgid');
  70. $fileext = $this->get('fileext');
  71. $barr = m('weixin:media')->downmedia($mediaid, $fileext, $msgid);
  72. return $barr;
  73. }
  74. //异步发送邮件
  75. public function sendemailAction()
  76. {
  77. $id = (int)$this->get('id');
  78. $msg = m('email')->sendemailcont($id);
  79. if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
  80. return $msg;
  81. }
  82. //异步微信企业号发送提醒
  83. public function wxsendmsgAction()
  84. {
  85. $body = $this->get('body');
  86. if($body=='')return;
  87. $body = $this->jm->base64decode($body);
  88. $barr = m('weixin:index')->sendbody($body);
  89. m('log')->todolog('微信提醒', $barr);
  90. return $barr;
  91. }
  92. //异步企业微信发送提醒
  93. public function wxqysendmsgAction()
  94. {
  95. $body = $this->get('body');
  96. $agentid = $this->get('agentid');
  97. if($body=='')return;
  98. $body = $this->jm->base64decode($body);
  99. $barr = m('weixinqy:index')->sendbody($body, $agentid);
  100. m('log')->todolog('企业微信提醒', $barr);
  101. return $barr;
  102. }
  103. //企业微信异步获取头像
  104. public function wxqyfaceAction()
  105. {
  106. $userid = $this->get('userid');
  107. if($userid=='')return;
  108. $barr = m('weixinqy:user')->anayface($userid);
  109. m('log')->todolog('企业微信提醒', $barr);
  110. return $barr;
  111. }
  112. //钉钉异步提醒
  113. public function ddsendmsgAction()
  114. {
  115. $body = $this->get('body');
  116. if($body=='')return;
  117. $body = $this->jm->base64decode($body);
  118. $barr = m('dingding:index')->sendbody($body);
  119. m('log')->todolog('钉钉提醒', $barr);
  120. return $barr;
  121. }
  122. //转pdf完成了设置
  123. public function topdfokAction()
  124. {
  125. $id = (int)$this->get('id');
  126. $type = $this->get('type','html');
  127. $status = $this->get('status','1'); //转化状态
  128. $frs = m('file')->getone($id);
  129. $pdfpath= str_replace('.'.$frs['fileext'].'','.'.$type.'', $frs['filepath']);
  130. if(!file_exists($pdfpath))return;
  131. if($type=='html'){
  132. $cont = file_get_contents($pdfpath);
  133. $str1 = '<meta http-equiv=Content-Type content="text/html; charset=gb2312">';
  134. $cont = str_replace('</head>', ''.$str1.'</head>', $cont);
  135. $this->rock->createtxt($pdfpath, $cont);
  136. }
  137. m('file')->update("`pdfpath`='$pdfpath'", $id);
  138. }
  139. //发送短信
  140. public function sendsmsAction()
  141. {
  142. $tomobile = $this->get('tomobile');
  143. $qiannum = $this->get('qiannum');
  144. $tplnum = $this->get('tplnum');
  145. $url = $this->jm->base64decode($this->get('url'));
  146. $params = json_decode($this->jm->base64decode($this->get('params')), true);
  147. return c('xinhuapi')->send($tomobile, $qiannum, $tplnum, $params, $url);
  148. }
  149. //订阅的
  150. public function subscribeAction()
  151. {
  152. $id = $this->get('id');
  153. $uid = $this->get('uid');
  154. $receid = $this->get('receid');
  155. $recename = $this->jm->base64decode($this->get('recename'));
  156. $flow = m('flow')->initflow('subscribeinfo');
  157. return $flow->subscribe($id, $uid, $receid, $recename);
  158. }
  159. //获取打卡记录
  160. public function wxdkjlAction()
  161. {
  162. $dt1 = $this->get('dt1');
  163. $dt2 = $this->get('dt2');
  164. $page = (int)$this->get('page','2');
  165. return m('weixinqy:daka')->getrecord('', $dt1, $dt2, $page);
  166. }
  167. //发送模版消息
  168. public function wxgzhtplsendAction()
  169. {
  170. $body = $this->jm->base64decode($this->get('body'));
  171. $barr = m('wxgzh:index')->sendtplasyn($body);
  172. m('log')->todolog('模版消息', $barr);
  173. return $barr;
  174. }
  175. }
粤ICP备19079148号