方维直播增加三级分销推广功能
1、推荐链接,输入验证码确定
SELECT * FROM `fanwe_mobile_verify_code` LIMIT 0 , 30
查表确定验证码
2、下载链接不正确问题,
修改数据库 fanwe_m_config"系统手机端配置信息表" android_filename
3、个人页面域名不对。
TODO
4、推广链接 :
wap/index.php?ctl=distribution&act=init_register&user_id=3766
5、增加user表的祖父 曾祖父id
1 ALTER TABLE `fanwe_user` ADD `pp_user_id` INT( 11 ) UNSIGNED NULL COMMENT '祖父id'; 2 ALTER TABLE `fanwe_user` ADD `ppp_user_id` INT( 11 ) UNSIGNED NULL COMMENT '曾祖父id';
6、增加注册后一二级代理id罗库
mapi/lib/distribution.action.php //MOCK $res = $GLOBALS['db']->getRow("select id,p_user_id from " . DB_PREFIX . "user where id =" . $p_user_id); $p_user_id = $res['id']; $pp_user_id = $res['p_user_id']; $ppp_user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id =" . $pp_user_id); //MOCK $data = array( 'head_image' => $system_head_image, 'thumb_head_image' => get_spec_image($system_head_image,40,40), 'p_user_id' =>$p_user_id, 'pp_user_id' => $pp_user_id, 'ppp_user_id' => $ppp_user_id, );
7、插入后台三级代理配置页面
INSERT INTO `test2_com`.`fanwe_m_config` (`id` ,`code` ,`title` ,`group_id` ,`val` ,`type` ,`sort` ,`value_scope` ,`title_scope` ,`desc`) VALUES (NULL , 'distribute_level_3', '三级代理比例', '推广配置', '10', '0', '1', NULL , NULL , '三级代理比例'); INSERT INTO `test2_com`.`fanwe_m_config` (`id` ,`code` ,`title` ,`group_id` ,`val` ,`type` ,`sort` ,`value_scope` ,`title_scope` ,`desc`) VALUES (NULL , 'distribute_level_2', '二级代理比例', '推广配置', '10', '0', '1', NULL , NULL , '二级代理比例'); INSERT INTO `test2_com`.`fanwe_m_config` (`id` ,`code` ,`title` ,`group_id` ,`val` ,`type` ,`sort` ,`value_scope` ,`title_scope` ,`desc`) VALUES (NULL , 'distribute_level_1', '一级代理比例', '推广配置', '10', '0', '1', NULL , NULL , '一级代理比例');
8、用户支付成功增加三级分销充值记录
mapi/lib/vip_pay.action.php 充值会员分销
system/libs/cart.php 最终支付成功回调位置
//MOCK 判断是否是购买了会员,如果是会员的话进行分销
get_vip_charge_distrabute($payment_notice);
if ($payment_notice['order_id']>0) {
1 /* 2 * 充值会员推广分成 3 * in 4 * $payment_notice 5 * step 1根据订单中的充值名称和vip_rule表对比,有记录则为vip充值 6 * step 2 获取充值的金额,插入payment_notice表,订单信息协商推广返点_xxx_xxx 7 * step 3 更新用户余额信息 8 */ 9 function get_vip_charge_distrabute(array $arrInput){ 10 11 $p_user_id = 0; 12 $pp_user_id = 0; 13 $ppp_user_id = 0; 14 15 $is_vip_charge = $GLOBALS['db']->getOne("select id from ".DB_PREFIX."vip_rule where name=". $arrInput['recharge_name']); 16 if(!$is_vip_charge){ 17 return; 18 } 19 20 $res = $GLOBALS['db']->getRow("select p_user_id,pp_user_id,ppp_user_id from " . DB_PREFIX . "user where id =" . $arrInput['user_id']); 21 if($res){ 22 $p_user_id = $res['p_user_id']; 23 $pp_user_id = $res['pp_user_id']; 24 $ppp_user_id = $res['ppp_user_id']; 25 } 26 27 $res = $GLOBALS['db']->getAll("select code,val from " . DB_PREFIX . "m_config where code like 'distribute_level_%' " ); 28 29 if(!$res){ 30 log_err_file("推广分成比例没有设置,请设置推广分成比例!"); 31 return; 32 } 33 34 foreach ($res as $k => $v){ 35 $res[$v['code']] = $v['val']; 36 } 37 38 $diamonds_rate = $GLOBALS['db']->getOne("select val from " . DB_PREFIX . "m_config where code = 'diamonds_rate' " ); 39 $p_user_money = $res['distribute_level_1'] * $arrInput['money']* $diamonds_rate; 40 $pp_user_money = $res['distribute_level_2'] * $arrInput['money'] * $diamonds_rate; 41 $ppp_user_money = $res['distribute_level_3'] * $arrInput['money'] * $diamonds_rate; 42 43 $payment_notice_insert = array( 44 'notice_sn' => $arrInput['notice_sn'], 45 'create_time' => $arrInput['create_time'], 46 'pay_time' => $arrInput['pay_time'], 47 'order_id' => $arrInput['order_id'], 48 'is_paid' => $arrInput['is_paid'], 49 'payment_id' => $arrInput['payment_id'], 50 'bank_id' => $arrInput['bank_id'], 51 'memo' => $arrInput['memo'], 52 'outer_notice_sn' => $arrInput['outer_notice_sn'], 53 'deal_id' => $arrInput['deal_id'], 54 'deal_name' => $arrInput['deal_name'], 55 'is_has_send_success' => $arrInput['is_has_send_success'], 56 'paid_send' => $arrInput['paid_send'], 57 'pay_date' => $arrInput['pay_date'], 58 'recharge_id' => $arrInput['recharge_id'], 59 'product_id' => $arrInput['product_id'], 60 'iap_receipt' => $arrInput['iap_receipt'], 61 'diamonds' => 0, 62 'type' => $arrInput['type'], 63 ); 64 65 if(!$p_user_id){ 66 $payment_notice_insert['user_id'] = $p_user_id; 67 $payment_notice_insert['money'] = $res['distribute_level_1'] * $arrInput['money']; 68 $payment_notice_insert['recharge_name'] = '一级推广返点_'.$arrInput['user_id']; 69 70 $GLOBALS['db']->autoExecute(DB_PREFIX."payment_notice",$payment_notice_insert,'INSERT'); 71 $sql = "update ".DB_PREFIX."user set ticket = ticket + ".$p_user_money." where id = ".$p_user_id; 72 $GLOBALS['db']->query($sql); 73 } 74 if(!$pp_user_id){ 75 $payment_notice_insert['user_id'] = $p_user_id; 76 $payment_notice_insert['money'] = $res['distribute_level_2'] * $arrInput['money']; 77 $payment_notice_insert['recharge_name'] = '二级推广返点_'.$arrInput['user_id']; 78 79 $GLOBALS['db']->autoExecute(DB_PREFIX."payment_notice",$payment_notice_insert,'INSERT'); 80 $sql = "update ".DB_PREFIX."user set ticket = ticket + ".$pp_user_money." where id = ".$pp_user_id; 81 $GLOBALS['db']->query($sql); 82 } 83 if(!$ppp_user_id){ 84 $payment_notice_insert['user_id'] = $p_user_id; 85 $payment_notice_insert['money'] = $res['distribute_level_3'] * $arrInput['money']; 86 $payment_notice_insert['recharge_name'] = '三级推广返点_'.$arrInput['user_id']; 87 88 $GLOBALS['db']->autoExecute(DB_PREFIX."payment_notice",$payment_notice_insert,'INSERT'); 89 $sql = "update ".DB_PREFIX."user set ticket = ticket + ".$ppp_user_money." where id = ".$ppp_user_id; 90 $GLOBALS['db']->query($sql); 91 } 92 93 94 }
9、开启会员
修改 /system/define.php ,添加以下代码
//VIP会员模块
define('OPEN_VIP',1);//VIP会员 0 关闭 1 开启
本文来自博客园,作者:张扬86,转载请注明原文链接:https://www.cnblogs.com/ynhi/p/10849454.html