Applet.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Content\Lib;
  3. use Dever;
  4. class Applet
  5. {
  6. # 更新数据
  7. public function update_api()
  8. {
  9. $value = Dever::input('value');
  10. if ($value) {
  11. $value = explode('||', $value);
  12. }
  13. $pic = $path = $link = $applet_value = '';
  14. if (isset($value[0])) {
  15. $pic = $value[0];
  16. }
  17. if (isset($value[2])) {
  18. $path = $value[2];
  19. }
  20. if (isset($value[3])) {
  21. $link = $value[3];
  22. }
  23. if (isset($value[1])) {
  24. $applet_value = $value[1];
  25. }
  26. $applet = Dever::db('content/applet')->state();
  27. $option = '<option parent="" value="" selected>当前小程序</option>';
  28. if ($applet) {
  29. foreach ($applet as $k => $v) {
  30. if ($applet_value == $v['appid']) {
  31. $check = 'selected';
  32. } else {
  33. $check = '';
  34. }
  35. $option .= '<option parent="" value="'.$v['appid'].'" '.$check.'>'.$v['name'].'</option>';
  36. }
  37. }
  38. $html = '<div class="layui-card-body">';
  39. $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">选择小程序</label></div><div><select lay-ignore="" class="update_value form-control layui-input layui-select validate[required]" name="editor_applet_id" id="editor_applet_id">'.$option.'</select></div></div></div>';
  40. $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">路径</label></div><div><input type="text" class="update_value form-control layui-input validate[required]" value="'.$path.'" name="editor_applet_path" id="editor_applet_path" autocomplete="new-password" placeholder=""></div></div></div>';
  41. $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">链接-为空则使用小程序里的链接</label></div><div><input type="text" class="update_value form-control layui-input validate[required]" value="'.$link.'" name="editor_applet_link" id="editor_applet_link" autocomplete="new-password" placeholder=""></div></div></div>';
  42. $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">封面图<span style="font-size:12px;font-weight:normal;font-color:#bababa;margin-left:5px;">[图片宽度750px高度自适应,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式]</span></label></div><div><input type="button" style="width:100px;display:inline;padding-left:0px;" class="form-control layui-input image_upload" v="editor_applet_pic" id="file_applet_pic" key="1" value="本地上传" autocomplete="new-password">
  43. <div style="margin-top:5px;">
  44. <input type="text" class="update_value form-control layui-input " name="editor_applet_pic" id="editor_applet_pic" value="'.$pic.'" autocomplete="new-password"></div></div></div></div>';
  45. $html .= '</div>';
  46. return $html;
  47. }
  48. }