1 Star 0 Fork 193

程序源代码/video

forked from 后盾人/v2015 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
WeChat.php 2.05 KB
一键复制 编辑 原始数据 按行查看 历史
后盾人 提交于 2017-06-25 21:18 +08:00 . no message
<?php
/** .-------------------------------------------------------------------
* | Software: [HDPHP framework]
* | Site: www.hdphp.com www.hdcms.com
* |-------------------------------------------------------------------
* | Author: 向军 <2300071698@qq.com>
* | WeChat: aihoudun
* | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
* '-------------------------------------------------------------------*/
namespace module;
use Request;
use system\model\Keyword;
/**
* Trait WeChat
*
* @package module
*/
trait WeChat
{
/**
* 保存关键词数据
*
* @param array $data
*
* @return bool
*/
final protected function saveKeyword(array $data)
{
if (empty($data['wechat_keyword'])) {
return false;
}
//关键词所在的模块
$moduleName = isset($data['module']) ? $data['module'] : Request::get('m');
$where = [
['module_id', $data['module_id']],
['module', $moduleName],
];
$model = Keyword::where($where)->first() ?: new Keyword();
$model['module'] = trim($moduleName);
$model['content'] = $data['wechat_keyword'];
$model['module_id'] = $data['module_id'];
$model->save();
}
/**
* 编辑时分配关键词
*
* @param $module_id 模块记录的主键编号
*/
final protected function assignKeyword($module_id)
{
$where = [
['module_id', $module_id],
['module', Request::get('m')],
];
$content = Keyword::where($where)->pluck('content');
View::with('wechat_keyword', $content);
}
/**
* 删除关键词
*
* @param $module_id
*/
final protected function removeKeyword($module_id)
{
$where = [
['module_id', $module_id],
['module', Request::get('m')],
];
$model = Keyword::where($where)->first();
if ($model) {
$model->destory();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/itcode-itcode/video.git
git@gitee.com:itcode-itcode/video.git
itcode-itcode
video
video
master

搜索帮助