Taolefan is a PHP-based WeChat public account rebate program that supports certified or uncertified subscription accounts and service accounts.
Note: Due to force majeure, this project has stopped updating. The current version can be used normally. If you need commercial support, please call QQ764744445 for consultation.
You are currently viewing the 2.X version branch. If you want to use it with an uncertified public account, please switch to the 1.X branch to view. 1.X is developed in parallel with 2.X, and only differentiates between authenticated and unauthenticated calls to different interfaces.
This project uses Laravel as the main architecture for development, public account interaction is implemented using EasyWechat, and the management backend is developed based on X-admin. This project uses the GPLv3 agreement, which allows copying, dissemination, modification and commercial use. It is prohibited to release and sell modified and derived codes as closed source commercial software.
This project mainly uses platform interfaces such as Taobao Alliance, Taoke, and WeChat public open platforms for development.
1. /config/config.php #This configuration file saves basic information of the site/platform, Taobao Alliance and Dataoke APPKEY and other information
2. /config/wechat.php #This configuration file saves information related to WeChat public platform APPKEY
2. .env #This configuration file saves database related information
1. Official account transfer (JD/Taobao), the user sends the Taobao password of the original or other Taobao customers to the official account, the background transfer link calculates the rebate amount, obtains the coupon information and returns it to the user.
2. Registration function, follow to complete the registration and bind WeChat openID (WeChat unique identification). Users can quickly complete the withdrawal account information through the official account menu, and can also bind their Taobao account to obtain special_id (the unique identification of Taobao member operations)
3. Automatically obtain orders and bind orders, and automatically store all orders in data. Orders with member operation id will be automatically bound to openid (backup plan) , Automatically track orders based on the user's product status. When different users purchase the same product, the automatic ordering of the product will be suspended to avoid ordering errors.
4. Manually send the order number to bind the order
5. Users can query their order information and withdraw cash
6. Backend management panel
7. When users query order information, the user's order status for the past month is automatically refreshed, and the order status for the previous two months is automatically refreshed every month, and orders confirmed for receipt in the previous month are settled.
8. Automatic message notifications such as following orders, withdrawing cash, inviting friends, etc.
More functions are still being gradually developed, and you can also develop related functions by yourself. Your Star is the driving force for my continued development.
Notice:
*Update indicates slight changes in the database. Before updating, please back up the data and use the latest sql file to rebuild the structure before importing the data for use.
Users who update from version 1.x to 2.x, please be sure to update the database results, go through the document again, and re-operate the unprocessed content to avoid exceptions. If you find a bug, please file an issue and indicate each version of the 2.x version. After the update, please execute the following command in the root directory of the web page to clear the cache to prevent some services from being inaccessible due to cache.
php artisan cache:clear
php artisan route:cache
2022.5.5 v2.1.12
Fixed the issue where the legacy code of the monthly update order caused the normal update to fail
2022.4.19 v2.1.11
Fixed the bug that the payment amount/cashback amount may be displayed as a negative number
2022.4.18 v2.1.10
Return the link transfer result in the form of a link to avoid being detected by WeChat. Fix the bug of automatically sending two messages after successfully following an order.
2022.4.17 v2.1.9
Fixed some bugs that did not affect use
Invitation QR code supports generating posters. After designing the poster yourself, reserve the QR code position and configure config.php.
*2022.4.14 v2.1.8
Based on the 1.1.8 version update, some advanced interfaces have been called to support rebate activities for inviting friends. You can set relevant information in the config and some pages can be converted to menus for direct access. Openid can be obtained through web authorization.
Automatic order following, withdrawal feedback, etc. are all replaced by template information sending. Note: Please re-send the "Create Menu" command after updating this version. After the database data recovery is completed, please execute the following SQL statement to initialize the data of the invitation function (please be sure operate)
UPDATE users SET invite_id = NULL WHERE invite_id = ' 0 '
Environmental requirements: PHP >= 7.4 (supports PHP8) | MySQL/MariaDB | Redis WeChat public account: certified service account (subscription account, uncertified please use the 1.x branch)
Download or clone the project code to the required environment
#国外环境
git clone -b master https: //github.com/evendevil66/taolefan.git
#国内环境
git clone -b master https: //gitee.com/cdj8/taolefan.git
Execute the Composer command in the project directory to install dependent packages and automatically load them. If used in the PHP8 environment, please modify the PHP version in composer.json to the corresponding version.
composer install
composer dump-auto
Copy .env.example file to .env
cp .env.example .env
Modify the database configuration and Redis configuration in .env and import taolefan.sql in the project root directory to the database
DB_CONNECTION=mysql #默认使用mysql请勿修改 可支持MariaDB
DB_HOST=127.0.0.1 #数据库连接地址
DB_PORT=3306 #数据库连接端口
DB_DATABASE=taolefan #数据库名
DB_USERNAME=root #数据库用户名
DB_PASSWORD= #数据库密码
REDIS_HOST=127.0.0.1 #Redis连接地址
REDIS_PASSWORD=null #Redis密码 未设置默认为null
REDIS_PORT=6379 #Redis端口
Modify the /config/wechat.php configuration according to the content of the WeChat public platform
' app_id ' => env ( ' WECHAT_OFFICIAL_ACCOUNT_APPID ' , ' appid ' ),
' secret ' => env ( ' WECHAT_OFFICIAL_ACCOUNT_SECRET ' , ' secret ' ),
' token ' => env ( ' WECHAT_OFFICIAL_ACCOUNT_TOKEN ' , ' token ' ),
' aes_key ' => env ( ' WECHAT_OFFICIAL_ACCOUNT_AES_KEY ' , ' aeskey ' )
Next, please complete the following steps:
1. Create applications on the Taobao Alliance Open Platform (the application type can be selected as a website). To obtain the AppKey official website, please apply on the application page yourself." Taobao Customer [Promoter] Promotion Order and Data Query" and "Taobao Customer [Public] Material Information Query" "(This interface has been replaced by DaTaoke interface processing) Interface permissions, if you need a reason to apply, just write a short essay and it will be approved in seconds
2. Register for Taobao Open Platform and authorize Taobao Alliance to obtain the Appkey official website. 3. If you need Taobao private domain management function (automatic follow-up), please apply for private domain permissions in Taobao Alliance and apply for an invitation code. Invitation codes can be applied quickly through debugging the official interface. When calling the interface, please ensure that the relationship_app parameter is common and the code_type parameter is 3.
4. Register for the JD.com Alliance and apply for APIKey, and authorize it to be bound to Taoke.
Modify /config/config.php configuration
' name ' => "淘乐饭" , //产品名称 会反应在用户交互等场景
' url ' => "https: //*.*.*", //站点url 如有饭粒网等网站可添加
' apiUrl ' => "https: //*.*.*", //APIurl 调用本程序使用的url
' dtkAppKey ' => "**** " , //大淘客appKey
'dtkAppSecret' => " **** " , //大淘客AppSecret
'aliAppKey' => " **** " , //淘宝联盟AppKey
'aliAppSecret' => " **** " , //淘宝联盟AppSecret
'pubpid' => 'mm_***_***_***', //公用PID 可与运营ID相同
'specialpid' => ' ******',//会员运营ID
'relationId'=>'****', //渠道ID 代理商使用 暂未开发
'inviter_code'=>'******' //会员私域邀请码
'default_rebate_ratio' => 65, //默认返利比例%,
'eleme_url' => " taoke/pages/shopping-guide/index?scene=****** " ,//饿了么小程序路径(后面会有获取方法)
'unionId' => " ****** " , //京东联盟ID
'jdApiKey' => " ****** " , //京东联盟APIKey
'contactType' => 1, //联系客服类型,为0返回微信号,为1返回二维码图片
'contactId' => " ", //客服微信号
' contactMediaId ' => "", //客服微信二维码图片MediaID(获取方式见Readme文档介绍)
'invite'=> 1 , //是否开启邀请 开启填写1 关闭填写0
'invite_ratio'=> 10 , //邀请返利比例%
'invite_rewards'=> 1 , //邀请奖励金额
'template_id'=>'****** ' , //模板消息ID(后面会有获取方法)
' withdraw_template_id'=>'****** ' //提现模板消息ID(后面会有获取方法)
' invite_template_id'=>'****** ' ,//邀请好友模板消息ID
'createPoster'=> 1 , //是否开启生成海报 开启填写1 关闭填写0 如开启生成海报,请将jpg格式海报模板上传到public下并命名为poster.jpg
'posterx'=>' 206 ', //二维码在海报中x位置
'postery'=>' 1057 ', //二维码在海报中y位置
' posterwh'=>' 200 ', //二维码在海报中宽高
--MediaId acquisition method uses WeChat public platform interface debugging tool
首先调用获取access_token接口
然后使用取得的token调用多媒体文件上传接口
将获得的MediaId填写到config文件即可
After setting up the domain name and SSL certificate, fill in your domain name/wechat for the public platform URL
And pay attention to setting the business domain name and authorized domain name in the WeChat public account function settings (no need to add /wechat). For example:
www.***.com/wechat
Use any account to send "Create Menu" to the official account to create a custom menu. If you need to delete the menu, please modify the $buttons variable in /app/Http/Controllers/WechatController.php
访问管理员注册页面创建超级管理员
````shell script
http://你的域名/adminReg
#该页面仅能创建一次超级管理员,如果后续忘记超级管理员账号密码
#删除站点目录下/storage/app/admin.lock文件后即可重新创建
After logging in to the management background, visit the following address to obtain template_id
http://你的域名/setIndustry
#请确保访问该页面前,公众号已配置完成并已认证
#访问提示设置成功后,前往公众号后台->广告与服务->模板消息,获得创建的模板id,并分别填入config.php中
If you want to activate the Ele.me mini program for rebates, please link the Ele.me mini program (APPID: wxece3a9a4c82f58c9)
Through the Taobao Alliance APP-Eat, Drink and Play-Ele.me WeChat Mini Program Exclusive-Share Mini Program, obtain the exclusive path and configure it in config.php
Set the timer crontab to query and store orders
crontab -e
* * * * * curl 你的域名/getOrderList
#每分钟查询一次订单信息并存入数据库
10 1 1 , 10 , 19 , 28 * * curl 你的域名/updateOrderAll
#每个月1、10、19、28日1点10分执行对上月及上上月订单的信息修改及结算等(仅联盟结算日期为上月的才会被结算)
At this point, the Taolefan project has been deployed and can be used normally. If you have followed the public account before deploying the project, you can automatically register the account into the database by unfollowing it and following it again.