diff --git a/addon/futures/config/diy_view.php b/addon/futures/config/diy_view.php new file mode 100644 index 00000000..66690c07 --- /dev/null +++ b/addon/futures/config/diy_view.php @@ -0,0 +1,47 @@ + '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ] + 'template' => [], + + // 后台自定义组件——装修 + 'util' => [], + + // 自定义页面路径 + 'link' => [ + [ + 'name' => 'DIY_FUTURES', + 'title' => '期货', + 'parent' => 'INTERACTION_PROMOTION', + 'wap_url' => '', + 'web_url' => '', + 'sort' => 4 + ] + ], + + // 自定义图标库 + 'icon_library' => [], + + // uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件 + 'component' => [], + + // uni-app 页面,多个逗号隔开 + 'pages' => [], + + // 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述' + 'info' => [], + + // 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】 + 'theme' => [], + + // 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ] + 'data' => [] +]; \ No newline at end of file diff --git a/addon/futures/config/event.php b/addon/futures/config/event.php new file mode 100644 index 00000000..30b4b8d5 --- /dev/null +++ b/addon/futures/config/event.php @@ -0,0 +1,23 @@ + [ + + ], + + 'listen' => [ + //展示活动 + 'ShowPromotion' => [ + 'addon\form\event\ShowPromotion', + ], + 'OrderPayment' => [ + //'addon\form\event\OrderPayment', + ], + 'OrderCreate' => [ + 'addon\form\event\OrderCreate', + ] + ], + + 'subscribe' => [ + ], +]; diff --git a/addon/futures/config/info.php b/addon/futures/config/info.php new file mode 100644 index 00000000..6f7b2a36 --- /dev/null +++ b/addon/futures/config/info.php @@ -0,0 +1,21 @@ + 'futures', + 'title' => '期货', + 'description' => '期货', + 'type' => 'promotion', //插件类型 system :系统插件(自动安装), business:业务插件 promotion:营销插件 tool:工具插件 + 'status' => 1, + 'author' => '', + 'version' => '5.1.1', + 'version_no' => '520221115001', + 'content' => '', +]; \ No newline at end of file diff --git a/addon/futures/config/menu_shop.php b/addon/futures/config/menu_shop.php new file mode 100644 index 00000000..593d1db6 --- /dev/null +++ b/addon/futures/config/menu_shop.php @@ -0,0 +1,80 @@ + 'SYSTEM_FORM', + 'title' => '系统表单', + 'url' => 'form://shop/form/lists', + 'parent' => 'PROMOTION_TOOL', + 'is_show' => 1, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_select' => '', + 'sort' => 1, + 'child_list' => [ + [ + 'name' => 'FORM_ADD', + 'title' => '添加表单', + 'url' => 'form://shop/form/addform', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + [ + 'name' => 'FORM_EDIT', + 'title' => '编辑表单', + 'url' => 'form://shop/form/editform', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + [ + 'name' => 'FORM_DELETE', + 'title' => '删除表单', + 'url' => 'form://shop/form/deleteform', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + [ + 'name' => 'FORM_IS_USE', + 'title' => '表单是否启用', + 'url' => 'form://shop/form/editisuse', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + [ + 'name' => 'FORM_DATA', + 'title' => '表单数据', + 'url' => 'form://shop/form/formdata', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + [ + 'name' => 'FORM_DATA_EXPORT', + 'title' => '表单数据详情', + 'url' => 'form://shop/form/exportform', + 'is_show' => 0, + 'is_control' => 1, + 'is_icon' => 0, + 'picture' => '', + 'picture_selected' => '', + ], + ] + ], +]; diff --git a/addon/futures/event/Install.php b/addon/futures/event/Install.php new file mode 100644 index 00000000..ec4f9ac5 --- /dev/null +++ b/addon/futures/event/Install.php @@ -0,0 +1,27 @@ +addFormData([ + 'site_id' => $create_data['site_id'], + 'form_id' => $create_data['form_data']['form_id'], + 'member_id' => $create_data['member_id'], + 'relation_id' => $data['order_id'], + 'form_data' => $create_data['form_data']['form_data'], + 'scene' => 'order' + ]); + if ($res['code'] != 0) return $res; + } + + // 添加商品表单 + if (isset($create_data['form_data']['goods_form'])) { + $goods_list = array_column($create_data['shop_goods_list']['goods_list'], null, 'sku_id'); + foreach ($create_data['form_data']['goods_form'] as $sku_id => $form_item) { + $res = $form->addFormData([ + 'site_id' => $create_data['site_id'], + 'form_id' => $form_item['form_id'], + 'member_id' => $create_data['member_id'], + 'relation_id' => isset($goods_list[ $sku_id ]) && isset($goods_list[ $sku_id ]['order_goods_id']) ? $goods_list[ $sku_id ]['order_goods_id'] : 0, + 'form_data' => $form_item['form_data'], + 'scene' => 'goods' + ]); + if ($res['code'] != 0) return $res; + } + } + } + return success(); + } +} \ No newline at end of file diff --git a/addon/futures/event/OrderPayment.php b/addon/futures/event/OrderPayment.php new file mode 100644 index 00000000..7eda3e06 --- /dev/null +++ b/addon/futures/event/OrderPayment.php @@ -0,0 +1,51 @@ +getFormInfo([ ['site_id', '=', $data['site_id'] ], ['is_use', '=', 1], ['form_type', '=', 'order'] ], 'id,json_data,form_name'); + if (!empty($info['data'])) { + $info['data']['json_data'] = json_decode($info['data']['json_data'], true); + $data['system_form'] = $info['data']; + } + $goods_model = new Goods(); + foreach ($data['shop_goods_list']['goods_list'] as $goods_key => $goods_item) { + $condition = [ + ['g.site_id', '=', $data['site_id'] ], + ['g.goods_id', '=', $goods_item['goods_id'] ], + ['g.form_id', '>', 0 ], + ['f.is_use', '=', 1 ] + ]; + $goods_form = $goods_model->getGoodsInfo($condition, 'f.id,f.json_data', 'g', [ ['form f', 'g.form_id = f.id', 'left'] ])['data']; + if (!empty($goods_form)) { + $goods_form['json_data'] = json_decode($goods_form['json_data'], true); + $data['shop_goods_list']['goods_list'][$goods_key]['goods_form'] = $goods_form; + } + } + return $data; + } +} \ No newline at end of file diff --git a/addon/futures/event/ShowPromotion.php b/addon/futures/event/ShowPromotion.php new file mode 100644 index 00000000..1fd1c67b --- /dev/null +++ b/addon/futures/event/ShowPromotion.php @@ -0,0 +1,46 @@ + [ + [ + //插件名称 + 'name' => 'futures', + //店铺端展示分类 shop:营销活动 member:互动营销 + 'show_type' => 'shop', + //展示主题 + 'title' => '期货', + //展示介绍 + 'description' => '期货', + //展示图标 + 'icon' => 'addon/futures/icon.png', + //跳转链接 + 'url' => 'form://shop/futures/lists', + ] + ] + + ]; + return $data; + } +} \ No newline at end of file diff --git a/addon/futures/event/UnInstall.php b/addon/futures/event/UnInstall.php new file mode 100644 index 00000000..a1d6b51f --- /dev/null +++ b/addon/futures/event/UnInstall.php @@ -0,0 +1,27 @@ +