MTemplateModule.Class.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * 系统模版模块
  4. * Created by PhpStorm.
  5. * User: XiaoMing
  6. * Date: 2019/11/29
  7. * Time: 15:26
  8. */
  9. namespace JinDouYun\Model\System;
  10. use Mall\Framework\Core\ErrorCode;
  11. use Mall\Framework\Core\ResultWrapper;
  12. use JinDouYun\Dao\System\DTemplateModule;
  13. class MTemplateModule
  14. {
  15. private $objDTemplateModule;
  16. private $onlineUserId;
  17. private $onlineEnterpriseId;
  18. public function __construct($onlineUserId,$enterpriseId)
  19. {
  20. $this->onlineUserId = $onlineUserId;
  21. $this->onlineEnterpriseId = $enterpriseId;
  22. $this->objDTemplateModule = new DTemplateModule('default');
  23. }
  24. /**
  25. * 获取系统模板模块
  26. * @param $selectParams
  27. * @return ResultWrapper
  28. */
  29. public function getAll($selectParams)
  30. {
  31. $dbResult = $this->objDTemplateModule->select($selectParams,'id,templateId,title,alias,local','local ASC');
  32. if ($dbResult === false) {
  33. return ResultWrapper::fail($this->objDTemplateModule->error(), ErrorCode::$dberror);
  34. }
  35. $total = $this->objDTemplateModule->count($selectParams);
  36. $return = [
  37. 'data' => $dbResult,
  38. 'total' => ($total) ? intval($total) : 0,
  39. ];
  40. return ResultWrapper::success($return);
  41. }
  42. /**
  43. * @param $selectParams
  44. * @return bool|mixed
  45. */
  46. public function getModuleIdByAlias($selectParams)
  47. {
  48. $dbResult = $this->objDTemplateModule->get_field('id',$selectParams);
  49. if ($dbResult === false){
  50. return 0;
  51. }
  52. return $dbResult;
  53. }
  54. }