修复文件换号符号bug CR改成LF

This commit is contained in:
sugar1569 2019-04-02 17:57:27 +08:00
parent b28b18797a
commit f3495a422e
13 changed files with 3576 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,35 @@
<?php namespace app\admin\controller\wechat; use app\admin\controller\AuthController; use app\admin\model\wechat\WechatMessage as MessageModel; use service\UtilService as Util; /** * 用户扫码点击事件 * Class SystemMessage * @package app\admin\controller\system */ class WechatMessage extends AuthController { /** * 显示操作记录 */ public function index(){ $where = Util::getMore([ ['nickname',''], ['type',''], ['data',''], ],$this->request); $this->assign('where',$where); $this->assign('mold',MessageModel::$mold); $this->assign(MessageModel::systemPage($where)); return $this->fetch(); } } <?php
namespace app\admin\controller\wechat;
use app\admin\controller\AuthController;
use app\admin\model\wechat\WechatMessage as MessageModel;
use service\UtilService as Util;
/**
* 用户扫码点击事件
* Class SystemMessage
* @package app\admin\controller\system
*/
class WechatMessage extends AuthController
{
/**
* 显示操作记录
*/
public function index(){
$where = Util::getMore([
['nickname',''],
['type',''],
['data',''],
],$this->request);
$this->assign('where',$where);
$this->assign('mold',MessageModel::$mold);
$this->assign(MessageModel::systemPage($where));
return $this->fetch();
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,106 @@
<?php /** * * @author: xaboy<365615158@qq.com> * @day: 2017/11/02 */ namespace app\admin\model\system; use traits\ModelTrait; use basic\ModelBasic; use think\Db; /** * 配置分类model * * Class SystemConfigTab * @package app\admin\model\system */ class SystemConfigTab extends ModelBasic { use ModelTrait; /** * 获取单选按钮或者多选按钮的显示值 * */ public static function getRadioOrCheckboxValueInfo($menu_name,$value){ $parameter = array(); $option = array(); $config_one = SystemConfig::getOneConfig('menu_name',$menu_name); $parameter = explode("\n",$config_one['parameter']); foreach ($parameter as $k=>$v){ if(isset($v) && strlen($v)>0){ $data = explode('=>',$v); $option[$data[0]] = $data[1]; } } $str = ''; if(is_array($value)){ foreach ($value as $v){ $str .= $option[$v].','; } }else{ $str .= !empty($value)?$option[$value]:$option[0]; } return $str; } /** * 插入数据到数据库 * */ public static function set($data) { return self::create($data); } /** * 获取全部 * */ public static function getAll($type = 0){ $where['status'] = 1; if($type>-1)$where['type'] = $type; return Db::name('SystemConfigTab')->where($where)->select(); } /** * 获取配置分类 * */ public static function getSystemConfigTabPage($where = array()) { $model = new self; if($where['title'] != '') $model = $model->where('title','LIKE',"%$where[title]%"); if($where['status'] != '') $model = $model->where('status',$where['status']); return self::page($model,$where); } public static function edit($data,$id,$field='id') { return self::update($data,[$field=>$id]); } /** * 更新数据 * @access public * @param array $data 数据数组 * @param array $where 更新条件 * @param array|true $field 允许字段 * @return $this */ public static function update($data = [], $where = [], $field = null) { $model = new static(); if (!empty($field)) { $model->allowField($field); } $result = $model->isUpdate(true)->save($data, $where); return $model; } } <?php
/**
*
* @author: xaboy<365615158@qq.com>
* @day: 2017/11/02
*/
namespace app\admin\model\system;
use traits\ModelTrait;
use basic\ModelBasic;
use think\Db;
/**
* 配置分类model
*
* Class SystemConfigTab
* @package app\admin\model\system
*/
class SystemConfigTab extends ModelBasic {
use ModelTrait;
/**
* 获取单选按钮或者多选按钮的显示值
* */
public static function getRadioOrCheckboxValueInfo($menu_name,$value){
$parameter = array();
$option = array();
$config_one = SystemConfig::getOneConfig('menu_name',$menu_name);
$parameter = explode("\n",$config_one['parameter']);
foreach ($parameter as $k=>$v){
if(isset($v) && strlen($v)>0){
$data = explode('=>',$v);
$option[$data[0]] = $data[1];
}
}
$str = '';
if(is_array($value)){
foreach ($value as $v){
$str .= $option[$v].',';
}
}else{
$str .= !empty($value)?$option[$value]:$option[0];
}
return $str;
}
/**
* 插入数据到数据库
* */
public static function set($data)
{
return self::create($data);
}
/**
* 获取全部
* */
public static function getAll($type = 0){
$where['status'] = 1;
if($type>-1)$where['type'] = $type;
return Db::name('SystemConfigTab')->where($where)->select();
}
/**
* 获取配置分类
* */
public static function getSystemConfigTabPage($where = array())
{
$model = new self;
if($where['title'] != '') $model = $model->where('title','LIKE',"%$where[title]%");
if($where['status'] != '') $model = $model->where('status',$where['status']);
return self::page($model,$where);
}
public static function edit($data,$id,$field='id')
{
return self::update($data,[$field=>$id]);
}
/**
* 更新数据
* @access public
* @param array $data 数据数组
* @param array $where 更新条件
* @param array|true $field 允许字段
* @return $this
*/
public static function update($data = [], $where = [], $field = null)
{
$model = new static();
if (!empty($field)) {
$model->allowField($field);
}
$result = $model->isUpdate(true)->save($data, $where);
return $model;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1,138 @@
<?php /** * * @author: xaboy<365615158@qq.com> * @day: 2017/11/02 */ namespace app\admin\model\wechat; use app\admin\model\system\Merchant; use app\admin\model\system\SystemAdmin; use app\merchant\model\merchant\MerchantAdmin; use traits\ModelTrait; use basic\ModelBasic; use think\Db; /** * 图文管理 Model * Class WechatNews * @package app\admin\model\wechat */ class WechatNews extends ModelBasic { use ModelTrait; /** * 获取配置分类 * @param array $where * @return array */ public static function getAll($where = array()){ $model = new self; // if($where['status'] !== '') $model = $model->where('status',$where['status']); // if($where['access'] !== '') $model = $model->where('access',$where['access']); if($where['title'] !== '') $model = $model->where('title','LIKE',"%$where[title]%"); if($where['cid'] !== '') $model = $model->where("CONCAT(',',cid,',') LIKE '%,$where[cid],%'"); if($where['cid'] == ''){ if(!$where['merchant']) $model = $model->where('mer_id',0); if($where['merchant']) $model = $model->where('mer_id','GT',0); } $model = $model->where('status',1)->where('hide',0); return self::page($model,function($item){ if(!$item['mer_id']) $item['admin_name'] = '总后台管理员---》'.SystemAdmin::where('id',$item['admin_id'])->value('real_name'); else $item['admin_name'] = Merchant::where('id',$item['mer_id'])->value('mer_name').'---》'.MerchantAdmin::where('id',$item['admin_id'])->value('real_name'); $item['content'] = Db::name('wechatNewsContent')->where('nid',$item['id'])->value('content'); },$where); } /** * 删除图文 * @param $id * @return bool */ public static function del($id){ return self::edit(['status'=>0],$id,'id'); } /** * 获取指定字段的值 * @return array */ public static function getNews() { return self::where('status',1)->where('hide',0)->order('id desc')->column('id,title'); } /** * 给表中的字符串类型追加值 * 删除所有有当前分类的id之后重新添加 * @param $cid * @param $id * @return bool */ public static function saveBatchCid($cid,$id){ $res_all = self::where('cid','LIKE',"%$cid%")->select();//获取所有有当前分类的图文 foreach ($res_all as $k=>$v){ $cid_arr = explode(',',$v['cid']); if(in_array($cid,$cid_arr)){ $key = array_search($cid, $cid_arr); array_splice($cid_arr, $key, 1); } if(empty($cid_arr)) { $data['cid'] = 0; self::edit($data,$v['id']); }else{ $data['cid'] = implode(',',$cid_arr); self::edit($data,$v['id']); } } $res = self::where('id','IN',$id)->select(); foreach ($res as $k=>$v){ if(!in_array($cid,explode(',',$v['cid']))){ if(!$v['cid']){ $data['cid'] = $cid; }else{ $data['cid'] = $v['cid'].','.$cid; } self::edit($data,$v['id']); } } return true; } public static function setContent($id,$content){ $count = Db::name('wechatNewsContent')->where('nid',$id)->count(); $data['nid'] = $id; $data['content'] = $content; // dump($data); if($count){ $res = Db::name('wechatNewsContent')->where('nid',$id)->setField('content',$content); if($res !== false) $res = true; } else $res = Db::name('wechatNewsContent')->insert($data); // echo Db::getLastSql(); // exit(); return $res; } public static function merchantPage($where = array()){ $model = new self; if($where['title'] !== '') $model = $model->where('title','LIKE',"%$where[title]%"); if($where['cid'] !== '') $model = $model->where('cid','LIKE',"%$where[cid]%"); $model = $model ->where('status',1) ->where('hide',0) ->where('admin_id',$where['admin_id']) ->where('mer_id',$where['mer_id']); return self::page($model,function($item){ $item['content'] = Db::name('wechatNewsContent')->where('nid',$item['id'])->value('content'); },$where); } } <?php
/**
*
* @author: xaboy<365615158@qq.com>
* @day: 2017/11/02
*/
namespace app\admin\model\wechat;
use app\admin\model\setting\Merchant;
use app\admin\model\setting\SystemAdmin;
use app\merchant\model\merchant\MerchantAdmin;
use traits\ModelTrait;
use basic\ModelBasic;
use think\Db;
/**
* 图文管理 Model
* Class WechatNews
* @package app\admin\model\wechat
*/
class WechatNews extends ModelBasic {
use ModelTrait;
/**
* 获取配置分类
* @param array $where
* @return array
*/
public static function getAll($where = array()){
$model = new self;
// if($where['status'] !== '') $model = $model->where('status',$where['status']);
// if($where['access'] !== '') $model = $model->where('access',$where['access']);
if($where['title'] !== '') $model = $model->where('title','LIKE',"%$where[title]%");
if($where['cid'] !== '') $model = $model->where("CONCAT(',',cid,',') LIKE '%,$where[cid],%'");
if($where['cid'] == ''){
if(!$where['merchant']) $model = $model->where('mer_id',0);
if($where['merchant']) $model = $model->where('mer_id','GT',0);
}
$model = $model->where('status',1)->where('hide',0);
return self::page($model,function($item){
if(!$item['mer_id']) $item['admin_name'] = '总后台管理员---》'.SystemAdmin::where('id',$item['admin_id'])->value('real_name');
else $item['admin_name'] = Merchant::where('id',$item['mer_id'])->value('mer_name').'---》'.MerchantAdmin::where('id',$item['admin_id'])->value('real_name');
$item['content'] = Db::name('wechatNewsContent')->where('nid',$item['id'])->value('content');
},$where);
}
/**
* 删除图文
* @param $id
* @return bool
*/
public static function del($id){
return self::edit(['status'=>0],$id,'id');
}
/**
* 获取指定字段的值
* @return array
*/
public static function getNews()
{
return self::where('status',1)->where('hide',0)->order('id desc')->column('id,title');
}
/**
* 给表中的字符串类型追加值
* 删除所有有当前分类的id之后重新添加
* @param $cid
* @param $id
* @return bool
*/
public static function saveBatchCid($cid,$id){
$res_all = self::where('cid','LIKE',"%$cid%")->select();//获取所有有当前分类的图文
foreach ($res_all as $k=>$v){
$cid_arr = explode(',',$v['cid']);
if(in_array($cid,$cid_arr)){
$key = array_search($cid, $cid_arr);
array_splice($cid_arr, $key, 1);
}
if(empty($cid_arr)) {
$data['cid'] = 0;
self::edit($data,$v['id']);
}else{
$data['cid'] = implode(',',$cid_arr);
self::edit($data,$v['id']);
}
}
$res = self::where('id','IN',$id)->select();
foreach ($res as $k=>$v){
if(!in_array($cid,explode(',',$v['cid']))){
if(!$v['cid']){
$data['cid'] = $cid;
}else{
$data['cid'] = $v['cid'].','.$cid;
}
self::edit($data,$v['id']);
}
}
return true;
}
public static function setContent($id,$content){
$count = Db::name('wechatNewsContent')->where('nid',$id)->count();
$data['nid'] = $id;
$data['content'] = $content;
// dump($data);
if($count){
$res = Db::name('wechatNewsContent')->where('nid',$id)->setField('content',$content);
if($res !== false) $res = true;
}
else
$res = Db::name('wechatNewsContent')->insert($data);
// echo Db::getLastSql();
// exit();
return $res;
}
public static function merchantPage($where = array()){
$model = new self;
if($where['title'] !== '') $model = $model->where('title','LIKE',"%$where[title]%");
if($where['cid'] !== '') $model = $model->where('cid','LIKE',"%$where[cid]%");
$model = $model
->where('status',1)
->where('hide',0)
->where('admin_id',$where['admin_id'])
->where('mer_id',$where['mer_id']);
return self::page($model,function($item){
$item['content'] = Db::name('wechatNewsContent')->where('nid',$item['id'])->value('content');
},$where);
}
}

View File

@ -1 +1,61 @@
<?php /** * * @author: xaboy<365615158@qq.com> * @day: 2017/11/02 */ namespace app\admin\model\wechat; use traits\ModelTrait; use basic\ModelBasic; use app\admin\model\article\Article as ArticleModel; /** * 图文消息 model * Class WechatNewsCategory * @package app\admin\model\wechat */ class WechatNewsCategory extends ModelBasic { use ModelTrait; /** * 获取配置分类 * @param array $where * @return array */ public static function getAll($where = array()){ $model = new self; // if($where['status'] !== '') $model = $model->where('status',$where['status']); // if($where['access'] !== '') $model = $model->where('access',$where['access']); if($where['cate_name'] !== '') $model = $model->where('cate_name','LIKE',"%$where[cate_name]%"); $model = $model->where('status',1); return self::page($model,function ($item){ $new = ArticleModel::where('id','in',$item['new_id'])->where('hide',0)->select(); $item['new'] = $new; }); } /** * 获取一条图文 * @param int $id * @return array|false|\PDOStatement|string|\think\Model */ public static function getWechatNewsItem($id = 0){ if(!$id) return []; $list = self::where('id',$id)->where('status',1)->field('cate_name as title,new_id')->find(); if($list){ $list = $list->toArray(); $new = ArticleModel::where('id','in',$list['new_id'])->where('hide',0)->select(); if($new) $new = $new->toArray(); $list['new'] = $new; } return $list; } } <?php
/**
*
* @author: xaboy<365615158@qq.com>
* @day: 2017/11/02
*/
namespace app\admin\model\wechat;
use traits\ModelTrait;
use basic\ModelBasic;
use app\admin\model\article\Article as ArticleModel;
/**
* 图文消息 model
* Class WechatNewsCategory
* @package app\admin\model\wechat
*/
class WechatNewsCategory extends ModelBasic {
use ModelTrait;
/**
* 获取配置分类
* @param array $where
* @return array
*/
public static function getAll($where = array()){
$model = new self;
// if($where['status'] !== '') $model = $model->where('status',$where['status']);
// if($where['access'] !== '') $model = $model->where('access',$where['access']);
if($where['cate_name'] !== '') $model = $model->where('cate_name','LIKE',"%$where[cate_name]%");
$model = $model->where('status',1);
return self::page($model,function ($item){
$new = ArticleModel::where('id','in',$item['new_id'])->where('hide',0)->select();
$item['new'] = $new;
});
}
/**
* 获取一条图文
* @param int $id
* @return array|false|\PDOStatement|string|\think\Model
*/
public static function getWechatNewsItem($id = 0){
if(!$id) return [];
$list = self::where('id',$id)->where('status',1)->field('cate_name as title,new_id')->find();
if($list){
$list = $list->toArray();
$new = ArticleModel::where('id','in',$list['new_id'])->where('hide',0)->select();
if($new) $new = $new->toArray();
$list['new'] = $new;
}
return $list;
}
}