SmsRecordServices.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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\services\system;
  12. use app\model\system\SmsRecord;
  13. use app\services\user\UserServices;
  14. use qiniu\services\CacheService;
  15. use qiniu\basic\BaseServices;
  16. use think\exception\ValidateException;
  17. use think\facade\Config;
  18. /**
  19. * 短信发送记录
  20. * Class SmsRecordServices
  21. * @package app\services\message\sms
  22. * @mixin SmsRecord
  23. */
  24. class SmsRecordServices extends BaseServices
  25. {
  26. /**
  27. * 构造方法
  28. * SmsRecordServices constructor.
  29. * @param SmsRecord $model
  30. */
  31. public function __construct(SmsRecord $model)
  32. {
  33. $this->model = $model;
  34. }
  35. /**
  36. * 获取短信发送列表
  37. * @param array $where
  38. * @return array
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. */
  43. public function getRecordList(array $where)
  44. {
  45. [$page, $limit] = $this->getPageValue();
  46. $data = $this->getList($where, $page, $limit);
  47. $count = $this->getCount($where);
  48. return compact('data', 'count');
  49. }
  50. public function setRecord($phone, $template, $content, $ip, $store = 'qiniu', $record_id = 0, $uid = 0)
  51. {
  52. return $this->create([
  53. 'phone' => $phone,
  54. 'template' => $template,
  55. 'content' => $content,
  56. 'add_ip' => $ip,
  57. 'store' => $store,
  58. 'uid' => $uid,
  59. 'record_id' => $record_id,
  60. ]);
  61. }
  62. }