Node.js 8.x以上
npm install
# 本地预览
npm run dev
# 构建生产环境
npm run build
# 推送到部署分支 dist
npm run deploy
# 建构生产环境并推送到部署分支
npm run buildAndDeploy
ZTBCMS文档
License: Apache License 2.0
前端检测权限显示按钮 例子:
Libs\System\RBAC.php
新增
/**
* 检测登陆用户对某个接口的访问权限
* @param $moduelName
* @param $controllerName
* @param $actionName
* @return bool
*/
static function ableAccess($moduelName, $controllerName, $actionName){
$accessList = session("_ACCESS_LIST");
if(!empty($accessList[$moduelName]) && !empty($accessList[$moduelName][$controllerName]) && !empty($accessList[$moduelName][$controllerName][$actionName])){
return true;
}
return false;
}
<if condition="\Libs\System\RBAC::ableAccess('Content', 'Content', 'edit')">
<a href="javascript:;;" onClick="javascript:openwinx('{:U("Content/edit", ["catid" =>$vo['catid'] , "id" => $vo["id"]])}')">修改</a>
|
</if>
<if condition="\Libs\System\RBAC::ableAccess('Content', 'Content', 'delete')">
<a href="{:U('Content/delete',array('catid'=>$vo['catid'],'id'=>$vo['id']))}" class="J_ajax_del" >删除</a>
</if>
模块的目录结构等等
均可以在php中的非用户http请求流程中执行一些耗时的任务
Queue 支持『秒级』别的调度执行
Cron 支持『分钟』级别的调度执行
Queue 自带调度器,由自身实现
Cron 需要依赖其他软件来调度,如crontab
Queue 可以预先设定开启多个队列,实现并行操作
Cron 无法预先设置并发数,并发由时间调度(crontab)进行控制
如何明确hook的参数
Behavior 遵循TP的自动加载方式,所以直接创建对应的Behavior 并填写模拟参数调用run()方法即可
样例:
行为PaidChongzhiOrderBehavior.class.php
/**
* 支付充值订单后
*
* @package Payment\Behavior
*/
class PaidChongzhiOrderBehavior extends BaseBehavior {
//充值余额 快照栏目
const CAT_CHONGZHIYUE = 96;
public function run(PaidOrderBehaviorParam &$param) {
parent::run($param);
$order = DgorderService::getOrder($param->orderid)['data'];
//充值余额订单+已支付
if($order['dg_catid'] == DgorderModel::CAT_CHONGZHI_YUE && $order['pay_status'] == DgorderModel::PAY_STATUS_PAYID ){
$chongzhiInfo = ContentService::getContent(self::CAT_CHONGZHIYUE, $order['dg_id'])['data'];
//添加余额明细
$currency = $order['country'] == '**' ? BalanceService::CURRENCY_RMB : BalanceService::CURRENCY_USD;
BalanceService::addBalanceMingxi($order['userid'], $chongzhiInfo['money'], $currency, 'ORDER'.$order['trade_no'], BalanceService::TYPE_ADD, '余额充值 ' . $chongzhiInfo['money'] . $currency);
//标志订单已完成
DgorderService::updateOrder($order['orderid'], ['order_status' => DgorderModel::ORDER_STATUS_FINISH]);
}
}
}
参数类PaidOrderBehaviorParam.class.php
class PaidOrderBehaviorParam extends BaseBehaviorParam {
/**
* @var 订单号
*/
public $orderid;
}
调用样例:
<?php
namespace Payment\Controller;
use Common\Controller\Base;
use Payment\Behavior\PaidChongzhiOrderBehavior;
use Payment\BehaviorParam\PaidOrderBehaviorParam;
class TestController extends Base {
function testPaidChongzhiOrderBehavior(){
$b = new PaidChongzhiOrderBehavior();
$bp = PaidOrderBehaviorParam::create(['orderid' => '2016111011144970299']);
$b->run($bp);
}
}
form.inc.php
:
switch ($setting['boxtype']) {
case 'radio':
$string = \Form::radio($option, $value, "name='info[$field]' {$fieldinfo['formattribute']}", $setting['width'], $field);
break;
case 'checkbox':
$string = \Form::checkbox($option, $value, "name='info[$field][]' {$fieldinfo['formattribute']}", 1, $setting['width'], $field);
break;
case 'select':
$string = \Form::select($option, $value, "name='info[$field]' id='$field' {$fieldinfo['formattribute']}");
break;
case 'multiple':
$string = \Form::select($option, $value, "name='info[$field][]' id='$field ' size=2 multiple='multiple' style='height:60px;' {$fieldinfo['formattribute']}");
break;
}
开发时,模块内的资源文件不需要每次改动完后重新修改install/目录下的资源文件,可以直接给一个软连接即可
ln -s /Users/jayin/Desktop/project/fenxiangbei/ztbcms/app/Application/Shop/Install/Extres /Users/jayin/Desktop/project/fenxiangbei/ztbcms/statics/extres/shop
ln -s /ztbcms/app/Application/Shop/Install/Extres /ztbcms/statics/extres/shop
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.