实例介绍
【实例简介】
本插件是进云源生插件,需要进云框架支撑!
安装步骤:
1、解压本插件;
2、把本插件包例如:jy_weishop,上传到进云框架addons目录下;
3、移步:系统--插件管理--本地插件--点击安装
【核心代码】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | <?php /* 插件概览 */ global $_RQ , $_AR ; $_RQ [ 'op' ]= $_RQ [ 'op' ]? $_RQ [ 'op' ]: 'edit' ; $return = array (); if ( $_RQ [ 'op' ]== 'edit' ){ $item = $this ->plugin_setting( 'citypeisong' ); $return [ 'item' ]= $item ; $return [ 'status' ]= array ( '1' => '开启' , '0' => '关闭' ); $return [ 'is_sum' ]= array ( '1' => '叠加' , '0' => '不叠加' ); $return [ 'is_dispatch' ]= array ( '1' => '使用快递方式' , '0' => '不使用快递方式' ); $return [ 'express_type' ]= array ( '0' => '商家配送' , '1' => '达达配送' ); $return [ 'item' ][ 'peisong_timebox' ]= $return [ 'item' ][ 'peisong_timebox' ]?: array (); $htmls = array ( 'type' => 'edit' , 'post' => 'post' , 'desc' => '同城配送' , 'edit_tab' =>true, 'edits' => array ( array ( 'list' => array ( array ( 'type' => 'tip' , 'title' => '[<red>温馨提示</red>]:这里是同城配送设置,如果开启了同城配送,系统优先使用同城配送方式,如果未开启同城配送或者超出同城配送范围则使用普通快递方式计算运费!<red>平台的满额包邮,单商品的满件包邮等将不生效,只有快递配送才有效</red>!' , 'name' => 'title' ), array ( 'type' => 'switch' , 'title' => '是否开启' , 'name' => 'isopen' ), array ( 'type' => 'radio' , 'title' => '购买多件商品时运费' , 'name' => 'is_sum' , 'options' => 'is_sum' , 'help' => '如果开启了同城配送,并且在同城配送范围内,选择叠加时购买多件商品的同城运费等于每件商品运费的和, 选择不叠加,则使用其中商品运费(包含统一运费)的最大值' ), array ( 'type' => 'radio' , 'title' => '超出同城配送范围后' , 'name' => 'is_dispatch' , 'options' => 'is_dispatch' , 'help' => '如果开启了同城配送,选择使用快递方式,则超出范围后自动使用快递方式;选择不使用快递方式,则超出同城配送范围后不配送' ), array ( 'type' => 'radio' , 'title' => '物流公司' , 'name' => 'express_type' , 'options' => 'express_type' , 'help' => '' ), array ( 'type' => 'title' , 'title' => '达达配送接口信息' , 'show' => array ( 'express_type' =>1)), array ( 'type' => 'string' , 'title' => '达达appkey' , 'name' => 'dd_app_key' , 'show' => array ( 'express_type' =>1), 'help' => '达达开发者的appkey' ), array ( 'type' => 'string' , 'title' => '达达appsecret' , 'name' => 'dd_app_secret' , 'show' => array ( 'express_type' =>1), 'help' => '达达开发者的appsecret' ), array ( 'type' => 'string' , 'title' => '商户编号(source_id)' , 'name' => 'dd_source_id' , 'show' => array ( 'express_type' =>1), 'help' => '达达商户账户的source_id' ), array ( 'type' => 'string' , 'title' => '账户ID' , 'name' => 'dd_shop_id' , 'show' => array ( 'express_type' =>1), 'help' => '达达商户账户的ID' ), array ( 'type' => 'pcd' , 'title' => '所在城市' , 'name' => 'pcd' , 'help' => '' ), array ( 'type' => 'tip' , 'title' => '[<red>温馨提示</red>]:当商户不是自己配送,而是由平台配送的时候,才生效!' ), array ( 'type' => 'string_two' , 'title' => '配送电话' , 'title1' => '联系电话1' , 'unit1' => '' , 'name1' => 'tel1' , 'title2' => '联系电话2' , 'unit2' => '' , 'name2' => 'tel2' , 'help' => '' ), array ( 'type' => 'string_two' , 'title' => '计费方式' , 'title1' => '起步价' , 'unit1' => '元' , 'name1' => 'start_fee' , 'title2' => '包含' , 'unit2' => '公里' , 'name2' => 'start_km' , 'help' => '' ), array ( 'type' => 'string_two' , 'title' => '超出起步范围' , 'title1' => '起步价' , 'unit1' => '公里内' , 'name1' => 'pre_km' , 'title2' => '每增加1公里' , 'unit2' => '元' , 'name2' => 'pre_km_fee' , 'help' => '' ), array ( 'type' => 'string_two' , 'title' => '超出固定费用' , 'title1' => '超出' , 'unit1' => '公里' , 'name1' => 'fixed_km' , 'title2' => '固定价格' , 'unit2' => '元' , 'name2' => 'fixed_fee' , 'help' => '' ), array ( 'type' => 'unitstring' , 'unit' => '天后' , 'title' => '自动收货' , 'name' => 'receive_goods' , 'help' => '如果设置0或空,则读取系统设置' ), array ( 'type' => 'string' , 'title' => '高德Web服务接口key' , 'name' => 'geo_key' , 'help' => '注册高德地图帐号并访问<a href="http://lbs.amap.com/dev/key/app" target="_blank">http://lbs.amap.com/dev/key/app</a>申请Web服务接口key' ), array ( 'type' => 'lat_lng' , 'title' => '区域经纬度设置' , 'name' => 'lat_lng' , 'help' => '' ), array ( 'type' => 'switch' , 'title' => '是否开启加急?' , 'name' => 'on_feejia' , 'help' => '开启加急配送后,立即配送的功能将消失,只有预约时间段配送 加急配送!' ), array ( 'type' => 'unitstring' , 'unit' => '元' , 'title' => '加急费用' , 'name' => 'out_feejia' , 'help' => '加急订单,立即配送,不受固定配送时间段限制!' ), array ( 'type' => 'unitstring' , 'unit' => '元' , 'title' => '多少钱起送' , 'name' => 'out_price' , 'help' => '留空则不限制!' ), array ( 'type' => 'unitstring' , 'unit' => '元' , 'title' => '满多少免配送费' , 'name' => 'man_fee' , 'help' => '为0则不生效!' ), array ( 'type' => 'radio' , 'title' => '时间段模式' , 'name' => 'set_timebox' , 'options' => 'set_timeboxs' , 'help' => '默认是常规的外卖时间段,无需单独设置,是按每半小时一个时间段;固定时间段:是自己指定配送时间段(比如上午的,只能中午12点前送达,符合吃饭作息)' ), array ( 'type' => 'time_box' , 'show' => array ( 'set_timebox' =>1), 'name' => 'peisong_timebox' , 'title' => '固定配送时间段' , 'add_tip' => '添加一个固定时间段' , 'title1' => '时间段' , 'title2' => '下单往前推移' , 'field1' => 'times' , 'field2' => 'yuyue' , 'field2unit' => '分钟' , 'help' => '时间段配送模式理解:例如:时间段8:00~9:00.如果下单往前推移30分钟;8点30前下的单就算作是这个时间段配送的;如果是8点30以后下的单就算作下一时间段的,以此类推!' ), ) ), ) ); $return [ 'unit' ]= array ( '克' , '千克' ); $return [ 'set_timeboxs' ]= array ( '常规配送时间段' , '固定配送时间段' ); $return [ 'groups' ]=pdo_getall( 'jy_weishop_diyform_temp' , array ( 'uniacid' => $_SESSION [ 'uniacid' ]), array ( 'id' , 'title' ), 'id' ); $return [ 'htmls' ]= $htmls ; exi( $return ); } if ( $_RQ [ 'op' ]== 'post' ){ $postdata =get_postdata(); if (! $postdata [ 'pcd' ]){ exi( '选择所在城市' , 'error' ); } if ( $postdata [ 'express_type' ]==1 && (! $postdata [ 'dd_app_key' ] || ! $postdata [ 'dd_app_secret' ] || ! $postdata [ 'dd_source_id' ] || ! $postdata [ 'dd_shop_id' ])){ exi( '达达相关参数都必须填写!' , 'error' ); } if ( $postdata [ 'pre_km' ] && (! is_numeric ( $postdata [ 'pre_km' ])|| strpos ( $postdata [ 'pre_km' ], "." )!==false)){ exi( '起步公里必须是整数' , 'error' ); } if ( $postdata [ 'fixed_km' ] && (! is_numeric ( $postdata [ 'fixed_km' ])|| strpos ( $postdata [ 'fixed_km' ], "." )!==false)){ exi( '公里必须是整数' , 'error' ); } if (! $postdata [ 'lat_lng' ]){ exi( '选择区域经纬度设置' , 'error' ); } $item = $this ->plugin_setting( 'citypeisong' , $postdata ); exi( '设置成功' ); } |
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论