Created
February 12, 2014 02:59
-
-
Save dioxide/8949256 to your computer and use it in GitHub Desktop.
小强 ECstore二次开发规范
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ECStore 二次开发规范说明 | |
| 注意:此文档有利用于团队协作开发,如有异议或补充,可共同讨论并更新此文档 | |
| 1.在config/config.php是定义二开目录,在文件最下加入一行定义:define('CUSTOM_CORE_DIR',ROOT_DIR.'/custom'); | |
| 2.当发现app目录下有需要二开的文件时,将其二开后,保持相同路径存入二开目录中,例: | |
| 二开前路径:app/b2c/controller/site/brand.php | |
| 二开后路径:custom/b2c/controller/site/brand.php | |
| 3.二开的代码所需注意的事项(重要) | |
| 1).二开增删改数据库的动作中,遇1张表以上的更新时,注意启用数据库事务回滚机制。演示代码,例: | |
| public function do_payment($payment, &$msg) | |
| { | |
| $db = kernel::database(); //实例化数据库对象 | |
| $transaction_status = $db->beginTransaction(); //开始事务 | |
| $is_payed = $order_pay_service_object->order_pay_finish($payment, 'succ', 'font',$msg); //此方法中可能涉及多表数据更新 | |
| if (!$is_payed) //判断返回结果 | |
| { | |
| $db->rollback(); //若失败时,则回退到多表数据更新前 | |
| return false; | |
| } | |
| $db->commit($transaction_status); //若成功时,则提交并结束事务 | |
| } | |
| 2).二开过的代码,上下均需加入开发者各自的标识(即注解)。下面的演示代码中加入了“preterchan”标识,例: | |
| a. js、php 代码: | |
| public function index() | |
| { | |
| if($_GET['action'] == 'export') $this->_end_message = '导出售后服务申请'; | |
| /** preterchan **/ | |
| $actions_base = array( | |
| 'title'=>app::get('aftersales')->_('售后服务管理'), | |
| 'actions'=>array( | |
| ),'use_buildin_set_tag'=>true,'use_buildin_recycle'=>true,'use_buildin_filter'=>true,'use_buildin_export'=>true, | |
| ); | |
| if ($_SESSION['type'] == 'seller') { | |
| $actions_base['base_filter'] = array('seller_id' => $_SESSION['account']['seller']); | |
| if ($_SESSION['account_pid']) { | |
| $actions_base['base_filter'] = array('seller_id' => $_SESSION['account_pid']); | |
| } | |
| } | |
| $render->pagedata['return_type'] = $gask_type; | |
| $this->finder('aftersales_mdl_return_product',$actions_base); | |
| /** preterchan **/ | |
| } | |
| b. xml、html 代码: | |
| <!-- preterchan --> | |
| <adminpanel group="desktop_setting" permission="shopsetting" controller='admin_seller_attr' action='index' display='true' order="41">商户注册项</adminpanel> | |
| <adminpanel group="desktop_setting" permission="shopsetting" controller='admin_seller_unit_attr' action='index' display='true' order="42">商户分部注册项</adminpanel> | |
| <!-- preterchan --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment