<?php
/**
* lionfish 商城系统
*
* ==========================================================================
* @link http://www.liofis.com/
* @copyright Copyright (c) 2015 liofis.com.
* @license http://www.liofis.com/license.html License
* ==========================================================================
*
* @author cy 2021-05-24
* @desc 万能表单管理
*
*/
namespace Seller\Model;
class AllformModel{
/**
* @author cy 2021-05-24
* @desc 获取万能表单信息
* @param $id
* @return mixed
*/
public function getFormsById($id){
$forms_data = M('lionfish_comshop_forms')->where( array('id' => $id) )->find();
return $forms_data;
}
/**
* @author cy 2021-05-25
* @desc 通过条件获取表单信息
* @param $condition
* @return mixed
*/
public function getFormsByWhere($condition){
$forms_data = M('lionfish_comshop_forms')->where($condition)->find();
return $forms_data;
}
/**
* @author cy 2021-04-30
* @desc 表单类型名称
* @param $form_type
* @return string
*/
public function getFormTypeName($form_type){
$form_type_text = "";
switch ($form_type){
case 'goods':
$form_type_text = '商品表单';
break;
case 'order':
$form_type_text = '下单表单';
break;
case 'apply':
$form_type_text = '申请表单';
break;
}
return $form_type_text;
}
/**
* @author cy 2021-05-19
* @desc 获取已收集的表单数
* @param $form_id
* @return mixed
*/
public function getFormInfoCountByFormId($form_id){
$count = M('lionfish_comshop_form_info')->where( array('form_id' => $form_id) )->count();
return $count;
}
/**
* @author cy 2021-05-25
* @desc 删除表单信息
* @param $form_id
* @return mixed
*/
public function deleteForm($form_id){
$result = [];
$res = M('lionfish_comshop_forms')->where( array('id' => $form_id) )->delete();
if($res !== false){
$result['code'] = 1;
}else{
$result['code'] = 0;
$result['message'] = '删除失败';
}
return $result;
}
public function queryList($gpc){
$page = isset($gpc['page']) ? intval($gpc['page']) : 1;
$page = max(1, $page);
$page_size = 10;
$keyword = $gpc['keyword'];
$type = $gpc['type'];
$is_ajax = $gpc['is_ajax'];
$template = $gpc['template'];
$is_ajax = !empty($is_ajax) ? intval($is_ajax) : 0;
$condition = " ";
if(!empty( $keyword )){
$keyword = trim($keyword);
$condition .= " and form_name like '%".$keyword."%'";
}
if(!empty($type)){
$condition .= " and form_type = '".$type."'";
}
$sql = 'SELECT * FROM ' . C('DB_PREFIX') . 'lionfish_comshop_forms WHERE 1 ' . $condition .
' order by id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
$list = M()->query($sql);
$total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_forms WHERE 1 ' . $condition );
$total = $total_arr[0]['count'];
$ret_html = "<tr>
<th style=\"color:#000;\">表单名称</th>
<th style=\"color:#000;\">表单类型</th>
<th style=\"color:#000;\">操作</th>
</tr>";
foreach ($list as &$value) {
$value['form_type_name'] = $this->getFormTypeName($value['form_type']);
$ret_html .= '<tr>';
$ret_html .= ' <td>'. $value['form_name'].'</td>';
$ret_html .= ' <td>'.$this->getFormTypeName($value['form_type']).'</td>';
if ( isset($template) && $template == 'mult' ) {
$ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_mult_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
}else{
$ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
}
$ret_html .= '</tr>';
}
$pager = pagination($total, $page, $page_size,'',$context = array('before' => 5, 'after' => 4, 'isajax' => 1));
if( $is_ajax == 1 )
{
return ['html' => $ret_html, 'pager' => $pager ];
}else{
return ['list' => $list, 'pager' => $pager ];
}
}
public function getDataList($gpc){
$page = isset($gpc['page']) ? intval($gpc['page']) : 1;
$page_size = 10;
//会员昵称
$keyword = $gpc['keyword'];
//表单id
$id = $gpc['id'];
$condition = " and f.form_id = ".$id;
$sqlcondition = "";
if (!empty( $keyword )) {
$keyword = trim($keyword);
$condition .= ' AND (locate('.$keyword.',m.username) > 0 ) and f.user_id > 0 ';
$sqlcondition .= ' left join ' . C('DB_PREFIX') . 'lionfish_comshop_member m on m.member_id = f.user_id ';
}
$sql = 'SELECT f.* FROM ' . C('DB_PREFIX') . 'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition .
' order by f.id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
$list = M()->query($sql);
$total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition );
$total = $total_arr[0]['count'];
if( !empty($list) )
{
foreach( $list as $k=>$item )
{
$member_info = M('lionfish_comshop_member')->where( array('member_id' => $item['user_id'] ) )->find();
if(!empty($member_info)){
$list[$k]['username'] = $member_info['username'];
}
$list[$k]['addtime'] = date('Y-m-d H:i:s',$item['addtime']);
$list[$k]['form_type_name'] = $this->getFormTypeName($item['form_type']);
}
}
$pager = pagination2($total, $page, $page_size);
//表单信息
$form_data = $this->getFormsById($id);
$need_data = ['list' => $list, 'pager' => $pager, 'form_info'=>$form_data ];
return $need_data;
}
/**
* @author cy 2021-05-26
* @desc 获取已收集的表单数据列表
* @param $form_id
* @return mixed
*/
public function getFormInfoListByFormId($form_id){
$form_info_list = M('lionfish_comshop_form_info')->where(array('form_id' => $form_id))->select();
return $form_info_list;
}
/**
* @author cy 2021-05-26
* @desc 获取已收集的表单数据项列表
* @param $form_id
* @return mixed
*/
public function getFormItemListByFormId($form_id){
$form_item_list = M('lionfish_comshop_form_item')->where(array('form_id' => $form_id))->order('id asc')->select();
return $form_item_list;
}
/**
* @author cy 2021-05-26
* @desc 获取导出表单数据列表
* @param $form_id
* @return array
*/
public function getExportFormDataList($form_id){
$need_data = [];
//万能表单数据
$form_data = $this->getFormsById($form_id);
$title_list = [];
$form_list = $this->getFormInfoListByFormId($form_id);
if(!empty($form_list)){
foreach($form_list as $k=>$v){
$form_list[$k]['addtime'] = date('Y-m-d H:i:s',$v['addtime']);
$form_item_list = $this->getFormItemListByFormId($v['id']);
if(!empty($form_item_list)){
foreach($form_item_list as $ik=>$iv){
if(!in_array($iv['item_name'],$title_list) && $iv['type'] != 'image'){
array_push($title_list,$iv['item_name']);
}
$form_list[$k][$iv['item_name']] = $iv['item_val'];
}
}
$member_info = M('lionfish_comshop_member')->where( array('member_id' => $v['user_id'] ) )->find();
if(!empty($member_info)){
$form_list[$k]['username'] = $member_info['username'];
}else{
$form_list[$k]['username'] = "";
}
}
}
$need_data['form_list'] = $form_list;
$need_data['title_list'] = $title_list;
$need_data['form_data'] = $form_data;
return $need_data;
}
/**
* @author cy 2021-05-24
* @desc 添加万能表单
* @return array
*/
public function addOrUpdateForm()
{
$_GPC = I('request.');
$id = $_GPC['id'];
//表单名称
$form_name = trim($_GPC['form_name']);
//表单类型
$form_type = trim($_GPC['form_type']);
if( empty($form_name))
{
return ['code' => 0, 'message' => '请填写表单名称'];
}
if( empty($form_type))
{
return ['code' => 0, 'message' => '请选择表单类型'];
}
$condition = " 1=1 ";
if(!empty($id)){
$condition .= " and id != ".$id;
}
没有合适的资源?快使用搜索试试~ 我知道了~
新狮子鱼社区团购商城系统小程序独立版v17.6.0源码,前后端+数据库

共9313个文件
png:1890个
js:1711个
php:1202个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
144 浏览量
2022-02-18
15:11:59
上传
评论
收藏 108.88MB ZIP 举报
新狮子鱼社区团购商城系统小程序独立版v17.6.0
资源推荐
资源详情
资源评论
















收起资源包目录





































































































共 9313 条
- 1
- 2
- 3
- 4
- 5
- 6
- 94
资源评论

智慧浩海
- 粉丝: 2982
- 资源: 4136

上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- 基于微分方程的求解、稀疏线性方程组的求解、多机系统分析Python仿真(完整源码+说明文档+数据).rar
- 基于插值、拟合、数值积分、线性方程组迭代求解、非线性方程求根、常微分方程数值解的matlab仿真(源码+文档+数据).rar
- MATLAB实现求解9x9数独(完整源码+说明文档).rar
- 项目失败常见的五个原因和解决方法.pdf
- 使用软件测试工具UFT来进行脚本录制与回放
- 软件设计模式文档资源详细描述
- 基于机械臂控制的matlab仿真(完整源码).rar
- 基于二维矩阵寻找波峰绘制三维图像的matlab仿真(完整源码+数据).rar
- 基于图像处理的Matlab仿真(完整源码+说明文档+数据).rar
- 轻松搭建Prometheus监控k8s服务之grafana模板2023年最新
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
