TestSms.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/11/14
  6. * Time: 下午7:44
  7. */
  8. use PHPUnit\Framework\TestCase;
  9. /**
  10. * Created by PhpStorm.
  11. * User: stanley-king
  12. * Date: 16/6/27
  13. * Time: 下午10:27
  14. */
  15. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  16. require_once(BASE_ROOT_PATH . '/global.php');
  17. require_once(BASE_CORE_PATH . '/lrlz.php');
  18. require_once(BASE_ROOT_PATH . '/fooder.php');
  19. require_once(BASE_ROOT_PATH . '/helper/stat_helper.php');
  20. require_once(BASE_ROOT_PATH . '/helper/sms_helper.php');
  21. class TestSms extends TestCase
  22. {
  23. public static function setUpBeforeClass() : void
  24. {
  25. Base::run_util();
  26. }
  27. public function testRegister()
  28. {
  29. $mobile = '13911129867';
  30. $sms = new sms_helper();
  31. $ret = $sms->send_code($mobile, sms_helper::register,false);
  32. }
  33. public function testEvidence(){
  34. // $type = 'balance_warning';
  35. // $ret = QueueClient::push('sendSMS', ['mobile'=>17801048874,'type'=>$type,'datas' => [date("m月d日H时") , 500]]);
  36. // $type = 'evidence';
  37. // $ret = QueueClient::push('sendSMS', ['mobile'=>17801048874,'type'=>$type,'datas' => [date("m月d日H时") , 'yezi' , 500]]);
  38. $merchants = Model('merchant')->getMerchantList([],'','','merchant.*,member.available_predeposit');
  39. foreach ($merchants as $merchant){
  40. if(($merchant['available_predeposit'] < $merchant['alarm_amount'] && !empty($merchant['contact_phone']))|| $merchant['available_predeposit'] < 10000)
  41. {
  42. QueueClient::push('sendSMS', ['mobile'=>$merchant['contact_phone'],'type'=>'balance_warning','datas' => [date("m月d日H时") , $merchant['available_predeposit']]]);
  43. }
  44. }
  45. }
  46. public function testInvitee()
  47. {
  48. $sms = new Sms();
  49. $mobile = '13911129867';
  50. //$params[Sms::tpl_reg_user_bonus] = ['amount' => 1.0];
  51. //$params[Sms::tpl_reg_inviter] = ['user_name' => '张莉','level' => 1,'amount' => 5];
  52. $params[Sms::tpl_reg_invitee] = ['user_name' => '张莉','inviter_name' => "桑贵苏",'level' => 3,'amount' => 2];
  53. $params[Sms::tpl_order_complete_inviter] = ['level' => 1,'name' => '桑贵苏','amount' => 2];
  54. $params[Sms::tpl_order_complete_invitee] = ['name' => '桑贵苏','amount' => 2];
  55. foreach ($params as $sms_type => $sms_param) {
  56. $status = $sms->send_oper($mobile,$sms_type,$sms_param);
  57. }
  58. }
  59. public function testOrderSms()
  60. {
  61. $pay_sn = 570510757490858481;
  62. $order = new async\order($pay_sn);
  63. $logistics_no = 10000;
  64. $logistics_company = "顺丰";
  65. $order->onSended($logistics_no,$logistics_company);
  66. echo 0;
  67. }
  68. }