SmsAccessToken.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\model\system;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 短信 model
  16. * Class SmsAccessToken
  17. * @package app\admin\model\system
  18. */
  19. class SmsAccessToken extends ModelBasic
  20. {
  21. use ModelTrait;
  22. /**添加短信token
  23. * @param $getToken
  24. * @return object
  25. */
  26. public static function smsTokenAdd($getToken)
  27. {
  28. $data=[
  29. 'access_token'=>$getToken['access_token'],
  30. 'stop_time'=>bcsub($getToken['expires_in'],300,0),
  31. ];
  32. return self::set($data);
  33. }
  34. public static function delToken($access_token)
  35. {
  36. return self::where('access_token','<>','')->delete();
  37. }
  38. }