【类 型】:

【原  因】:
【过  程】:
【影  响】:
This commit is contained in:
air 2025-06-25 12:35:58 +08:00
parent 884e824710
commit 5fe976590a
6 changed files with 108 additions and 93 deletions

View File

@ -108,7 +108,7 @@ class CheckController extends PublicController
exit(); //有问题跳出 exit(); //有问题跳出
} }
//后台校验 运费 打包费 和 前端提交值 ps:目前和商铺表 里的运费 打包费进行比较 后续可能要根据比如运输距离 商户根据订单单独修改的值 进行对比 //后台校验 运费 打包费 和 前端提交值 ps:目前和单位表 里的运费 打包费进行比较 后续可能要根据比如运输距离 商户根据订单单独修改的值 进行对比
$shopDb = D('shop'); $shopDb = D('shop');
$whereShop['shop_id'] = $_REQUEST['shop_id']; $whereShop['shop_id'] = $_REQUEST['shop_id'];
$shop = $shopDb->where($whereShop)->find(); $shop = $shopDb->where($whereShop)->find();

View File

@ -90,7 +90,7 @@ class NormalController extends PublicController
} }
} }
/** /**
* @description: 获取商铺信息 * @description: 获取单位信息
*/ */
public function getShopCon() public function getShopCon()
{ {
@ -99,7 +99,7 @@ class NormalController extends PublicController
if ($shopCon = $shopDb->where($where)->find()) { if ($shopCon = $shopDb->where($where)->find()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "shopCon" => $shopCon)); echo json_encode(array('status' => 1, 'msg' => '访问成功', "shopCon" => $shopCon));
} else { } else {
echo json_encode(array('status' => 0, 'msg' => '暂无商铺信息')); echo json_encode(array('status' => 0, 'msg' => '暂无单位信息'));
} }
} }
} }

View File

@ -65,7 +65,7 @@ class PayController extends PublicController
$fieldShop = array('price_min', 'weight_max'); $fieldShop = array('price_min', 'weight_max');
$shopDb = D('shop'); $shopDb = D('shop');
if (!$shop = $shopDb->where($whereShop)->field($fieldShop)->find()) { if (!$shop = $shopDb->where($whereShop)->field($fieldShop)->find()) {
echo json_encode(array('status' => 0, 'msg' => '商铺不存在')); echo json_encode(array('status' => 0, 'msg' => '单位不存在'));
exit(); exit();
} }
if ($order['openid'] != $this->openid || (float)$order['total_price'] < (float)$shop['price_min'] || $order['total_weight'] > $shop['weight_max']) { if ($order['openid'] != $this->openid || (float)$order['total_price'] < (float)$shop['price_min'] || $order['total_weight'] > $shop['weight_max']) {

View File

@ -9,7 +9,7 @@ class AdminController extends PublicController
echo "hello wolrd"; echo "hello wolrd";
} }
/** /**
* @description: 获取商铺列表 * @description: 获取单位列表
*/ */
public function getShopList() public function getShopList()
{ {
@ -21,11 +21,11 @@ class AdminController extends PublicController
if ($shopList = $shopDb->where($where)->select()) { if ($shopList = $shopDb->where($where)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "shopList" => $shopList)); echo json_encode(array('status' => 1, 'msg' => '访问成功', "shopList" => $shopList));
} else { } else {
echo json_encode(array('status' => 0, 'msg' => '暂无商铺数据')); echo json_encode(array('status' => 0, 'msg' => '暂无单位数据'));
} }
} }
/** /**
* @description: 商铺添加 * @description: 单位添加
*/ */
public function addShop() public function addShop()
{ {
@ -78,7 +78,7 @@ class AdminController extends PublicController
} }
} }
/** /**
* @description: 商铺更新 * @description: 单位更新
*/ */
public function saveShop() public function saveShop()
{ {
@ -455,7 +455,7 @@ class AdminController extends PublicController
*/ */
public function deleteMessage() public function deleteMessage()
{ {
// 权限判断(总管理员可操作所有商铺 // 权限判断(总管理员可操作所有单位
if ($this->tokenShop_id != C('powerId')) { if ($this->tokenShop_id != C('powerId')) {
$where['shop_id'] = $this->tokenShop_id; $where['shop_id'] = $this->tokenShop_id;
} }

View File

@ -9,13 +9,16 @@
// | Author: liu21st <liu21st@gmail.com> // | Author: liu21st <liu21st@gmail.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace Behavior; namespace Behavior;
/** /**
* 系统行为扩展:模板内容输出替换 * 系统行为扩展:模板内容输出替换
*/ */
class ContentReplaceBehavior { class ContentReplaceBehavior
{
// 行为扩展的执行入口必须是run // 行为扩展的执行入口必须是run
public function run(&$content){ public function run(&$content)
{
$content = $this->templateContentReplace($content); $content = $this->templateContentReplace($content);
} }
@ -25,7 +28,8 @@ class ContentReplaceBehavior {
* @param string $content 模板内容 * @param string $content 模板内容
* @return string * @return string
*/ */
protected function templateContentReplace($content) { protected function templateContentReplace($content)
{
// 系统默认的特殊变量替换 // 系统默认的特殊变量替换
$replace = array( $replace = array(
'__ROOT__' => __ROOT__, // 当前网站地址 '__ROOT__' => __ROOT__, // 当前网站地址
@ -43,5 +47,4 @@ class ContentReplaceBehavior {
$content = str_replace(array_keys($replace), array_values($replace), $content); $content = str_replace(array_keys($replace), array_values($replace), $content);
return $content; return $content;
} }
} }

View File

@ -9,10 +9,12 @@
// | Author: liu21st <liu21st@gmail.com> // | Author: liu21st <liu21st@gmail.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace Think; namespace Think;
/** /**
* ThinkPHP 视图类 * ThinkPHP 视图类
*/ */
class View { class View
{
/** /**
* 模板输出变量 * 模板输出变量
* @var tVar * @var tVar
@ -33,7 +35,8 @@ class View {
* @param mixed $name * @param mixed $name
* @param mixed $value * @param mixed $value
*/ */
public function assign($name,$value=''){ public function assign($name, $value = '')
{
if (is_array($name)) { if (is_array($name)) {
$this->tVar = array_merge($this->tVar, $name); $this->tVar = array_merge($this->tVar, $name);
} else { } else {
@ -47,7 +50,8 @@ class View {
* @param string $name * @param string $name
* @return mixed * @return mixed
*/ */
public function get($name=''){ public function get($name = '')
{
if ('' === $name) { if ('' === $name) {
return $this->tVar; return $this->tVar;
} }
@ -64,7 +68,8 @@ class View {
* @param string $prefix 模板缓存前缀 * @param string $prefix 模板缓存前缀
* @return mixed * @return mixed
*/ */
public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') { public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
G('viewStartTime'); G('viewStartTime');
// 解析并获取模板内容 // 解析并获取模板内容
$content = $this->fetch($templateFile, $content, $prefix); $content = $this->fetch($templateFile, $content, $prefix);
@ -80,7 +85,8 @@ class View {
* @param string $contentType 输出类型 * @param string $contentType 输出类型
* @return mixed * @return mixed
*/ */
private function render($content,$charset='',$contentType=''){ private function render($content, $charset = '', $contentType = '')
{
if (empty($charset)) $charset = C('DEFAULT_CHARSET'); if (empty($charset)) $charset = C('DEFAULT_CHARSET');
if (empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE'); if (empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE');
// 网页字符编码 // 网页字符编码
@ -99,7 +105,8 @@ class View {
* @param string $prefix 模板缓存前缀 * @param string $prefix 模板缓存前缀
* @return string * @return string
*/ */
public function fetch($templateFile='',$content='',$prefix='') { public function fetch($templateFile = '', $content = '', $prefix = '')
{
if (empty($content)) { if (empty($content)) {
$templateFile = $this->parseTemplate($templateFile); $templateFile = $this->parseTemplate($templateFile);
// 模板文件不存在直接返回 // 模板文件不存在直接返回
@ -158,7 +165,8 @@ class View {
* @param string $tmplTemplateFile 模板文件名 * @param string $tmplTemplateFile 模板文件名
* @return boolean * @return boolean
*/ */
protected function checkCache($tmplTemplateFile,$prefix='') { protected function checkCache($tmplTemplateFile, $prefix = '')
{
if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测 if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测
return false; return false;
$tmplCacheFile = C('CACHE_PATH') . $prefix . md5($tmplTemplateFile) . C('TMPL_CACHFILE_SUFFIX'); $tmplCacheFile = C('CACHE_PATH') . $prefix . md5($tmplTemplateFile) . C('TMPL_CACHFILE_SUFFIX');
@ -189,7 +197,8 @@ class View {
* @param string $tmplContent 模板内容 * @param string $tmplContent 模板内容
* @return boolean * @return boolean
*/ */
protected function checkContentCache($tmplContent,$prefix='') { protected function checkContentCache($tmplContent, $prefix = '')
{
if (Storage::has(C('CACHE_PATH') . $prefix . md5($tmplContent) . C('TMPL_CACHFILE_SUFFIX'))) { if (Storage::has(C('CACHE_PATH') . $prefix . md5($tmplContent) . C('TMPL_CACHFILE_SUFFIX'))) {
return true; return true;
} else { } else {
@ -203,7 +212,8 @@ class View {
* @param string $template 模板文件规则 * @param string $template 模板文件规则
* @return string * @return string
*/ */
public function parseTemplate($template='') { public function parseTemplate($template = '')
{
if (is_file($template)) { if (is_file($template)) {
return $template; return $template;
} }
@ -239,7 +249,8 @@ class View {
* @param string $module 模块名 * @param string $module 模块名
* @return string * @return string
*/ */
protected function getThemePath($module=MODULE_NAME){ protected function getThemePath($module = MODULE_NAME)
{
// 获取当前主题名称 // 获取当前主题名称
$theme = $this->getTemplateTheme(); $theme = $this->getTemplateTheme();
// 获取当前主题的模版路径 // 获取当前主题的模版路径
@ -257,7 +268,8 @@ class View {
* @param mixed $theme 主题名称 * @param mixed $theme 主题名称
* @return View * @return View
*/ */
public function theme($theme){ public function theme($theme)
{
$this->theme = $theme; $this->theme = $theme;
return $this; return $this;
} }
@ -267,7 +279,8 @@ class View {
* @access private * @access private
* @return string * @return string
*/ */
private function getTemplateTheme() { private function getTemplateTheme()
{
if ($this->theme) { // 指定模板主题 if ($this->theme) { // 指定模板主题
$theme = $this->theme; $theme = $this->theme;
} else { } else {
@ -289,5 +302,4 @@ class View {
defined('THEME_NAME') || define('THEME_NAME', $theme); // 当前模板主题名称 defined('THEME_NAME') || define('THEME_NAME', $theme); // 当前模板主题名称
return $theme ? $theme . '/' : ''; return $theme ? $theme . '/' : '';
} }
} }