mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-12 11:09:23 +00:00
删除多余文件
This commit is contained in:
parent
1521e55eef
commit
7b6c458d8e
@ -4,7 +4,6 @@ namespace app\admin\controller\article;
|
||||
|
||||
use app\admin\controller\AuthController;
|
||||
use crmeb\services\UtilService as Util;
|
||||
use crmeb\services\PHPTreeService as Phptree;
|
||||
use crmeb\services\JsonService as Json;
|
||||
use crmeb\services\UploadService as Upload;
|
||||
use app\admin\model\article\ArticleCategory as ArticleCategoryModel;
|
||||
@ -29,21 +28,11 @@ class Article extends AuthController
|
||||
{
|
||||
$where = Util::getMore([
|
||||
['title', ''],
|
||||
['cid','']
|
||||
['cid', $this->request->param('pid', '')]
|
||||
], $this->request);
|
||||
$pid = $this->request->param('pid');
|
||||
$this->assign('where', $where);
|
||||
$where['merchant'] = 0;//区分是管理员添加的图文显示 0 还是 商户添加的图文显示 1
|
||||
$cateList = ArticleCategoryModel::getArticleCategoryList();
|
||||
$tree = [];
|
||||
//获取分类列表
|
||||
if(count($cateList)){
|
||||
$tree = Phptree::makeTreeForHtml($cateList);
|
||||
if($pid){
|
||||
$pids = Util::getChildrenPid($tree,$pid);
|
||||
$where['cid'] = ltrim($pid.$pids);
|
||||
}
|
||||
}
|
||||
$tree = sort_list_tier(ArticleCategoryModel::getArticleCategoryList());
|
||||
$this->assign(compact('tree'));
|
||||
$this->assign(ArticleModel::getAll($where));
|
||||
return $this->fetch();
|
||||
@ -56,7 +45,8 @@ class Article extends AuthController
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function create(){
|
||||
public function create()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$cid = $this->request->param('cid');
|
||||
$news = [];
|
||||
@ -98,7 +88,8 @@ class Article extends AuthController
|
||||
* 上传图文图片
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function upload_image(){
|
||||
public function upload_image()
|
||||
{
|
||||
$res = Upload::instance()->setUploadPath('wechat/image/' . date('Ymd'))->image($_POST['file']);
|
||||
if (!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 5, $res['image_type'], $res['time']);
|
||||
@ -108,7 +99,8 @@ class Article extends AuthController
|
||||
/**
|
||||
* 添加和修改图文
|
||||
*/
|
||||
public function add_new(){
|
||||
public function add_new()
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['id', 0],
|
||||
['cid', []],
|
||||
@ -177,7 +169,8 @@ class Article extends AuthController
|
||||
return Json::successful('删除成功!');
|
||||
}
|
||||
|
||||
public function merchantIndex(){
|
||||
public function merchantIndex()
|
||||
{
|
||||
$where = Util::getMore([
|
||||
['title', '']
|
||||
], $this->request);
|
||||
@ -213,6 +206,7 @@ class Article extends AuthController
|
||||
else
|
||||
return Json::fail('保存失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消绑定的产品id
|
||||
* @param int $id
|
||||
|
||||
@ -15,6 +15,7 @@ use app\models\routine\RoutineTemplate;
|
||||
use app\models\store\StoreOrderCartInfo;
|
||||
use app\models\user\User;
|
||||
use crmeb\services\YLYService;
|
||||
use think\facade\Log;
|
||||
use think\facade\Route;
|
||||
|
||||
/** 消息通知静态类
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CRMEB.
|
||||
* User: 136327134@qq.com
|
||||
* Date: 2019/4/12 11:19
|
||||
*/
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 错误码统一存放类
|
||||
* Class ApiErrorCode
|
||||
* @package crmeb\services
|
||||
*/
|
||||
class ApiErrorCode
|
||||
{
|
||||
|
||||
const SUCCESS = [200,'SUCCESS'];
|
||||
const ERROR = [400,'操作失败'];
|
||||
|
||||
const ERR_LOGIN = [40010,'登陆过期'];
|
||||
|
||||
|
||||
}
|
||||
@ -1,112 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CRMEB.
|
||||
* User: 136327134@qq.com
|
||||
* Date: 2019/4/12 11:19
|
||||
*/
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
/*
|
||||
* Api 日志和系统字段整合
|
||||
* class ApiLogs
|
||||
* */
|
||||
|
||||
use think\Exception;
|
||||
use think\Log;
|
||||
|
||||
class ApiLogs
|
||||
{
|
||||
// +----------------------------------------------------------------------
|
||||
// | 缓存前缀配置区域
|
||||
// +----------------------------------------------------------------------
|
||||
//ACCESS_TOKEN缓存前缀
|
||||
const ACCESS_TOKEN_PREFIX='AccessToken:';
|
||||
//api info 缓存前缀
|
||||
const AB_API_INFO='eb_ApiInfo:';
|
||||
//未支付订单取消
|
||||
const ORDER_UNPAID_PAGE='order_unpaid_page';
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 缓存时间配置区域
|
||||
// +----------------------------------------------------------------------
|
||||
//缓存时间
|
||||
const EXPIRE=86400;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 系统预设字段明配置区域
|
||||
// +----------------------------------------------------------------------
|
||||
//access-token验证字段
|
||||
const ACCESS_TOKEN="access-token";
|
||||
//Api版本字段
|
||||
const API_VERSION='version';
|
||||
//用户token验证字段
|
||||
const USER_TOKEN='user-token';
|
||||
//系统预设日志
|
||||
protected static $logInfo=null;
|
||||
/*
|
||||
* 获取本类所有常量配置
|
||||
* @param string $code 常量名
|
||||
* @return array | string
|
||||
* */
|
||||
public static function getConstants($code='') {
|
||||
$oClass = new \ReflectionClass(__CLASS__);
|
||||
$stants=$oClass->getConstants();
|
||||
if($code) return isset($stants[$code]) ? $stants[$code] : '';
|
||||
else return $stants;
|
||||
}
|
||||
|
||||
/*
|
||||
* 错误日志记录
|
||||
*
|
||||
* */
|
||||
public static function recodeErrorLog(Exception $exception)
|
||||
{
|
||||
$data=[
|
||||
'code'=>$exception->getCode(),
|
||||
'msg'=>$exception->getMessage(),
|
||||
'file'=>$exception->getFile(),
|
||||
'line'=>$exception->getLine(),
|
||||
];
|
||||
$log="[{$data['code']}] {$data['msg']} [{$data['file']} : {$data['line']}]";
|
||||
self::writeLog($log,'e');
|
||||
}
|
||||
/*
|
||||
* 记录日志
|
||||
* $param string $contentlog 日志内容
|
||||
* $param string $typeLog 日志类型
|
||||
* $param string $dirLog 日志目录
|
||||
* */
|
||||
public static function writeLog($contentlog='',$typeLog='',$dirLog='ebapi')
|
||||
{
|
||||
Log::init([
|
||||
'type' => 'File',
|
||||
'path' => LOG_PATH.($dirLog ? $dirLog.'/' : '')
|
||||
]);
|
||||
if($contentlog==='') $contentlog=self::$logInfo;
|
||||
if($contentlog===null) return false;
|
||||
if(is_array($contentlog)) $contentlog=var_export($contentlog,true);
|
||||
if(is_object($contentlog)) $contentlog=var_export($contentlog,true);
|
||||
switch (strtoupper($typeLog)){
|
||||
case 'SQL':case 'S':
|
||||
Log::sql($contentlog);
|
||||
break;
|
||||
case 'ERROR':case 'E':
|
||||
Log::error($contentlog);
|
||||
break;
|
||||
case 'INFO':case 'I':
|
||||
Log::info($contentlog);
|
||||
break;
|
||||
case 'NOTICE':case 'N':
|
||||
Log::notice($contentlog);
|
||||
break;
|
||||
case 'ALERT':case 'A':
|
||||
Log::alert($contentlog);
|
||||
break;
|
||||
case 'LOG':case 'L':
|
||||
Log::log($contentlog);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
use app\models\store\StoreBargain;
|
||||
use app\models\store\StoreCart;
|
||||
use app\models\store\StoreCombination;
|
||||
use app\models\store\StoreProduct;
|
||||
use app\models\store\StoreSeckill;
|
||||
use app\models\store\StoreService;
|
||||
use app\models\user\WechatUser;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 客服消息推送
|
||||
* Class CustomerService
|
||||
* @package crmeb\services
|
||||
*/
|
||||
class CustomerService
|
||||
{
|
||||
|
||||
/**
|
||||
* 订单支付成功后给客服发送客服消息
|
||||
* @param $order
|
||||
* @param int $type 1 公众号 0 小程序
|
||||
* @return string
|
||||
*/
|
||||
public static function sendOrderPaySuccessCustomerService($order, $type = 0)
|
||||
{
|
||||
$serviceOrderNotice = StoreService::getStoreServiceOrderNotice();
|
||||
if (count($serviceOrderNotice)) {
|
||||
foreach ($serviceOrderNotice as $key => &$item) {
|
||||
$userInfo = WechatUser::get($item);
|
||||
if ($userInfo) {
|
||||
$userInfo = $userInfo->toArray();
|
||||
if ($userInfo['subscribe'] && $userInfo['openid']) {
|
||||
$orderStatus = StoreService::orderServiceStatus($userInfo['uid']);
|
||||
if ($orderStatus) {
|
||||
// 统计管理开启 推送图文消息
|
||||
$head = '订单提醒 订单号:' . $order['order_id'];
|
||||
$url = SystemConfigService::get('site_url') . '/customer/orderdetail/' . $order['order_id'];
|
||||
$description = '';
|
||||
$image = SystemConfigService::get('site_logo');
|
||||
if (isset($order['seckill_id']) && $order['seckill_id'] > 0) {
|
||||
$description .= '秒杀产品:' . StoreSeckill::getProductField($order['seckill_id'], 'title');
|
||||
$image = StoreSeckill::getProductField($order['seckill_id'], 'image');
|
||||
} else if (isset($order['combination_id']) && $order['combination_id'] > 0) {
|
||||
$description .= '拼团产品:' . StoreCombination::getCombinationField($order['combination_id'], 'title');
|
||||
$image = StoreCombination::getCombinationField($order['combination_id'], 'image');
|
||||
} else if (isset($order['bargain_id']) && $order['bargain_id'] > 0) {
|
||||
$description .= '砍价产品:' . StoreBargain::getBargainField($order['bargain_id'], 'title');
|
||||
$image = StoreBargain::getBargainField($order['bargain_id'], 'image');
|
||||
} else {
|
||||
$productIds = StoreCart::getCartIdsProduct((array)$order['cart_id']);
|
||||
$storeProduct = StoreProduct::getProductStoreNameOrImage($productIds);
|
||||
if (count($storeProduct)) {
|
||||
foreach ($storeProduct as $value) {
|
||||
$description .= $value['store_name'] . ' ';
|
||||
$image = $value['image'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$message = WechatService::newsMessage($head, $description, $url, $image);
|
||||
try {
|
||||
WechatService::staffService()->message($message)->to($userInfo['openid'])->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($userInfo['nickname'] . '发送失败' . $e->getMessage());
|
||||
}
|
||||
} else {
|
||||
// 推送文字消息
|
||||
$head = "客服提醒:亲,您有一个新订单 \r\n订单单号:{$order['order_id']}\r\n支付金额:¥{$order['pay_price']}\r\n备注信息:{$order['mark']}\r\n订单来源:小程序";
|
||||
if ($type) $head = "客服提醒:亲,您有一个新订单 \r\n订单单号:{$order['order_id']}\r\n支付金额:¥{$order['pay_price']}\r\n备注信息:{$order['mark']}\r\n订单来源:公众号";
|
||||
try {
|
||||
WechatService::staffService()->message($head)->to($userInfo['openid'])->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($userInfo['nickname'] . '发送失败' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author: xaboy<365615158@qq.com>
|
||||
* @day: 2018/01/23
|
||||
*/
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
|
||||
class ExportService
|
||||
{
|
||||
public static function exportCsv($list,$filename,$header = [],$br = '_'){
|
||||
$tableStr = count($header) > 0 ? '"'.implode('","',$header).'"'.PHP_EOL : '';
|
||||
$tableStr .= self::tidyCsvStr($list,str_repeat($br,99));
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
header("Content-type:application/vnd.ms-excel");
|
||||
header("Content-Disposition:filename=".$filename.".csv");
|
||||
header('Content-Type:application/download');
|
||||
exit(iconv('UTF-8',"GB2312//IGNORE",$tableStr));
|
||||
}
|
||||
|
||||
private static function tidyCsvStr($list,$br = '')
|
||||
{
|
||||
$tableStr = '';
|
||||
foreach ($list as $row){
|
||||
if(is_array($row)){
|
||||
$max = 1;
|
||||
foreach ($row as $k=>$item){
|
||||
if(is_array($item)){
|
||||
if($max < ($l = count($item))) $max = $l;
|
||||
} else
|
||||
$row[$k] = [$item];
|
||||
}
|
||||
for($i = 0; $i<=$max; $i++){
|
||||
$exportRow = [];
|
||||
if($max == $i){
|
||||
if($br == '')
|
||||
continue;
|
||||
else
|
||||
$exportRow = array_fill(0,count($row),$br);
|
||||
}else{
|
||||
foreach ($row as $item){
|
||||
$exportRow[] = isset($item[$i]) && !empty($item[$i]) ? $item[$i] : ' ';
|
||||
}
|
||||
}
|
||||
$tableStr .= '"'.implode('","',$exportRow).'"," "'.PHP_EOL;
|
||||
}
|
||||
$tableStr = rtrim($tableStr,PHP_EOL);
|
||||
}else{
|
||||
$tableStr .= implode('',['"',$row,'"',',']);
|
||||
}
|
||||
$tableStr .= PHP_EOL;
|
||||
}
|
||||
return $tableStr;
|
||||
}
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author: xaboy<365615158@qq.com>
|
||||
* @day: 2017/11/24
|
||||
*/
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
class HookService
|
||||
{
|
||||
|
||||
/**
|
||||
* 监听有返回结果的行为
|
||||
* @param $tag
|
||||
* @param $params
|
||||
* @param null $extra
|
||||
* @param bool $once
|
||||
* @return mixed
|
||||
*/
|
||||
public static function resultListen($tag, $params, $extra = null, $once = false,$behavior = null)
|
||||
{
|
||||
self::beforeListen($tag,$params,$extra,false,$behavior);
|
||||
return self::listen($tag,$params,$extra,$once,$behavior);
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听后置行为
|
||||
* @param $tag
|
||||
* @param $params
|
||||
* @param null $extra
|
||||
*/
|
||||
public static function afterListen($tag, $params, $extra = null, $once = false, $behavior = null)
|
||||
{
|
||||
try{
|
||||
return self::listen($tag.'_after',$params,$extra,$once,$behavior);
|
||||
}catch (\Exception $e){}
|
||||
}
|
||||
|
||||
public static function beforeListen($tag,$params,$extra = null, $once = false, $behavior = null)
|
||||
{
|
||||
try{
|
||||
return self::listen($tag.'_before',$params,$extra,$once,$behavior);
|
||||
}catch (\Exception $e){}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听行为
|
||||
* @param $tag
|
||||
* @param $params
|
||||
* @param null $extra
|
||||
* @param bool $once
|
||||
* @return mixed
|
||||
*/
|
||||
public static function listen($tag, $params, $extra = null, $once = false, $behavior = null)
|
||||
{
|
||||
// if($behavior && method_exists($behavior,Loader::parseName($tag,1,false))) self::add($tag,$behavior);
|
||||
// return Hook::listen($tag,$params,$extra,$once);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置行为
|
||||
* @param $tag
|
||||
* @param $behavior
|
||||
* @param bool $first
|
||||
*/
|
||||
public static function addBefore($tag, $behavior, $first = false)
|
||||
{
|
||||
self::add($tag.'_before',$behavior,$first);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加后置行为
|
||||
* @param $tag
|
||||
* @param $behavior
|
||||
* @param bool $first
|
||||
*/
|
||||
public static function addAfter($tag, $behavior, $first = false)
|
||||
{
|
||||
self::add($tag.'_after',$behavior,$first);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加行为
|
||||
* @param $tag
|
||||
* @param $behavior
|
||||
* @param bool $first
|
||||
*/
|
||||
public static function add($tag, $behavior, $first = false)
|
||||
{
|
||||
Hook::add($tag,$behavior,$first);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,104 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
/**
|
||||
* @name PHPTree
|
||||
* @author crazymus < QQ:291445576 >
|
||||
* @des PHP生成树形结构,无限多级分类
|
||||
* @version 1.2.0
|
||||
* @Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
* @updated 2015-08-26
|
||||
*/
|
||||
class PHPTreeService
|
||||
{
|
||||
protected static $config = array(
|
||||
/* 主键 */
|
||||
'primary_key' => 'id',
|
||||
/* 父键 */
|
||||
'parent_key' => 'pid',
|
||||
/* 展开属性 */
|
||||
'expanded_key' => 'expanded',
|
||||
/* 叶子节点属性 */
|
||||
'leaf_key' => 'leaf',
|
||||
/* 孩子节点属性 */
|
||||
'children_key' => 'children',
|
||||
/* 是否展开子节点 */
|
||||
'expanded' => false
|
||||
);
|
||||
|
||||
/* 结果集 */
|
||||
protected static $result = array();
|
||||
|
||||
/* 层次暂存 */
|
||||
protected static $level = array();
|
||||
|
||||
/**
|
||||
* @name 生成树形结构
|
||||
* @param array 二维数组
|
||||
* @return mixed 多维数组
|
||||
*/
|
||||
public static function makeTree($data, $options = array())
|
||||
{
|
||||
$dataset = self::buildData($data, $options);
|
||||
$r = self::makeTreeCore(0, $dataset, 'normal');
|
||||
return $r;
|
||||
}
|
||||
|
||||
/* 生成线性结构, 便于HTML输出, 参数同上 */
|
||||
public static function makeTreeForHtml($data, $options = array())
|
||||
{
|
||||
|
||||
$dataset = self::buildData($data, $options);
|
||||
$r = self::makeTreeCore(0, $dataset, 'linear');
|
||||
return $r;
|
||||
}
|
||||
|
||||
/* 格式化数据, 私有方法 */
|
||||
private static function buildData($data, $options)
|
||||
{
|
||||
$config = array_merge(self::$config, $options);
|
||||
self::$config = $config;
|
||||
extract($config);
|
||||
|
||||
$r = array();
|
||||
foreach ($data as $item) {
|
||||
$id = $item[$primary_key];
|
||||
$parent_id = $item[$parent_key];
|
||||
$r[$parent_id][$id] = $item;
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/* 生成树核心, 私有方法 */
|
||||
private static function makeTreeCore($index, $data, $type = 'linear')
|
||||
{
|
||||
extract(self::$config);
|
||||
foreach ($data[$index] as $id => $item) {
|
||||
if ($type == 'normal') {
|
||||
if (isset($data[$id])) {
|
||||
$item[$expanded_key] = self::$config['expanded'];
|
||||
$item[$children_key] = self::makeTreeCore($id, $data, $type);
|
||||
} else {
|
||||
$item[$leaf_key] = true;
|
||||
}
|
||||
$r[] = $item;
|
||||
} else if ($type == 'linear') {
|
||||
$parent_id = $item[$parent_key];
|
||||
self::$level[$id] = $index == 0 ? 0 : self::$level[$parent_id] + 1;
|
||||
$item['level'] = self::$level[$id];
|
||||
self::$result[] = $item;
|
||||
if (isset($data[$id])) {
|
||||
self::makeTreeCore($id, $data, $type);
|
||||
}
|
||||
|
||||
$r = self::$result;
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CRMEB.
|
||||
* Copyright (c) 2017~2019 http://www.crmeb.com All rights reserved.
|
||||
* Author: liaofei <136327134@qq.com>
|
||||
* Date: 2019/4/3 16:36
|
||||
*/
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
use crmeb\traits\LogicTrait;
|
||||
|
||||
/** 模版消息类
|
||||
* Class Template
|
||||
* @package crmeb\services
|
||||
*/
|
||||
class Template
|
||||
{
|
||||
use LogicTrait;
|
||||
|
||||
protected $providers=[
|
||||
'routine_two'=>ProgramTemplateService::class,
|
||||
];
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user