Sorting-computing of multiple parameter values in a database in the thinkphp framework

Source: Internet
Author: User
My data table is as follows: My goal is to retrieve the answers of comments, answers, and members in the broker_achieve table in the previous week, calculate the value based on the comments number weight 50%, answers number weight 25%, and members weight 25%. Then, place the number in the broker table broker...

My data tables are as follows:

My goal is to retrieve the answers of comments, answers, and members in the broker_achieve table in the previous week, calculate the value based on comments weight 50%, answers number weight 25%, and members weight 25%, and then place the number in broker_sort of the broker table. Broker_sort will be used for sorting in future calls.

I am a little confused about how thinkphp operates the data obtained...

Public function refresh () {$ achieve = M ('broker _ achieve '); // broker achievement $ broker = M ('broker '); // broker Details table broker_sort is the broker's sorting value up to $ thisyear = date ('y'); $ thisweek = date ('W')-1; // obtain the week (last week) $ thisachieve = $ achieve-> where ("year = $ thisyear and week = $ thisweek "); // obtain all data in a time period}

Reply content:

My data tables are as follows:

My goal is to retrieve the answers of comments, answers, and members in the broker_achieve table in the previous week, calculate the value based on comments weight 50%, answers number weight 25%, and members weight 25%, and then place the number in broker_sort of the broker table. Broker_sort will be used for sorting in future calls.

I am a little confused about how thinkphp operates the data obtained...

Public function refresh () {$ achieve = M ('broker _ achieve '); // broker achievement $ broker = M ('broker '); // broker Details table broker_sort is the broker's sorting value up to $ thisyear = date ('y'); $ thisweek = date ('W')-1; // obtain the week (last week) $ thisachieve = $ achieve-> where ("year = $ thisyear and week = $ thisweek "); // obtain all data in a time period}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.