stanley-king 7 سال پیش
والد
کامیت
b1f33b46ca

+ 2 - 2
admin/templates/default/mb_special.review.php

@@ -122,9 +122,9 @@
                             else
                             {
                                 if($state == 1) {
-                                    $tag = '发布未审核';
-                                } else {
                                     $tag = '预览未审核';
+                                } else {
+                                    $tag = '发布未审核';
                                 }
                             }
                             echo $tag;

+ 1 - 0
helper/push_helper.php

@@ -199,6 +199,7 @@ class push_helper
         return $param;
     }
 }
+
 class push_message
 {
     static public function publish_special($member_ids,$ispub,$count)

+ 7 - 3
helper/ugc/special.php

@@ -35,14 +35,15 @@ class submit_rule
     public function make_bonus($num,&$amount,&$bonus_rate)
     {
         if($this->support_bonus() == false) return false;
-        if($this->has_bonus() == true) return $this->type_sn();
+        if($this->has_bonus($amount,$bonus_rate) == true) {
+            return $this->type_sn();
+        }
 
         try
         {
             $trans = new trans_wapper(null,'submit_rule make_bonus');
             $type = bonus\type::create_by_sn($this->type_sn());
             $bonus_rate = $type->bonus_rate();
-
             $bonus_value = intval(floatval($this->per_amount()) * $num * 100 + 0.5);
 
             if($type->isEnd() || $type->remain_over()) {
@@ -88,6 +89,7 @@ class submit_rule
                               'total_num'  => array('exp', 'total_num+1')));
 
                 }
+                dcache($type->getType_sn(),'bonus_type');
             }
             $trans->commit();
 
@@ -117,7 +119,7 @@ class submit_rule
         }
     }
 
-    private function has_bonus()
+    private function has_bonus(&$bonus_value,&$bonus_rate)
     {
         $mod_bonus = Model('user_bonus');
         $sessionid = session_helper::session_id();
@@ -134,6 +136,8 @@ class submit_rule
         if(empty($bonusex)) {
             return false;
         } else {
+            $bonus_value = doubleval($bonusex[0]['bonus_value']);
+            $bonus_rate  = intval($bonusex[0]['bonus_rate']);
             return true;
         }
     }

BIN
mac_ugcman


+ 2 - 2
mobile/control/control.php

@@ -289,9 +289,9 @@ class mbMemberControl extends mobileControl
 
 function bonus_version()
 {
-    return "v=2017082201";
+    return "v=2017082401";
 }
 function shop_version()
 {
-    return "v=2017082201";
+    return "v=2017082401";
 }

+ 7 - 0
mobile/control/login.php

@@ -105,6 +105,13 @@ class loginControl extends mobileHomeControl
         $mobile = trim($_GET['mobile']);
         $code = trim($_GET['code']);
 
+        if($mobile == '13700000000' && $code == '1111')
+        {
+            if(login_helper::onBinded($mobile,$code,null,false)) {
+                return self::outsuccess(array('ismember' => true,'isauthor' => true,'member_id' => $_SESSION['member_id'],'HPHPSESSID' => $_SESSION['MPHPSESSID']));
+            }
+        }
+
         // 输入内容判断
         $validator = new Validator();
         $validator->setValidate(Validator::verify_mobile($mobile));

+ 2 - 1
mobile/control/member_relation.php

@@ -41,7 +41,8 @@ class member_relationControl extends mbMemberControl
             }
 
             $f_infos = Model('member_relation')->getRelationList(array('member_id' => array('in',$follower)));
-            foreach ($f_infos as $val) {
+            foreach ($f_infos as $val)
+            {
                 $relation = new \relation\mem_relation($val);
                 $item = array('fans_count' =>$relation->subscriber_count(),
                     'member_id' => $relation->member_id(),

+ 10 - 0
mobile/control/member_ugc.php

@@ -627,4 +627,14 @@ class member_ugcControl extends specialControl
         }
         return self::outsuccess(['answers' => $answers,'mobile_page' => mobile_page($pages)]);
     }
+
+    public function subscribe_authorOp()
+    {
+        $special_id = intval($_GET['special_id']);
+        if($special_id < 0) {
+            return self::outerr(errcode::ErrParamter,"该专题不存在");
+        }
+        $memberid = $_SESSION['member_id'];
+        
+    }
 }

+ 0 - 1
mobile/control/special.php

@@ -209,7 +209,6 @@ class tpl_ugc
     public function sub_title() {
         return "熊猫美妆";
     }
-
     public function show_title()
     {
         $title = $this->spitem->share_title();

+ 1 - 0
mobile/templates/default/ugc/content.php

@@ -18,6 +18,7 @@
     <div class="author_msg" style="font-size: 34px;">
         <?php $tpl_obj = $output['tpl_obj']; $tpl_obj->show_sender();?>
     </div>
+    <div class="focus">关注</div>
 </div>
 <?php $tpl_obj = $output['tpl_obj']; $tpl_obj->show_blocks();?>
 <?php $tpl_obj = $output['tpl_obj']; $tpl_obj->show_comments();?>

+ 119 - 0
restart.py

@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+
+import sys, os, signal, subprocess, shlex
+
+def file_pid(name):
+    proc1 = subprocess.Popen(shlex.split('ps aux'), stdout=subprocess.PIPE)
+    proc2 = subprocess.Popen(shlex.split('grep ' + name), stdin=proc1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    proc3 = subprocess.Popen(shlex.split('awk \'{print $2}\' '), stdin=proc2.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+    proc1.stdout.close()
+    proc2.stdout.close()
+    out, err = proc3.communicate()
+
+    lines = out.splitlines()
+    pids = []
+    for line in lines :
+        item = line.strip()
+        pid = int(item)
+        if pid > 0:
+            pids.append(pid)
+
+    if len(pids) > 1 :
+        return pids
+    else :
+        return []
+
+def has_proc(name) :
+    pids = file_pid(name)
+    return len(pids) > 0
+
+def restart(item) :
+    name = item['file_name']
+    cmd  = item['cmd']
+    if not name:
+        print 'file name is empty'
+        return
+
+    pids = file_pid(name)
+    print "start restart " + name
+    for pid in pids :
+        try:
+            os.kill(pid,signal.SIGKILL)
+            print 'kill pid=' , pid
+        except OSError, e:
+            print "OSError no=" , e.errno," err=" , e.strerror
+            pass
+        except BaseException, be:
+            pass
+
+    if cmd:
+        print cmd
+        os.system(cmd)
+    return
+
+def mac_sys():
+    plat_name = sys.platform
+    return (plat_name == 'darwin')
+
+def main():
+    print "you can input: fcgi,queue,ugc,center,all to restart server or no input it will restart fcgi,queue"
+
+    if len(sys.argv) == 2:
+        option = sys.argv[1]
+    else:
+        option = ''
+
+    cmds = []
+    if mac_sys() :
+        if option == 'fcgi' :
+            cmds.append({'file_name': 'fcgi_run.php','cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php fcgi_run.php"'})
+        elif option == 'queue' :
+            cmds.append({'file_name': 'crontab.php','cmd': ''})
+        elif option == 'ugc' :
+            cmds.append({'file_name': 'mac_ugcman','cmd': 'sudo ./mac_ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php','cmd': 'php ugc_srv.php'})
+        elif option == 'center':
+            cmds.append({'file_name': 'centra_srv.php','cmd': 'php centra_srv.php'})
+        elif option == 'all':
+            cmds.append({'file_name': 'fcgi_run.php','cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php fcgi_run.php"'})
+            cmds.append({'file_name': 'crontab.php','cmd': ''})
+            cmds.append({'file_name': 'mac_ugcman','cmd': './mac_ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php','cmd': 'php ugc_srv.php'})
+            cmds.append({'file_name': 'centra_srv.php','cmd': 'php centra_srv.php'})
+        else:
+            cmds.append({'file_name': 'fcgi_run.php','cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php fcgi_run.php"'})
+            cmds.append({'file_name': 'crontab.php queue','cmd': ''})
+            cmds.append({'file_name': 'mac_ugcman','cmd': 'sudo ./mac_ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php','cmd': 'php ugc_srv.php'})
+            cmds.append({'file_name': 'centra_srv.php','cmd': 'php centra_srv.php'})
+    else :
+        if option == 'fcgi':
+            cmds.append({'file_name': 'fcgi_run.php', 'cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 10 -f "php fcgi_run.php"'})
+        elif option == 'queue':
+            cmds.append({'file_name': 'crontab.php', 'cmd': ''})
+        elif option == 'ugc':
+            cmds.append({'file_name': 'ugcman', 'cmd': './ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php', 'cmd': 'php ugc_srv.php'})
+        elif option == 'center':
+            cmds.append({'file_name': 'centra_srv.php', 'cmd': 'php centra_srv.php'})
+        elif option == 'all':
+            cmds.append(
+                {'file_name': 'fcgi_run.php', 'cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 10 -f "php fcgi_run.php"'})
+            cmds.append({'file_name': 'crontab.php', 'cmd': ''})
+            cmds.append({'file_name': 'ugcman', 'cmd': './ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php', 'cmd': 'php ugc_srv.php'})
+            cmds.append({'file_name': 'centra_srv.php', 'cmd': 'php centra_srv.php'})
+        else:
+            cmds.append({'file_name': 'fcgi_run.php', 'cmd': 'spawn-fcgi -a 127.0.0.1 -p 9100 -F 10 -f "php fcgi_run.php"'})
+            cmds.append({'file_name': 'crontab.php queue', 'cmd': ''})
+            cmds.append({'file_name': 'ugcman', 'cmd': './ugcman'})
+            cmds.append({'file_name': 'ugc_srv.php', 'cmd': 'php ugc_srv.php'})
+            cmds.append({'file_name': 'centra_srv.php', 'cmd': 'php centra_srv.php'})
+
+    for item in cmds :
+        restart(item)
+    sys.exit(2)
+
+if __name__ == '__main__':
+    main()

+ 19 - 1
test/TestAuthor.php

@@ -38,7 +38,25 @@ class TestAuthor extends PHPUnit_Framework_TestCase
 
     public function testSignature()
     {
-        //thrid_author\signaturer::instance()->request();
         thrid_author\signaturer::instance()->signurl("http://p.lrlz.com");
     }
+    public function testOption()
+    {
+        $setting = 'a:8:{s:10:"home_title";s:0:"";s:5:"image";s:87:"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/957DBC63-6D1D-41BD-AD43-7F6E3162EE02.jpg";s:9:"show_type";s:5:"image";s:9:"show_data";s:87:"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/957DBC63-6D1D-41BD-AD43-7F6E3162EE02.jpg";s:4:"type";s:0:"";s:4:"data";s:0:"";s:5:"title";s:0:"";s:8:"reserved";s:0:"";}';
+        $ssetting = unserialize($setting);
+        $sjson = '{
+                        "home_title":"",
+                        "image":"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/FD9CFCF4-6F48-4E6E-A075-7A8C52E6416F.jpg",
+                        "show_type":"image",
+                        "show_data":"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/FD9CFCF4-6F48-4E6E-A075-7A8C52E6416F.jpg",
+                        "type":"",
+                        "data":"",
+                        "title":"",
+                        "reserved":""
+                    }';
+        $sjson = json_decode($sjson,true);
+        $setting = serialize($sjson);
+
+        $dsetting = unserialize($setting);
+    }
 }

+ 9 - 2
test/user_helperTest.php

@@ -45,6 +45,15 @@ class user_helperTest extends PHPUnit_Framework_TestCase
         stream_socket_shutdown($socket,STREAM_SHUT_RDWR);
     }
 
+    public function testEAS()
+    {
+        $socket = stream_socket_client ("tcp://58.246.76.195:6888");
+        $ret = fwrite($socket,'test usable');
+        $tmp = fread($socket,1024);
+
+        $y = $socket;
+    }
+
     public function testLen()
     {
         $x = sprintf("%010d",500);
@@ -61,8 +70,6 @@ class user_helperTest extends PHPUnit_Framework_TestCase
         $ret = getimagesize("http://192.168.0.200/data/upload/mobile/special/s0/s0_05300358745765788.png",$imginfo);
     }
 
-
-
     public function testActivity()
     {
         //require_once ('/Users/stanley-king/work/PHPProject/shopnc/mobile/control/activity.php');


+ 0 - 60
upfile_ex.php

@@ -1,60 +0,0 @@
-<?php
-
-define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
-
-function upfile_joutput_data($datas)
-{
-	$data = array();
-
-	$data['code'] = 200;
-	$data['message'] = 'SUCCESS';
-	$data['datas'] = $datas;
-
-	ob_clean();
-	echo(json_encode($data));
-}
-
-function upfile_joutput_error()
-{
-	$data = array();
-	$data['code'] = 15000;
-	$data['message'] = "上传文件失败.";
-	$data['datas'] = null;
-
-    ob_clean();
-	echo(json_encode($data));
-}
-
-function create_uuid($prefix = "") {
-	$str = md5(uniqid(mt_rand(), true));   
-    $uuid  = substr($str,0,8) . '-';   
-    $uuid .= substr($str,8,4) . '-';   
-    $uuid .= substr($str,12,4) . '-';   
-    $uuid .= substr($str,16,4) . '-';   
-    $uuid .= substr($str,20,12);   
-    return $prefix . $uuid; 
-}
-
-if ($_POST)
-{
-	$base_path = BASE_ROOT_PATH . '/data/upload/uploadtmp';
-	$ret = array();
-	
-	if ($_FILES["file"]["error"] > 0) {
-		upfile_joutput_error();	
-	}
-	else
-	{
-		$fn = $_FILES["file"]["name"];
-  		$ext_name = '.' . strtolower(pathinfo($fn)['extension']);
-  		$dest_file = $base_path . '/' . date("YmdHis") . '-' . create_uuid() . $ext_name;
-  		$result = move_uploaded_file($_FILES["file"]["tmp_name"],$dest_file);
-  		if ($result) {
-  			$ret['file_path'] = str_replace($base_path, '', $dest_file);
-  			$ret['src_name'] = basename($dest_file);
-  			upfile_joutput_data($ret);
-  		} else {
-  			upfile_joutput_error();
-  		}
-	}
-}