message_send.php 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <?php
  2. class message_send{
  3. const MSG_PAID = 'MSG_PAID';
  4. const MSG_ADMIN_MANAGE = 'MSG_ADMIN_MANAGE';//后台管理操作通知
  5. const MSG_MEMBER_REMIDE = 'MSG_MEMBER_REMIDE';//会员提醒
  6. const MSG_INCHARGE = 'MSG_INCHARGE';//充值通知
  7. const MSG_REFUND = 'MSG_REFUND';//退款通知
  8. const MSG_MONEY_CARRY_NOTIFIE = 'MSG_MONEY_CARRY_NOTIFIE';//提现
  9. const MSG_MONEY_CARRY_RESULT = 'MSG_MONEY_CARRY_RESULT';//提现结果
  10. const MSG_ZC_STATUS = 'MSG_ZC_STATUS';//众筹状态提示
  11. const MSG_INVEST_STATUS = 'MSG_INVEST_STATUS';//投资资格审核状态
  12. const MSG_INVESTOR_GO_PAY = 'MSG_INVESTOR_GO_PAY';//通知股权用户 允许付款
  13. const CROW_CREATE = 0;//表示创建和修改项目
  14. const CROW_EXAMINE = 1;//众筹提交审核
  15. const CROW_EXAMINE_SUCCESS = 2;//审核通过
  16. const CROW_EXAMINE_FAIL = 3;//审核失败
  17. const CROW_PROJECT_ING = 10;//表示产品众筹进行中
  18. const CROW_PROJECT_SUCCESS = 11;//表示产品众筹成功
  19. const CROW_PROJECT_FAIL = 12;//表示产品众筹失败
  20. const CROW_PROJECT_RETURN = 13;//表示产品众筹发放回报
  21. const CROW_INVEST_ING = 20;//表示股权进行中
  22. const CROW_INVEST_SUCCESS = 21;//表示股权认投成功
  23. const CROW_INVEST_FAIL = 22;//表示股权认投失败
  24. const CROW_INVEST_PAY_ALLOW = 23;//表示股权允许用户付款
  25. const CROW_INVEST_PAY_FAIL = 24;//表示股权拒绝用户付款
  26. const CROW_INVEST_LT = 25;//表示领投通知
  27. const CROW_INVEST_LT_ALLOW = 26;//表示股权领投 允许
  28. const CROW_INVEST_LT_FAIL = 27;//表示股权领投 拒绝
  29. const CROW_INVEST_PAY_END = 28;//表示股权 付款时间截止,项目结束;
  30. const MAIL_PASSWORD = 'TPL_MAIL_USER_PASSWORD'; //会员取回密码邮件
  31. const MAIL_VERIFY = 'TPL_MAIL_USER_VERIFY'; //会员验证邮件
  32. const MAIL_CHANGE_VERIFY = 'TPL_MAIL_CHANGE_USER_VERIFY';//邮箱修改模板
  33. const MAIL_INVESTOR_STATUS = 'TPL_MAIL_INVESTOR_STATUS'; //邮件通知用户通过投资人审核
  34. const MAIL_INVESTOR_GO_PAY = 'TPL_MAIL_INVESTOR_PAY_STATUS'; //邮件通知用户投资申请通过-允许付款
  35. const MAIL_INVESTOR_PAID = 'TPL_MAIL_INVESTOR_PAID_STATUS'; //邮件通知用户已经付款
  36. const MAIL_DEMO = 'MAIL_DEMO';//测试邮件
  37. const SMS_DEAL_FAIL = 'TPL_SMS_DEAL_FAIL'; //项目失败
  38. const SMS_DEAL_SUCCESS = 'TPL_SMS_DEAL_SUCCESS'; //项目成功
  39. const SMS_REGISTER_SUCCESS = 'TPL_SMS_USER_VERIFY'; //注册成功通知
  40. const SMS_DEAL_CREAT_SUCCESS = 'TPL_SMS_USER_S'; //通知项目发起人成功
  41. const SMS_DEAL_CREAT_FAIL = 'TPL_SMS_USER_F'; //通知项目发起人失败
  42. const SMS_VERIFY = 'TPL_SMS_VERIFY_CODE'; //短信验证码发送
  43. const SMS_TZT_VERIFY = 'TPL_SMS_TZT_VERIFY_CODE'; //投资通短信验证码发送
  44. const SMS_INVESTOR_STATUS = 'TPL_SMS_INVESTOR_STATUS'; //短信通知用户通过投资人审核
  45. const SMS_INVESTOR_GO_PAY = 'TPL_SMS_INVESTOR_PAY_STATUS'; //短信通知用户投资申请通过-允许付款
  46. const SMS_INVESTOR_PAID = 'TPL_SMS_INVESTOR_PAID_STATUS'; //短信通知用户已经付款
  47. const SMS_ROADSHOW_STATUS = 'TPL_SMS_ROADSGOW_STATUS'; //路演申请参会的审核状态发送
  48. const SMS_DEMO = 'SMS_DEMO';//测试短信
  49. const MSG_NOTIFY = 'notify';//
  50. public $data=array();
  51. public $msg_type = 'text';
  52. public $tmpl_content = '';
  53. public $msg_content = '';
  54. public $result = true;
  55. public $debug = true;
  56. public $logcallback = 'log_result_notify';
  57. public $user_info ;
  58. public $is_wx;
  59. public $wx_tmpl;
  60. public $account;
  61. public $msg_tmpl_key;
  62. public $msg_tmpl_value;
  63. function __construct(){
  64. // if(file_exists(APP_ROOT_PATH."public/install.lock"))
  65. // {
  66. // $weixin_conf = load_auto_cache("weixin_conf");
  67. // $this->is_wx = $weixin_conf['platform_status'];
  68. // if($this->is_wx){
  69. //
  70. // $account = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."weixin_account where type=1 and user_id=0 ");
  71. // $this->account = $account ;
  72. // if($account){
  73. // $this->wx_tmpl = load_auto_cache("weixin_tmpl",array("account_id"=>$this->account['id']));
  74. // }
  75. // }
  76. // }
  77. $this->is_wx = false;
  78. }
  79. public function set_debug($status=false){
  80. $this->debug = $status;
  81. }
  82. //emali _1
  83. public function msg_tmpl($msg_type=''){
  84. if($msg_type){
  85. $this->msg_type = $msg_type;
  86. }
  87. $tmpl = $GLOBALS['db']->getRowCached("select * from ".DB_PREFIX."msg_template where name = '".$this->msg_type."'");
  88. $tmpl_content= $tmpl['content'];
  89. $this->tmpl_content = $tmpl_content;
  90. }
  91. //email _2.1
  92. public function email_content_code(){
  93. $user_info = $this->user_info;
  94. $user_info['logo']=app_conf("SITE_LOGO");
  95. $user_info['site_name']=app_conf("SITE_NAME");
  96. $time=get_gmtime();
  97. $user_info['send_time']=to_date($time,'Y年m月d日');
  98. $user_info['send_time_ms']=to_date($time,'Y年m月d日 H时i分');
  99. $this->log("function email_content_code :tmple_email_name = ".$user_info['tmple_email_name']." :user_info");
  100. $this->log($user_info);
  101. if($user_info['tmple_email_name']){
  102. $GLOBALS['tmpl']->assign($user_info['tmple_email_name'],$user_info);
  103. }else{
  104. $GLOBALS['tmpl']->assign("user",$user_info);
  105. }
  106. $msg = $GLOBALS['tmpl']->fetch("str:".$this->tmpl_content);
  107. $this->msg_content = $msg;
  108. }
  109. //sms_2.3
  110. public function sms_content_code(){
  111. $user_info = $this->user_info;
  112. if($user_info['tmpl_sms_name']){
  113. $GLOBALS['tmpl']->assign($user_info['tmpl_sms_name'],$user_info);
  114. }else{
  115. $GLOBALS['tmpl']->assign("user",$user_info);
  116. }
  117. $msg = $GLOBALS['tmpl']->fetch("str:".$this->tmpl_content);
  118. $this->msg_content = $msg;
  119. }
  120. //wx_2.4
  121. public function wx_content_code($tmpl){
  122. if($this->wx_tmpl[$tmpl]&&$this->user_info['wx_openid']){
  123. $msg = $this->wx_tmpl[$tmpl]['msg'];
  124. $data = unserialize($msg);
  125. $time = get_gmtime();
  126. $now_date = to_date($time);
  127. $wx_url = get_domain().url_wap("account#index");
  128. $this->log('function:wx_content_code 参数$tmpl:'.$tmpl);
  129. if($tmpl=='OPENTM201490080'){
  130. //调用OPENTM201490080 ,订单支付成功
  131. $data['keyword1']=array('value'=>$this->user_info['notice_sn'],'color'=>'#173177');
  132. $data['keyword2']=array('value'=>$this->user_info['deal_name'],'color'=>'#173177');
  133. $data['keyword3']=array('value'=>format_price($this->user_info['paid_money']),'color'=>'#173177');
  134. $wx_url = get_domain().url_wap("account#view_order",array('id'=>$this->user_info['notice_sn']));
  135. }elseif($tmpl=='OPENTM206915380'){
  136. //调用OPENTM206915380 ,后台管理操作通知
  137. $data['keyword1']=array('value'=>$this->user_info['control_type'],'color'=>'#173177');
  138. $data['keyword2']=array('value'=>$now_date,'color'=>'#173177');
  139. $data['keyword3']=array('value'=>$this->user_info['control_content'],'color'=>'#173177');
  140. $data['keyword4']=array('value'=>'处理完成','color'=>'#173177');
  141. $wx_url = get_domain().url_wap("index");
  142. }elseif($tmpl=='OPENTM207029514'){
  143. $data['first'] = array('value'=>$this->user_info['control_type'],'color'=>'#173177');
  144. $data['keyword1']=array('value'=>$this->user_info['control_content'],'color'=>'#173177');
  145. $data['keyword2']=array('value'=>$now_date,'color'=>'#173177');
  146. if($this->user_info['control_url']){
  147. $wx_url = $this->user_info['control_url'];
  148. }
  149. }elseif($tmpl=='OPENTM203026900'){
  150. $data['keyword1']=array('value'=>$this->user_info['wx_code'],'color'=>'#173177');
  151. $data['keyword2']=array('value'=>$this->user_info['expire_time'],'color'=>'#173177');
  152. }elseif($tmpl=='OPENTM267386236'){
  153. $data['keyword1']=array('value'=>format_price($this->user_info['incharge_money']),'color'=>'#173177');
  154. $data['keyword2']=array('value'=>$now_date,'color'=>'#173177');
  155. }elseif($tmpl=='TM00004'){
  156. //退款通知
  157. $data['keyword1']=array('value'=>$this->user_info['control_content'],'color'=>'#173177');
  158. $data['keyword2']=array('value'=>format_price($this->user_info['refund_money']),'color'=>'#173177');
  159. }elseif($tmpl=='TM00979'){
  160. //提现申请通知
  161. $data['first'] = array('value'=>$this->user_info['control_content'],'color'=>'#173177');
  162. $data['money']=array('value'=>format_price($this->user_info['carray_money']),'color'=>'#173177');
  163. $data['timet']=array('value'=>$now_date,'color'=>'#173177');
  164. }elseif($tmpl=='OPENTM202425107'){
  165. //提现结果通知
  166. $data['keyword1']=array('value'=>format_price($this->user_info['carray_money']),'color'=>'#173177');
  167. $data['keyword2']=array('value'=>$this->user_info['carray_bank'],'color'=>'#173177');
  168. $data['keyword3']=array('value'=>$this->user_info['carray_create_time'],'color'=>'#173177');
  169. $data['keyword4']=array('value'=>$this->user_info['carray_end_time'],'color'=>'#173177');
  170. $data['keyword5']=array('value'=>$this->user_info['result'],'color'=>'#173177');
  171. }elseif($tmpl=='OPENTM202116678'){
  172. //众筹通知
  173. $data['keyword1']=array('value'=>$this->user_info['control_title'],'color'=>'#173177');
  174. $data['keyword2']=array('value'=>$this->user_info['control_content'],'color'=>'#173177');
  175. }
  176. $info = array(
  177. 'touser'=>$this->user_info['wx_openid'],
  178. 'template_id'=>$this->wx_tmpl[$tmpl]['template_id'],
  179. 'url'=>$wx_url,
  180. 'topcolor'=>'#FF0000',
  181. 'data'=>$data
  182. );
  183. $this->log('function:wx_content_code 输出:'.var_export($info,true));
  184. $this->msg_content = serialize($info);
  185. }
  186. }
  187. /*
  188. * 构造邮件
  189. * email _3
  190. * @content 发送内容
  191. * @$dest_email 目标邮件
  192. * @$email_title 邮件标题
  193. * @$user_id 发送会员
  194. * @$is_html 是否html
  195. * @$param 发送参数
  196. */
  197. public function caret_data($type,$param){
  198. if($type == 'wx'){
  199. $msg_data['send_time'] = 0;
  200. $msg_data['is_send'] = 0;
  201. $msg_data['create_time'] = get_gmtime();
  202. $msg_data['content'] = addslashes($this->msg_content);;
  203. //$msg_data['is_html'] = 1;
  204. if($param){
  205. foreach($param as $k=>$v){
  206. $msg_data[$k] = $v;
  207. }
  208. }
  209. $this->data = $msg_data;
  210. }else{
  211. if(app_conf("MAIL_ON")==0&&$type=='email')
  212. {
  213. return false;
  214. }
  215. if(app_conf("SMS_ON")==0&&$type=='sms')
  216. {
  217. return false;
  218. }
  219. if($this->msg_type != 'text'){
  220. $msg_data['send_time'] = 0;
  221. $msg_data['is_send'] = 0;
  222. $msg_data['create_time'] = get_gmtime();
  223. $msg_data['content'] = addslashes($this->msg_content);;
  224. //$msg_data['is_html'] = 1;
  225. if($param){
  226. foreach($param as $k=>$v){
  227. $msg_data[$k] = $v;
  228. }
  229. }
  230. $this->data = $msg_data;
  231. }else{
  232. $msg_data['send_type'] = 1;
  233. $msg_data['content'] = addslashes($this->msg_content);;
  234. $msg_data['send_time'] = 0;
  235. $msg_data['is_send'] = 0;
  236. $msg_data['create_time'] = get_gmtime();
  237. $msg_data['is_html'] = 1;
  238. $this->data = $msg_data;
  239. }
  240. }
  241. }
  242. /*
  243. * msg_4 组装
  244. */
  245. public function msg_reply($type,$tmlp='',$data){
  246. if($type=='email'||$type=='sms'){
  247. if(app_conf("MAIL_ON")!=1&&$type=='email'){
  248. return false;
  249. }elseif(app_conf("SMS_ON")!=1&&$type=='sms'){
  250. return false;
  251. }
  252. $this->msg_tmpl($tmlp);
  253. if($type=='email'){
  254. $this->email_content_code();
  255. }else{
  256. $this->sms_content_code();
  257. }
  258. $this->caret_data($type,$data);
  259. $this->insert_deal_msg_list();
  260. }elseif($type=='wx'){
  261. $this->wx_content_code($tmlp);
  262. $this->caret_data($type,$data);
  263. $this->insert_weixin_msg_list();
  264. }
  265. }
  266. /*操作类型$control_type
  267. * 操作内容$control_content
  268. * 后台管理通知
  269. */
  270. public function msg_admin_manage($type,$control_type,$control_content){
  271. if($type=='wx'){
  272. $this->log("msg_admin_manage");
  273. $user_info= array();
  274. $user_info['control_type'] = $control_type;
  275. $user_info['control_content']= $control_content;
  276. $user_info['wx_openid'] = $this->account['test_user'];
  277. $this->user_info = $user_info;
  278. if($user_info['wx_openid']){
  279. $msg_data['title'] = "后台-".$user_info['control_type'];
  280. $msg_data['dest'] = $user_info['wx_openid'];
  281. $msg_data['user_id'] = 0;
  282. $msg_data['is_html'] = 0;
  283. $msg_data['send_type'] = 2;
  284. $this->msg_reply('wx','OPENTM206915380',$msg_data);
  285. }
  286. }
  287. }
  288. /*
  289. * 会员提醒
  290. */
  291. public function msg_member_remind($type,$dest,$control_type,$control_content,$control_url=''){
  292. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$dest);
  293. $user_info['control_type']=$control_type;
  294. $user_info['control_content']= $control_content;
  295. $user_info['control_url']= $control_url;
  296. $this->user_info = $user_info;
  297. $this->log("function msg_member_remind :user_info");
  298. $this->log($this->user_info);
  299. if($user_info['wx_openid']){
  300. $msg_data['title'] = "会员提醒-".$user_info['control_type'];
  301. $msg_data['dest'] = $user_info['wx_openid'];
  302. $msg_data['user_id'] = 0;
  303. $msg_data['is_html'] = 0;
  304. $msg_data['send_type'] = 2;
  305. $this->msg_reply('wx','OPENTM207029514',$msg_data);
  306. }
  307. }
  308. /*
  309. * 构造notify
  310. */
  311. public function msg_notify($user_id,$content,$url_route,$url_param){
  312. $notify_user = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id = ".intval($user_id));
  313. if($notify_user)
  314. {
  315. $notify['user_id'] = $user_id;
  316. $notify['log_info'] = $content;
  317. $notify['log_time'] = get_gmtime();
  318. $notify['url_route'] = $url_route;
  319. $notify['url_param'] = $url_param;
  320. $this->data = $notify;
  321. $this->insert_user_notify();
  322. $url = get_domain().parse_url_tag_wap("u:".$url_route."|".$url_param);
  323. $this->msg_member_remind('wx', $user_id, '消息通知', $content,$url);
  324. }
  325. }
  326. /*
  327. /*
  328. * 发送付款通知邮件
  329. */
  330. public function msg_paid($type,$dest,$money,$order_id){
  331. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$dest);
  332. $user_info['notice_sn'] = $order_id ;
  333. $user_info['deal_name'] = $GLOBALS['db']->getOne("select deal_name from ".DB_PREFIX."deal_order where id=".$order_id);
  334. $user_info['paid_money']=number_price_format($money);
  335. $this->user_info = $user_info;
  336. if($type == 'email'&&$user_info){
  337. //邮件通知
  338. if(!empty($user_info['email'])){
  339. $msg_data['title'] = app_conf("SITE_NAME")."已付款通知";
  340. $msg_data['dest'] = $user_info['email'];
  341. $msg_data['user_id'] = $user_info['user_id'];
  342. $msg_data['is_html'] = 1;
  343. $msg_data['send_type'] = 1;
  344. $this->msg_reply('email','TPL_MAIL_INVESTOR_PAID_STATUS',$msg_data);
  345. }
  346. }elseif($type == 'sms'&&$user_info){
  347. if(!empty($user_info['mobile'])){
  348. $msg_data['title'] = "短信已付款通知";
  349. $msg_data['dest'] = $user_info['mobile'];
  350. $msg_data['user_id'] = $user_info['user_id'];
  351. $msg_data['is_html'] = 0;
  352. $msg_data['send_type'] = 0;
  353. $this->msg_reply('sms','TPL_SMS_INVESTOR_PAID_STATUS',$msg_data);
  354. }
  355. }
  356. if($this->is_wx&&$user_info['wx_openid']){
  357. //调用OPENTM201490080 ,订单支付成功
  358. $msg_data['title'] = "订单支付成功";
  359. $msg_data['dest'] = $user_info['wx_openid'];
  360. $msg_data['user_id'] = $user_info['user_id'];
  361. $msg_data['is_html'] = 0;
  362. $msg_data['send_type'] = 2;
  363. $this->msg_reply('wx','OPENTM201490080',$msg_data);
  364. }
  365. }
  366. public function get_user_info($dest,$type = 'email'){
  367. if($GLOBALS['user_info']['id']){
  368. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id='".$GLOBALS['user_info']['id']."'");
  369. }else{
  370. if($type=='email'){
  371. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where email='".$dest."'");
  372. }elseif($type=='sms'){
  373. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where mobile='".$dest."'");
  374. }
  375. }
  376. return $user_info;
  377. }
  378. /*
  379. * 发送验证码
  380. */
  381. public function msg_verify($type,$dest,$code,$title=''){
  382. $user_info = array();
  383. if($type == 'email'){
  384. if(!empty($dest)){
  385. $user_info = $this->get_user_info($dest,$type);
  386. $user_info['send_code'] = $code;
  387. $user_info['tmpl_email_name'] = 'user';
  388. $this->user_info = $user_info;
  389. $this->log("function msg_verify :user_info");
  390. $this->log($this->user_info);
  391. if($title){
  392. $msg_data['title'] = $title;
  393. }else{
  394. $msg_data['title'] = "邮件验证码";
  395. }
  396. $msg_data['dest'] =$dest;
  397. $msg_data['user_id'] = $user_info['user_id'];
  398. $msg_data['is_html'] = 1;
  399. $msg_data['send_type'] = 1;
  400. $msg_data['code'] = $code;
  401. $this->msg_reply('email','TPL_MAIL_USER_VERIFY',$msg_data);
  402. }
  403. }elseif($type == 'sms'){
  404. if(!empty($dest)){
  405. $user_info = $this->get_user_info($dest,$type);
  406. $user_info['mobile'] = $dest;
  407. $user_info['code'] = $code;
  408. $user_info['tmpl_sms_name'] = 'verify';
  409. $this->user_info = $user_info;
  410. $this->log("function msg_verify :user_info");
  411. $this->log($this->user_info);
  412. if($title){
  413. $msg_data['title'] = $title;
  414. }else{
  415. $msg_data['title'] = "短信验证码";
  416. }
  417. $msg_data['dest'] = $user_info['mobile'];
  418. $msg_data['user_id'] = $GLOBALS['user_info']['id'];
  419. $msg_data['is_html'] = 0;
  420. $msg_data['send_type'] = 0;
  421. $msg_data['code'] =$code;
  422. $this->msg_reply('sms','TPL_SMS_VERIFY_CODE',$msg_data);
  423. }
  424. }
  425. if($this->is_wx&&$user_info['wx_openid']){
  426. $user_info['wx_code'] = $code;
  427. $user_info['expire_time'] = to_date(get_gmtime()+60*5);
  428. $this->user_info = $user_info;
  429. //调用OPENTM201490080 ,订单支付成功
  430. $msg_data['title'] = "验证码通知";
  431. $msg_data['dest'] = $user_info['wx_openid'];
  432. $msg_data['user_id'] = $user_info['user_id'];
  433. $msg_data['is_html'] = 0;
  434. $msg_data['send_type'] = 2;
  435. $this->msg_reply('wx','OPENTM203026900',$msg_data);
  436. }
  437. }
  438. /*
  439. * 发送验证码
  440. */
  441. public function tzt_msg_verify($type,$dest,$code,$user_id){
  442. if($type == 'sms'){
  443. if(!empty($dest)){
  444. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$user_id);
  445. $user_info['mobile'] = $dest;
  446. $user_info['code'] = $code;
  447. $user_info['tmpl_sms_name'] = 'verify';
  448. $this->user_info = $user_info;
  449. //$this->log("function msg_verify :user_info");
  450. //$this->log($this->user_info);
  451. $msg_data['title'] = "投资通短信验证码";
  452. $msg_data['dest'] = $user_info['mobile'];
  453. $msg_data['user_id'] = $user_id;
  454. $msg_data['is_html'] = 0;
  455. $msg_data['send_type'] = 0;
  456. $msg_data['code'] =$code;
  457. $this->msg_reply('sms','TPL_SMS_TZT_VERIFY_CODE',$msg_data);
  458. }
  459. }
  460. }
  461. /*
  462. * 路演申请参会的审核状态发送
  463. */
  464. public function roadshow_msg_status($type,$dest,$roadshow_id,$is_effect,$user_id){
  465. if($type == 'sms'){
  466. if(!empty($dest)){
  467. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$user_id);
  468. $roadshow_deal_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."roadshow_deal where id=".$roadshow_id);
  469. $user_info['mobile'] = $dest;
  470. $user_info['roadshow_name'] =$roadshow_deal_info['name'];
  471. $user_info['roadshow_is_effect'] =$is_effect;
  472. $this->user_info = $user_info;
  473. $msg_data['title'] = " 路演申请参会的审核状态";
  474. $msg_data['dest'] = $user_info['mobile'];
  475. $msg_data['user_id'] = $user_id;
  476. $msg_data['is_html'] = 0;
  477. $msg_data['send_type'] = 0;
  478. $this->msg_reply('sms','TPL_SMS_ROADSGOW_STATUS',$msg_data);
  479. }
  480. }
  481. }
  482. /*
  483. * 充值通知
  484. */
  485. public function msg_incharge($type,$dest,$money){
  486. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$dest);
  487. if($this->is_wx&&$user_info['wx_openid']){
  488. $user_info['incharge_money'] = $money;
  489. $this->user_info = $user_info;
  490. //调用OPENTM201490080 ,订单支付成功
  491. $msg_data['title'] = "充值通知";
  492. $msg_data['dest'] = $user_info['wx_openid'];
  493. $msg_data['user_id'] = $user_info['user_id'];
  494. $msg_data['is_html'] = 0;
  495. $msg_data['send_type'] = 2;
  496. $this->msg_reply('wx','OPENTM267386236',$msg_data);
  497. }
  498. }
  499. /*
  500. * 退款通知
  501. */
  502. public function msg_refund($type,$dest,$money,$control_content=''){
  503. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$dest);
  504. if($this->is_wx&&$user_info['wx_openid']){
  505. $user_info['refund_money'] = $money;
  506. $user_info['control_content'] = $control_content;
  507. $this->user_info = $user_info;
  508. //调用OPENTM201490080 ,订单支付成功
  509. $msg_data['title'] = "退款通知";
  510. $msg_data['dest'] = $user_info['wx_openid'];
  511. $msg_data['user_id'] = $user_info['user_id'];
  512. $msg_data['is_html'] = 0;
  513. $msg_data['send_type'] = 2;
  514. $this->msg_reply('wx','TM00004',$msg_data);
  515. }
  516. }
  517. /*
  518. * 提现通知
  519. */
  520. public function msg_carray_money_notice($type,$money,$user_name){
  521. if($this->is_wx&&$this->account['test_user']&&$user_name){
  522. $user_info['carray_money'] = $money;
  523. $user_info['control_content'] = '会员'.$user_name.'余额提现申请已提交,请您及时登录后台处理!';
  524. $user_info['wx_openid'] = $this->account['test_user'];
  525. $this->user_info = $user_info;
  526. $this->log("function msg_carray_money_notice :user_info");
  527. $this->log($this->user_info);
  528. //调用OPENTM201490080 ,订单支付成功
  529. $msg_data['title'] = "提现申请通知";
  530. $msg_data['dest'] =$this->account['test_user'];
  531. $msg_data['user_id'] = $user_info['user_id'];
  532. $msg_data['is_html'] = 0;
  533. $msg_data['send_type'] = 2;
  534. $this->msg_reply('wx','TM00979',$msg_data);
  535. }
  536. }
  537. /*
  538. * 提现结果通知
  539. */
  540. public function msg_carray_money_result($type,$dest,$refund_data){
  541. $user_info = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$dest);
  542. if($this->is_wx&&$user_info['wx_openid']&&$refund_data){
  543. $user_info['carray_money'] = $refund_data['money'];
  544. $user_info['carray_bank'] = get_carray_info($refund_data['user_bank_id']);
  545. $user_info['carray_create_time'] = to_date($refund_data['create_time']);
  546. $user_info['carray_end_time'] = to_date(get_gmtime());
  547. if($refund_data['is_pay']==1){
  548. $user_info['result'] = '申请通过,请等待收款!';
  549. }else{
  550. $user_info['result'] = '申请拒绝,如有疑问请咨询客服!';
  551. }
  552. $this->user_info = $user_info;
  553. //调用OPENTM201490080 ,订单支付成功
  554. $msg_data['title'] = "提现审核结果通知";
  555. $msg_data['dest'] = $user_info['wx_openid'];
  556. $msg_data['user_id'] = $user_info['user_id'];
  557. $msg_data['is_html'] = 0;
  558. $msg_data['send_type'] = 2;
  559. $this->msg_reply('wx','OPENTM202425107',$msg_data);
  560. }
  561. }
  562. /*
  563. * 众筹状态通知
  564. * status 0 表示创建和修改项目 1表示 提交审核 2表示审核通过 3表示审核失败
  565. * 10表示项目进行中 11表示项目成功 12表示项目失败 13表示发放回报
  566. * 20表示股权进行中 21表示认投成功 22表示认投失败 23表示运行用户付款 24表示拒绝用户付款 25表示付款时间截止,项目结束
  567. */
  568. public function msg_zc_status($type,$dest,$deal_id,$deal_status,$tmpl_name=''){
  569. if(is_array($deal_id)){
  570. $deal = $deal_id;
  571. }else{
  572. $deal = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."deal where id = ".$deal_id);
  573. }
  574. if(!$deal){
  575. return false;
  576. }
  577. $deal_name = $deal['name'];
  578. $status = $deal_status;
  579. $user = $GLOBALS['db']->getRow("select *,id as user_id from ".DB_PREFIX."user where id=".$deal['user_id']);
  580. $deal_user_name = $user['user_name'];
  581. if($dest=='admin'){
  582. $user_info=array();
  583. $user_info['wx_openid'] = $this->account['test_user'];
  584. $user_info['email'] = app_conf("REPLY_ADDRESS");
  585. if($status==self::CROW_EXAMINE){
  586. $user_info['control_content'] = "项目发起人 ".$deal_user_name." 提交了项目".$deal_name.",请及时登录后台审核!";
  587. $user_info['title'] = "众筹通知-审核众筹项目";
  588. }
  589. }else{
  590. $user_info = $user;
  591. if($status==self::CROW_CREATE){
  592. $user_info['control_content'] = '您已经创建或修改了'.$deal_name.',可以申请提交审核!注意:审核中不可修改项目!';
  593. $user_info['title'] = "众筹通知-创建和修改项目";
  594. }elseif($status==self::CROW_EXAMINE_SUCCESS){
  595. $user_info['control_content'] = '恭喜您的项目'.$deal_name.'审核通过!';
  596. $user_info['title'] = "众筹通知-项目审核通过";
  597. }elseif($status==self::CROW_EXAMINE_FAIL){
  598. $user_info['control_content'] = '您的项目'.$deal_name.'审核未通过!原因:'.$deal['refuse_reason'];
  599. $user_info['title'] = "众筹通知-项目审核未通过";
  600. }elseif($status==self::CROW_PROJECT_SUCCESS){
  601. $user_info['control_content'] = '您参与的项目'.$deal_name.'众筹成功!';
  602. $user_info['title'] = "众筹通知-项目众筹成功";
  603. }elseif($status==self::CROW_PROJECT_FAIL){
  604. $user_info['control_content'] = '您参与的项目'.$deal_name.'众筹失败!';
  605. $user_info['title'] = "众筹通知-项目众筹失败";
  606. }elseif($status==self::CROW_INVEST_PAY_ALLOW){
  607. $user_info['control_content'] = '您参与的股权项目'.$deal_name.'众筹失败!';
  608. $user_info['title'] = "众筹通知-您的投资通过";
  609. }
  610. }
  611. if(!$user_info['title']){
  612. $user_info['title'] = "众筹通知";
  613. }
  614. $user_info['control_title'] = $deal_name;
  615. $this->user_info = $user_info;
  616. if($type == 'email'&&$user_info){
  617. //邮件通知
  618. if(!empty($user_info['email'])){
  619. $msg_data['title'] = $user_info['title'];
  620. $msg_data['dest'] = $user_info['email'];
  621. $msg_data['user_id'] = $user_info['user_id'];
  622. $msg_data['is_html'] = 1;
  623. $msg_data['send_type'] = 1;
  624. if($tmpl_name){
  625. $this->msg_reply('email',$tmpl_name,$msg_data);
  626. }else{
  627. $this->msg_reply('email','TPL_MAIL_ZC_STATUS',$msg_data);
  628. }
  629. }
  630. }elseif($type == 'sms'&&$user_info){
  631. if(!empty($user_info['mobile'])){
  632. $msg_data['title'] = $user_info['title'];
  633. $msg_data['dest'] = $user_info['mobile'];
  634. $msg_data['user_id'] = $user_info['user_id'];
  635. $msg_data['is_html'] = 0;
  636. $msg_data['send_type'] = 0;
  637. if($tmpl_name){
  638. $this->msg_reply('sms',$tmpl_name,$msg_data);
  639. }else{
  640. $this->msg_reply('sms','TPL_SMS_ZC_STATUS',$msg_data);
  641. }
  642. }
  643. }
  644. if($this->is_wx&&$user_info['wx_openid'] ){
  645. //调用OPENTM201490080 ,订单支付成功
  646. $msg_data['title'] = "众筹状态通知";
  647. $msg_data['dest'] = $user_info['wx_openid'];
  648. $msg_data['user_id'] = $user_info['user_id'];
  649. $msg_data['is_html'] = 0;
  650. $msg_data['send_type'] = 2;
  651. $this->msg_reply('wx','OPENTM202116678',$msg_data);
  652. }
  653. }
  654. /*
  655. * 投资人资格审核
  656. */
  657. public function msg_invest_status($type,$dest,$user_info){
  658. if($type == 'email'&&$user_info){
  659. //邮件通知
  660. if(!empty($user_info['email'])){
  661. $user_info['is_investor_name']=get_investor($user_info['is_investor']);
  662. $user_info['investor_status_name']=get_investor_status($user_info['investor_status']);
  663. $user_info['zc_type']="修改申请";
  664. if($user_info['investor_status']==1){
  665. $user_info['verify_url'] = get_domain().url("settings#invest_info");
  666. $info="您的投资人申请已经通过";
  667. $info_url="account#index";
  668. }else{
  669. $user_info['verify_url'] = get_domain().url("settings#invest_info");
  670. $info="您的投资人申请未通过";
  671. if($user_info['investor_send_info']){
  672. $info.=",理由是".$user_info['investor_send_info'];
  673. }
  674. $info.=",点击链接重新申请";
  675. $info_url="settings#security";
  676. }
  677. $this->user_info = $user_info;
  678. $msg_data['title'] = app_conf("SITE_NAME")."帐号-".$user_info['is_investor_name'].$user_info['investor_status_name'];
  679. $msg_data['dest'] = $user_info['email'];
  680. $msg_data['user_id'] = $user_info['user_id'];
  681. $msg_data['is_html'] = 1;
  682. $msg_data['send_type'] = 1;
  683. $this->msg_reply('email','TPL_MAIL_INVESTOR_STATUS',$msg_data);
  684. $GLOBALS['db']->query("update ".DB_PREFIX."user set investor_status_send=1 where id=".$user_info['id']);
  685. $this->msg_notify($dest,$info,$info_url,'');
  686. }
  687. }elseif($type == 'sms'&&$user_info&&app_conf("INVEST_STATUS_SEND_STATUS")==2){
  688. if(!empty($user_info['mobile'])){
  689. $user_info['is_investor_name']=get_investor($user_info['is_investor']);
  690. $user_info['investor_status_name']=get_investor_status($user_info['investor_status']);
  691. if($user_info['investor_status']==1){
  692. $user_info['verify_url'] = get_domain().url("account#index");
  693. $info="您的投资人申请已经通过";
  694. $info_url="account#index";
  695. }else{
  696. $user_info['verify_url'] = get_domain().url("investor#index");
  697. $info="您的投资人申请未通过";
  698. if($user_info['investor_send_info']){
  699. $info.=",理由是".$user_info['investor_send_info'];
  700. }
  701. $info.=",点击链接重新申请";
  702. $info_url="settings#security";
  703. }
  704. $this->user_info = $user_info;
  705. $msg_data['title'] = "短信通知-".$user_info['is_investor_name'].$user_info['investor_status_name'];
  706. $msg_data['dest'] = $user_info['mobile'];
  707. $msg_data['user_id'] = $user_info['user_id'];
  708. $msg_data['is_html'] = 0;
  709. $msg_data['send_type'] = 0;
  710. $this->msg_reply('sms','TPL_SMS_INVESTOR_STATUS',$msg_data);
  711. $GLOBALS['db']->query("update ".DB_PREFIX."user set investor_status_send=1 where id=".$user_info['id']);
  712. $this->msg_notify($dest,$info,$info_url,'');
  713. }
  714. }
  715. }
  716. public function msg_investor_go_pay($type,$invest_id,$order_id=''){
  717. $user_info=$GLOBALS['db']->getRow("select invest.id as invest_id,invest.user_id,invest.money,u.user_name,u.mobile,u.email,d.pay_end_time,d.name as deal_name from ".DB_PREFIX."investment_list as invest " .
  718. "left join ".DB_PREFIX."user as u on u.id=invest.user_id " .
  719. "left join ".DB_PREFIX."deal as d on d.id=invest.deal_id" .
  720. " where invest.id=$invest_id and invest.send_type=0 ");
  721. $user_info['money']=number_price_format($user_info['money']);
  722. $user_info['pay_end_time']=to_date($user_info['pay_end_time'],"Y-m-d");
  723. if($type == 'email'&&$user_info){
  724. //邮件通知
  725. if(!empty($user_info['email'])){
  726. if($order_id){
  727. $user_info['note_url']=get_domain().url("account#view_order",array('id'=>$order_id));
  728. $info_url = "account#view_order";
  729. $info_param = "id=".$order_id;
  730. }else{
  731. $user_info['note_url']=get_domain().url("account#index");
  732. $info_url = "account#index";
  733. $info_param = "";
  734. }
  735. $this->user_info = $user_info;
  736. $msg_data['title'] =app_conf("SITE_NAME")."付款通知-".$user_info['deal_name'];
  737. $msg_data['dest'] = $user_info['email'];
  738. $msg_data['user_id'] = $user_info['user_id'];
  739. $msg_data['is_html'] = 1;
  740. $msg_data['send_type'] = 1;
  741. $this->msg_reply('email','TPL_MAIL_INVESTOR_PAY_STATUS',$msg_data);
  742. $GLOBALS['db']->query("update ".DB_PREFIX."investment_list set send_type=1 where id=".$user_info['invest_id']);
  743. $this->msg_notify($dest,$info,$info_url,$info_param);
  744. }
  745. }elseif($type == 'sms'&&$user_info&&app_conf("INVEST_STATUS_SEND_STATUS")==2){
  746. if(!empty($user_info['mobile'])){
  747. if($order_id){
  748. $info_url = "account#view_order";
  749. $info_param = "id=".$order_id;
  750. }else{
  751. $info_url = "account#index";
  752. $info_param = "";
  753. }
  754. $this->user_info = $user_info;
  755. $msg_data['title'] = "短信付款通知-".$user_info['deal_name'];
  756. $msg_data['dest'] = $user_info['mobile'];
  757. $msg_data['user_id'] = $user_info['user_id'];
  758. $msg_data['is_html'] = 0;
  759. $msg_data['send_type'] = 0;
  760. $this->msg_reply('sms','TPL_SMS_INVESTOR_PAY_STATUS',$msg_data);
  761. $GLOBALS['db']->query("update ".DB_PREFIX."investment_list set send_type=1 where id=".$user_info['invest_id']);
  762. $this->msg_notify($dest,$info,$info_url,$info_param);
  763. }
  764. }
  765. }
  766. /*
  767. * 登录超时短信
  768. */
  769. public function sms_tips($tel,$overtime){
  770. $mobile = $tel;
  771. $overtime = $overtime;
  772. require_once APP_ROOT_PATH."system/utils/es_sms.php";
  773. $sms = new sms_sender();
  774. $tmpl = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."msg_template where name = 'TPL_SMS_TIPS_STATUS'");
  775. $tmpl_content = $tmpl['content'];
  776. $tips['time'] = $overtime;
  777. $GLOBALS['tmpl']->assign("tips",$tips);
  778. $msg = $GLOBALS['tmpl']->fetch("str:".$tmpl_content);
  779. $result = $sms->sendSms($mobile,$msg);
  780. return $result;
  781. }
  782. /*
  783. * 测试邮件
  784. */
  785. public function mail_demo($mail){
  786. $test_mail = $mail;
  787. require_once APP_ROOT_PATH."system/utils/es_mail.php";
  788. $mail = new mail_sender();
  789. $demo_html=file_get_contents(APP_ROOT_PATH."public/mail_html/demo.html");
  790. $info=array();
  791. $info['content']="测试邮件";
  792. $info['logo']=app_conf("SITE_LOGO");
  793. $info['site_name']=app_conf("SITE_NAME");
  794. $time=get_gmtime();
  795. $info['send_time']=to_date($time,'Y年m月n日');
  796. $GLOBALS['tmpl']->assign("info",$info);
  797. $msg = $GLOBALS['tmpl']->fetch("str:".$demo_html);
  798. $mail->AddAddress($test_mail);
  799. $mail->IsHTML(true); // 设置邮件格式为 HTML
  800. $mail->Subject = l("DEMO_MAIL"); // 标题
  801. $mail->Body = $msg; // 内容
  802. $mail->FromName = app_conf("SITE_NAME");
  803. $status = $mail->Send();
  804. $result =array('status'=>1,'info'=>'');
  805. if(!$status){
  806. $result['status'] = 0;
  807. $result['info'] = $mail->ErrorInfo;
  808. }
  809. return $result;
  810. }
  811. /*
  812. * 测试短信
  813. */
  814. public function sms_demo($tel){
  815. $test_mobile = $tel;
  816. require_once APP_ROOT_PATH."system/utils/es_sms.php";
  817. $sms = new sms_sender();
  818. $tmpl = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."msg_template where name = 'TPL_SMS_VERIFY_CODE'");
  819. $tmpl_content = $tmpl['content'];
  820. $verify['mobile'] = $test_mobile;
  821. $verify['code'] = $code;
  822. $GLOBALS['tmpl']->assign("verify",$verify);
  823. $msg = $GLOBALS['tmpl']->fetch("str:".$tmpl_content);
  824. $result = $sms->sendSms($test_mobile,$msg);
  825. return $result;
  826. }
  827. /*
  828. * 插入数据库deal_msg_list
  829. */
  830. public function insert_deal_msg_list(){
  831. if($this->data){
  832. $this->log("function insert_deal_msg_list :data");
  833. $data = $this->data;
  834. if(app_conf('IS_SMS_DIRECT')==1){
  835. if($data['send_type']==0){
  836. require_once APP_ROOT_PATH."system/utils/es_sms.php";
  837. $sms = new sms_sender();
  838. $result = $sms->sendSms($data['dest'],$data['content']);
  839. $data['is_success'] = intval($result['status']);
  840. $data['result'] = $result['msg'];
  841. }elseif($data['send_type']==1){
  842. require_once APP_ROOT_PATH."system/utils/es_mail.php";
  843. $mail = new mail_sender();
  844. $mail->AddAddress($data['dest']);
  845. $mail->IsHTML($data['is_html']); // 设置邮件格式为 HTML
  846. $mail->Subject = $data['title']; // 标题
  847. $mail->Body = $data['content']; // 内容
  848. $is_success = $mail->Send();
  849. $result = $mail->ErrorInfo;
  850. $data['is_success'] = intval($is_success);
  851. $data['result'] = $result;
  852. }
  853. $data['is_send'] = 1;
  854. $data['send_time'] = get_gmtime();
  855. $this->data = $data;
  856. }
  857. $this->log($this->data);
  858. return $GLOBALS['db']->autoExecute(DB_PREFIX."deal_msg_list",$this->data); //插入
  859. }
  860. }
  861. /*
  862. * 插入 weixin_msg_list
  863. */
  864. public function insert_weixin_msg_list(){
  865. if($this->data){
  866. return $GLOBALS['db']->autoExecute(DB_PREFIX."weixin_msg_list",$this->data); //插入
  867. }
  868. }
  869. /*
  870. * 插入数据库user_notify
  871. */
  872. public function insert_user_notify(){
  873. if($this->data){
  874. return $GLOBALS['db']->autoExecute(DB_PREFIX."user_notify",$this->data); //插入
  875. }
  876. }
  877. /*
  878. * 日志
  879. */
  880. public function log($log){
  881. if ($this->debug && function_exists($this->logcallback)) {
  882. if (is_array($log)) $log = var_export($log,true);
  883. return call_user_func($this->logcallback,$log);
  884. }
  885. }
  886. /*
  887. * 处理信息
  888. * @$msg_type 处理类型
  889. * @$dest 收件人
  890. * @$param 其他信息
  891. */
  892. public function manage_msg($msg_type,$dest='',$param=array()){
  893. $this->msg_type = $msg_type;
  894. $this->log('manage_msg 参数1'.$this->msg_type.",".$dest);
  895. $this->log('manage_msg 参数2'.var_export($param,true));
  896. switch($this->msg_type){
  897. //会员取回密码邮件
  898. case self::MAIL_PASSWORD:
  899. break;
  900. //会员验证邮件
  901. case self::MAIL_VERIFY:
  902. $this->msg_verify('email', $dest, $param['code'],$param['title']);
  903. break;
  904. //邮箱修改模板
  905. case self::MAIL_CHANGE_VERIFY:
  906. break;
  907. //邮件通知用户通过投资人审核
  908. case self::MAIL_INVESTOR_STATUS:
  909. $this->log("MAIL_INVESTOR_STATUS");
  910. $this->msg_zc_status('email', $dest, $param['deal_id'],$param['deal_status'],self::MAIL_INVESTOR_STATUS);
  911. break;
  912. //邮件通知用户投资申请通过-允许付款
  913. case self::MAIL_INVESTOR_GO_PAY:
  914. break;
  915. //邮件通知用户已经付款
  916. case self::MAIL_INVESTOR_PAID:
  917. $this->msg_paid('email',$dest,$param['money'],$param['order_id']);
  918. break;
  919. //测试邮件
  920. case self::MAIL_DEMO:
  921. $re = $this->mail_demo($dest);
  922. return $re;
  923. break;
  924. //项目失败
  925. case self::SMS_DEAL_FAIL:
  926. break;
  927. //项目成功
  928. case self::SMS_DEAL_SUCCESS:
  929. break;
  930. //注册成功通知
  931. case self::SMS_REGISTER_SUCCESS:
  932. break;
  933. //通知项目发起人成功
  934. case self::SMS_DEAL_CREAT_SUCCESS:
  935. break;
  936. //通知项目发起人失败
  937. case self::SMS_DEAL_CREAT_FAIL:
  938. break;
  939. //短信验证码发送
  940. case self::SMS_VERIFY:
  941. $this->msg_verify('sms',$dest,$param['code'],$param['title']);
  942. break;
  943. //短信验证码发送
  944. case self::SMS_TZT_VERIFY:
  945. $this->tzt_msg_verify('sms',$dest,$param['code'],$param['user_id']);
  946. break;
  947. //路演申请参会的审核状态发送
  948. case self::SMS_ROADSHOW_STATUS:
  949. $this->roadshow_msg_status('sms',$dest,$param['roadshow_id'],$param['is_effect'],$param['user_id']);
  950. break;
  951. //短信通知用户通过投资人审核
  952. case self::SMS_INVESTOR_STATUS:
  953. break;
  954. //短信通知用户投资申请通过-允许付款
  955. case self::SMS_INVESTOR_GO_PAY:
  956. break;
  957. //短信通知用户已经付款
  958. case self::SMS_INVESTOR_PAID:
  959. $this->msg_paid('sms',$dest,$param['money'],$param['order_id']);
  960. break;
  961. //测试短信
  962. case self::SMS_DEMO:
  963. $re = $this->sms_demo($dest);
  964. return $re;
  965. break;
  966. //发送通知给用户
  967. case self::MSG_NOTIFY:
  968. $this->msg_notify($dest,$param['content'],$param['url_route'],$param['url_param']);
  969. break;
  970. case self::MSG_PAID:
  971. $status=app_conf("INVEST_PAID_SEND_STATUS");
  972. $this->log("INVEST_PAID_SEND_STATUS == ".$status);
  973. if($status>0){
  974. if($status==1){
  975. return $this->msg_paid('email',$dest,$param['money'],$param['order_id']);
  976. }elseif($status==2){
  977. return $this->msg_paid('sms',$dest,$param['money'],$param['order_id']);
  978. }
  979. }else{
  980. return $this->msg_paid('wx',$dest,$param['money'],$param['order_id']);
  981. }
  982. break;
  983. case self::MSG_ADMIN_MANAGE:
  984. $this->msg_admin_manage('wx',$param['type'],$param['content']);
  985. break;
  986. //会员提醒
  987. case self::MSG_MEMBER_REMIDE:
  988. $this->msg_member_remind('wx', $dest, $param['type'],$param['content']);
  989. break;
  990. //
  991. case self::MSG_INCHARGE:
  992. $this->msg_incharge('wx', $dest, $param['monney']);
  993. break;
  994. //退款
  995. case self::MSG_REFUND:
  996. $this->msg_refund('wx', $dest, $param['monney'],$param['content']);
  997. break;
  998. //MSG_MONEY_CARRY 提现提醒管理员
  999. case self::MSG_MONEY_CARRY_NOTIFIE:
  1000. $this->msg_carray_money_notice('wx' ,$param['money'],$param['user_name']);
  1001. break;
  1002. case self::MSG_MONEY_CARRY_RESULT:
  1003. $this->log("MSG_MONEY_CARRY_RESULT");
  1004. $this->msg_carray_money_result('wx' , $dest, $param);
  1005. break;
  1006. case self::MSG_ZC_STATUS:
  1007. $this->log("MSG_ZC_STATUS");
  1008. $this->msg_zc_status('email', $dest, $param['deal_id'],$param['deal_status']);
  1009. break;
  1010. case self::MSG_INVEST_STATUS:
  1011. $this->log("MSG_ZC_STATUS");
  1012. if(app_conf("INVEST_STATUS_SEND_STATUS")==1){
  1013. $this->msg_invest_status('email', $dest, $param['user_info']);
  1014. }elseif(app_conf("INVEST_STATUS_SEND_STATUS")==2){
  1015. $this->msg_invest_status('sms', $dest, $param['user_info']);
  1016. }
  1017. break;
  1018. case self::MSG_INVESTOR_GO_PAY:
  1019. $this->log("MSG_INVESTOR_GO_PAY");
  1020. if(app_conf("INVEST_PAY_SEND_STATUS")==1){
  1021. $this->msg_invest_status('email', $param['invest_id'],$param['order_id']);
  1022. }elseif(app_conf("INVEST_PAY_SEND_STATUS")==2){
  1023. $this->msg_invest_status('sms', $param['invest_id'],$param['order_id']);
  1024. }
  1025. break;
  1026. }
  1027. }
  1028. }