You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StoreServiceAuxiliaryServices.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\services\message\service;
  3. use app\dao\message\service\StoreServiceAuxiliaryDao;
  4. use app\services\BaseServices;
  5. /**
  6. * Class StoreServiceAuxiliaryServices
  7. * @package app\services\message\service
  8. */
  9. class StoreServiceAuxiliaryServices extends BaseServices
  10. {
  11. /**
  12. * StoreServiceAuxiliaryServices constructor.
  13. * @param StoreServiceAuxiliaryDao $dao
  14. */
  15. public function __construct(StoreServiceAuxiliaryDao $dao)
  16. {
  17. $this->dao = $dao;
  18. }
  19. /**
  20. * 保存转接信息
  21. * @param array $data
  22. * @return array
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\DbException
  25. * @throws \think\db\exception\ModelNotFoundException
  26. */
  27. public function saveAuxliary(array $data)
  28. {
  29. $auxliaryInfo = $this->dao->get(['type' => 0, 'binding_id' => $data['binding_id'], 'relation_id' => $data['relation_id']]);
  30. if ($auxliaryInfo) {
  31. $auxliaryInfo->update_time = time();
  32. return $auxliaryInfo->save();
  33. } else {
  34. return $this->dao->save([
  35. 'type' => 0,
  36. 'binding_id' => $data['binding_id'],
  37. 'relation_id' => $data['relation_id'],
  38. 'update_time' => time(),
  39. 'add_time' => time(),
  40. ]);
  41. }
  42. }
  43. }