Common.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\common\model\Banner;
  4. use app\common\model\Config;
  5. use app\common\model\Org;
  6. use app\hander\HelpHander;
  7. use think\Controller;
  8. use think\Db;
  9. use think\Exception;
  10. class Common extends Base {
  11. public function banner() {
  12. $ret = model('Banner')->getList(5, 1);
  13. HelpHander::success($ret);
  14. }
  15. public function dep() {
  16. $lists = Db::name('dep')
  17. ->field('id,title')
  18. ->where('org_id', $this->orgId)
  19. ->where('enable', 1)
  20. ->where('del', 0)
  21. ->where('ph', 0)
  22. ->select();
  23. HelpHander::success($lists);
  24. }
  25. public function getOrg() {
  26. $info = (new Org())->getInfo($this->orgId);
  27. if (!$info) {
  28. HelpHander::error('项目不存在');
  29. }
  30. HelpHander::success($info);
  31. }
  32. // 获取系统配置
  33. public function getConfig() {
  34. $name = input('name', '', 'trim');
  35. $wyval = (new Config())->getConfig($name, $this->orgId);
  36. HelpHander::success(['val' => $wyval]);
  37. }
  38. public function phprotocol() {
  39. $id = input('orderId',0);
  40. $str = '';
  41. if ($id > 0){
  42. $sign = Db::name('ph_orders')->where('id', $id)->value('sign');
  43. $str = '
  44. <p style="font-family:Calibri;margin-top: 50px">
  45. <span style="font-family:宋体;font-size:28px;">客户签名:</span>
  46. </p>
  47. <p style="font-family:Calibri;">
  48. <img height="150" width="130" src="' . $sign . '" alt="" />
  49. </p>
  50. <p style="font-family:Calibri;margin-top: 10px">
  51. <span style="font-family:宋体;font-size:28px;">护工签名:</span>
  52. </p>
  53. <p style="font-family:Calibri;margin-bottom: 80px">
  54. ';
  55. $todos = Db::name('ph_todo')
  56. ->where('order_id',$id)
  57. ->whereIn('status',[1,2])
  58. ->column('sign');
  59. foreach ($todos as $k => $v){
  60. if ($v){
  61. $str .= '
  62. <img height="130" width="120" src="' . $v . '" alt="" />
  63. ';
  64. }
  65. }
  66. $str .= '</p>';
  67. }
  68. $info = Db::name("ph_protocol")->where('org_id',$this->orgId)->find();
  69. if (!$info) {
  70. HelpHander::success(['content'=>""]);
  71. }
  72. HelpHander::success(['content' => $info['content'].$str]);
  73. }
  74. }