SignPoster.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\wap\model\user;
  12. use service\CanvasService;
  13. use think\Url;
  14. use traits\ModelTrait;
  15. use basic\ModelBasic;
  16. use service\SystemConfigService;
  17. /**签到海报
  18. * Class SignPoster
  19. * @package app\wap\model\user
  20. */
  21. class SignPoster extends ModelBasic
  22. {
  23. use ModelTrait;
  24. /**获取前端海报的数据
  25. * @param $uid
  26. * @return bool|mixed
  27. */
  28. public static function todaySignPoster($uid)
  29. {
  30. $urls = SystemConfigService::get('site_url') . '/';
  31. $url = $urls . 'wap/my/sign_in?spread_uid=' . $uid;
  32. $sign_info = self::todaySignInfo();
  33. if (!$sign_info['poster'] || !$sign_info) return false;
  34. $sign_info['url'] = $url;
  35. return $sign_info;
  36. }
  37. /**获取设置海报
  38. * @return mixed
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\ModelNotFoundException
  41. * @throws \think\exception\DbException
  42. */
  43. public static function todaySignInfo()
  44. {
  45. $time = strtotime(date('Y-m-d', time()));
  46. $signPoster = self::order('sort DESC,id DESC')->select();
  47. $signPoster = count($signPoster) > 0 ? $signPoster->toArray() : [];
  48. $poster = SystemConfigService::get('sign_default_poster');
  49. if (count($signPoster) > 0) {
  50. foreach ($signPoster as $key => $value) {
  51. if ($value['sign_time'] == $time) {
  52. $poster = $value['poster'];
  53. $sign_talk = $value['sign_talk'];
  54. break;
  55. }
  56. }
  57. }
  58. $sign_info['poster'] = isset($poster) ? $poster : '';
  59. $sign_info['sign_talk'] = isset($sign_talk) ? $sign_talk : '';
  60. return $sign_info;
  61. }
  62. }